当前位置: 首页>>代码示例>>PHP>>正文


PHP CUserTypeEntity::GetList方法代码示例

本文整理汇总了PHP中CUserTypeEntity::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserTypeEntity::GetList方法的具体用法?PHP CUserTypeEntity::GetList怎么用?PHP CUserTypeEntity::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUserTypeEntity的用法示例。


在下文中一共展示了CUserTypeEntity::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateAddCode

 /**
  * Генерация создания
  *
  * generateAddCode
  * @param array $hlBlockId
  * @return string
  * @throws \Exception
  */
 public function generateAddCode($hlBlockId)
 {
     $return = array();
     $hlBlock = HL\HighloadBlockTable::getById($hlBlockId)->fetch();
     if (!$hlBlock) {
         throw new BimException('Not found highload block with id = ' . $hlBlockId);
     }
     $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\HighloadblockIntegrate', 'Add', array($hlBlock['NAME'], $hlBlock['TABLE_NAME']));
     $hlQuery = $this->userType->GetList(array(), array("ENTITY_ID" => "HLBLOCK_" . $hlBlockId));
     while ($hlData = $hlQuery->Fetch()) {
         $fullData = $this->userType->GetByID($hlData['ID']);
         unset($fullData['ID']);
         unset($fullData['ENTITY_ID']);
         if (($fullData['USER_TYPE_ID'] == "iblock_element" || $fullData['USER_TYPE_ID'] == "iblock_section") && isset($fullData['SETTINGS']['IBLOCK_ID'])) {
             if (!empty($fullData['SETTINGS']['IBLOCK_ID'])) {
                 $iblockId = $fullData['SETTINGS']['IBLOCK_ID'];
                 unset($fullData['SETTINGS']['IBLOCK_ID']);
                 $blockQuery = $this->iblock->GetList(array(), array('ID' => $iblockId, 'CHECK_PERMISSIONS' => 'N'));
                 if ($iBlockData = $blockQuery->Fetch()) {
                     $fullData['SETTINGS']['IBLOCK_CODE'] = $iBlockData['CODE'];
                 } else {
                     throw new BimException(' Not found iblock with id ' . $iblockId);
                 }
             }
         }
         $return[] = $this->getMethodContent('Bim\\Db\\Iblock\\HighloadblockFieldIntegrate', 'Add', array($hlBlock['NAME'], $fullData));
     }
     return implode(PHP_EOL, $return);
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:37,代码来源:Hlblock.php

示例2: isMandatoryUserFieldExists

 /**
  * @return bool true if some mandatory UF exists for TASKS
  */
 public static function isMandatoryUserFieldExists()
 {
     /** @var $CACHE_MANAGER CCacheManager */
     global $CACHE_MANAGER;
     $isFieldExists = null;
     // unknown yet
     $obCache = new CPHPCache();
     $lifeTime = CTasksTools::CACHE_TTL_UNLIM;
     $cacheID = md5('uftasks');
     $cacheDir = "/tasks/ufs";
     if (defined('BX_COMP_MANAGED_CACHE') && $obCache->InitCache($lifeTime, $cacheID, $cacheDir)) {
         $data = $obCache->GetVars();
         $isFieldExists = $data['isFieldExists'];
     } else {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $rsUserType = CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'TASKS_TASK', 'MANDATORY' => 'Y'));
         if ($rsUserType->fetch()) {
             $isFieldExists = true;
         } else {
             $isFieldExists = false;
         }
         if (defined('BX_COMP_MANAGED_CACHE') && $obCache->StartDataCache()) {
             $CACHE_MANAGER->StartTagCache($cacheDir);
             $CACHE_MANAGER->RegisterTag('tasks_user_fields');
             $CACHE_MANAGER->EndTagCache();
             $data = array('isFieldExists' => $isFieldExists);
             $obCache->EndDataCache($data);
         }
     }
     return $isFieldExists;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:taskrarelytools.php

示例3: __wd_check_uf_use_bp_property

	function __wd_check_uf_use_bp_property($iblock_id)
	{
		$iblock_id = intval($iblock_id); 
		$db_res = CUserTypeEntity::GetList(array($by=>$order), array("ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION", "FIELD_NAME" => "UF_USE_BP"));
		if (!$db_res || !($res = $db_res->GetNext()))
		{
			$arFields = Array(
				"ENTITY_ID" => "IBLOCK_".$iblock_id."_SECTION",
				"FIELD_NAME" => "UF_USE_BP",
				"USER_TYPE_ID" => "string",
				"MULTIPLE" => "N",
				"MANDATORY" => "N", 
				"SETTINGS" => array("DEFAULT_VALUE" => "Y"));
			$arFieldName = array();
			$rsLanguage = CLanguage::GetList($by, $order, array());
			while($arLanguage = $rsLanguage->Fetch()):
//				GetMessage("SONET_UF_USE_BP");
				$dir = str_replace(array("\\", "//"), "/", dirname(__FILE__)); 
				$dirs = explode("/", $dir); 
				array_pop($dirs); 
				$file = trim(implode("/", $dirs)."/lang/".$arLanguage["LID"]."/include/webdav_settings.php");
				$tmp_mess = __IncludeLang($file, true);
				$arFieldName[$arLanguage["LID"]] = (empty($tmp_mess["SONET_UF_USE_BP"]) ? "Use Business Process" : $tmp_mess["SONET_UF_USE_BP"]);
			endwhile;
			$arFields["EDIT_FORM_LABEL"] = $arFieldName;
			$obUserField  = new CUserTypeEntity;
			$obUserField->Add($arFields);
			$GLOBALS["USER_FIELD_MANAGER"]->arFieldsCache = array();
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:30,代码来源:webdav_settings.php

示例4: getUserTypeEntity

 public function getUserTypeEntity($entityId, $fieldName)
 {
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $dbRes = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $entityId, 'FIELD_NAME' => $fieldName));
     $aItem = $dbRes->Fetch();
     return !empty($aItem) ? $aItem : false;
 }
开发者ID:andreyryabin,项目名称:sprint.migration,代码行数:7,代码来源:UserTypeEntityHelper.php

示例5: getUserEntityFields

 function getUserEntityFields()
 {
     if (empty($this->_user_fields)) {
         $rsData = CUserTypeEntity::GetList(array($by => $order), array());
         while ($arData = $rsData->GetNext()) {
             $this->_user_fields[$arData["ID"]] = $arData;
         }
     }
     return $this->_user_fields;
 }
开发者ID:ASDAFF,项目名称:trigger-module,代码行数:10,代码来源:FoodclubEventActionClass.php

示例6: getListFor

 /**
  * Возвращает список полей, которые подключены к пользователю
  * @return array
  */
 public static function getListFor($entity)
 {
     if (!isset(self::$_entities[$entity])) {
         self::$_entities[$entity] = array();
         $array = array();
         $rsData = \CUserTypeEntity::GetList(array(), ['ENTITY_ID' => $entity]);
         while ($ob = $rsData->Fetch()) {
             self::$_entities[$entity][] = $ob;
         }
     }
     return self::$_entities[$entity];
 }
开发者ID:marvin255,项目名称:bxar,代码行数:16,代码来源:Uf.php

示例7: InstallUserFields

 function InstallUserFields()
 {
     global $USER_FIELD_MANAGER, $APPLICATION;
     AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElement", "GetUserTypeDescription"));
     AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeWebdavElementHistory", "GetUserTypeDescription"));
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdav.php";
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/webdav/classes/usertypewebdavelementhistory.php";
     $USER_FIELD_MANAGER->CleanCache();
     $USER_FIELD_MANAGER->arUserTypes = '';
     $arFields = array("BLOG_POST" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_FILE", "XML_ID" => "UF_BLOG_POST_FILE"), "BLOG_COMMENT" => array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FILE", "XML_ID" => "UF_BLOG_COMMENT_FILE"));
     $arFieldProps = array("USER_TYPE_ID" => "webdav_element", "SORT" => 100, "MULTIPLE" => "Y", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "");
     $typeData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH"));
     if (!($typeData = $typeData->Fetch())) {
         $arFieldPropsHistory = array("USER_TYPE_ID" => "webdav_element_history", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_FH", "XML_ID" => "UF_BLOG_COMMENT_FH");
         $obUserField = new CUserTypeEntity();
         $intID = $obUserField->Add($arFieldPropsHistory);
         if (false == $intID) {
             if ($strEx = $APPLICATION->GetException()) {
                 $this->errors[] = $strEx->GetString();
             }
         }
     }
     foreach ($arFields as $fieldName => $arField) {
         $rsData = CUserTypeEntity::GetList(array(), $arField);
         if ($arRes = $rsData->Fetch()) {
             $intID = $arRes['ID'];
         } else {
             $arProps = $arFieldProps + $arField;
             $obUserField = new CUserTypeEntity();
             $intID = $obUserField->Add($arProps);
             if (false == $intID) {
                 if ($strEx = $APPLICATION->GetException()) {
                     $this->errors[] = $strEx->GetString();
                 }
             }
         }
     }
     $rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_F_EDIT"));
     $arRes = $rsData->Fetch();
     if (!$arRes) {
         $arFieldProps = array("USER_TYPE_ID" => "boolean", "SORT" => 100, "MULTIPLE" => "N", "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "N", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_F_EDIT", "XML_ID" => "UF_BLOG_POST_F_EDIT");
         $obUserField = new CUserTypeEntity();
         $propID = $obUserField->Add($arFieldProps, false);
     }
     $rsData = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_BLOG_POST_FILE"));
     $arRes = $rsData->Fetch();
     if ($arRes && empty($arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'])) {
         $arRes['SETTINGS']['UF_TO_SAVE_ALLOW_EDIT'] = 'UF_BLOG_POST_F_EDIT';
         $obUserField = new CUserTypeEntity();
         $res = $obUserField->Update($arRes['ID'], array('SETTINGS' => $arRes['SETTINGS']));
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:52,代码来源:index.php

示例8: addValueToList

function addValueToList($field, $entity, $props)
{
    $raw = CUserTypeEntity::GetList(array($by => $order), array('FIELD_NAME' => $field, 'ENTITY_ID' => $entity))->Fetch();
    $fields = array();
    $enum = CUserFieldEnum::GetList(array(), array("USER_FIELD_ID" => $raw['ID']));
    while ($el = $enum->GetNext()) {
        $fields[$el['XML_ID']] = $el;
    }
    if (!isset($fields[$props['XML_ID']])) {
        $obEnum = new CUserFieldEnum();
        $obEnum->SetEnumValues($raw['ID'], array("n0" => $props));
    }
}
开发者ID:dayAlone,项目名称:MyQube,代码行数:13,代码来源:helpers.php

示例9: checkExistProperty

 /**
  * @param string $propCode
  * @param string $userType
  * 
  * @return bool
  * 
  * @throws PropertyAlreadyExistException
  */
 protected function checkExistProperty($propCode, $userType)
 {
     $propertyModel = new \CUserTypeEntity();
     $rsProperty = $propertyModel->GetList([], ['ENTITY_ID' => 'IBLOCK_' . $this->getIblockId() . '_SECTION', 'FIELD_NAME' => 'UF_' . $propCode]);
     if ($property = $rsProperty->Fetch()) {
         if ($property['USER_TYPE_ID'] !== $userType) {
             throw new PropertyAlreadyExistException($propCode);
         } else {
             return true;
         }
     }
     return false;
 }
开发者ID:notamedia,项目名称:bitrix-i18n,代码行数:21,代码来源:sectionconverter.php

示例10: getEnumVariant

 public function getEnumVariant($attr, $code)
 {
     $attrData = $this->attrs[$attr];
     if (ltrim($attrData[0], '\\') != PropEnumElement::className()) {
         throw new \Exception('Attr `' . $attr . '(' . $attrData[0] . ')` is not list');
     }
     $field = $this->attrsToFields[$attr];
     $userField = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'USER', 'FIELD_NAME' => $field))->Fetch();
     if (!$userField) {
         throw new \Exception('User property `' . $field . '` as code `' . $field . '` not exists');
     }
     $gw = $this->getGatewayByEntityClass(PropEnumElement::className());
     return $gw->findOne(array(array('attr' => 'propertyId', 'operator' => '', 'value' => $userField['ID']), array('attr' => 'xmlId', 'operator' => '', 'value' => $code)), array('value' => 'asc'));
 }
开发者ID:Under5,项目名称:bitrix-module-tools,代码行数:14,代码来源:user.php

示例11: down

 public function down()
 {
     global $APPLICATION;
     $arHlData = $this->arHlData;
     \Bitrix\Main\Loader::includeModule("highloadblock");
     $arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\PeopleTable::getTableName())))->fetch();
     if ($arHlblock) {
         foreach ($arHlData as $fieldName => $fieldValue) {
             $oUserTypeEntity = new \CUserTypeEntity();
             $resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName));
             if ($aUserHasField = $resProperty->Fetch()) {
                 $oUserTypeEntity->Delete($aUserHasField['ID']);
                 $this->outSuccess("Свойство удалено!");
             }
         }
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:17,代码来源:Version20160829145834.php

示例12: down

 public function down()
 {
     global $APPLICATION;
     \Bitrix\Main\Loader::includeModule("highloadblock");
     $arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\SubscribeTable::getTableName())))->fetch();
     if ($arHlblock) {
         $arProps = array("UF_DATETIME_TO");
         foreach ($arProps as $prop_name) {
             $oUserTypeEntity = new \CUserTypeEntity();
             $resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $prop_name));
             if ($aUserHasField = $resProperty->Fetch()) {
                 $oUserTypeEntity->Delete($aUserHasField['ID']);
                 $this->outSuccess("Свойство 'Дата окончания подписки' удалено!");
             }
         }
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:17,代码来源:Version20160720205816.php

示例13: UpdateCodes

 public function UpdateCodes($USER_ID)
 {
     /** @global CUserTypeManager $USER_FIELD_MANAGER */
     global $DB, $USER_FIELD_MANAGER;
     $USER_ID = intval($USER_ID);
     $arDep = $USER_FIELD_MANAGER->GetUserFieldValue("USER", "UF_DEPARTMENT", $USER_ID);
     if (is_array($arDep) && !empty($arDep)) {
         $iblockId = COption::GetOptionInt('intranet', 'iblock_structure', 0);
         $res = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => "UF_HEAD"));
         if ($res->Fetch()) {
             //user's department ('D') and all departments above ('DR')
             $DB->Query("\n\t\t\t\t\tINSERT INTO b_user_access (USER_ID, PROVIDER_ID, ACCESS_CODE)\n\t\t\t\t\tSELECT " . $USER_ID . ", '" . $DB->ForSQL($this->id) . "', " . $DB->Concat("T1.ROLE", $DB->type == "MSSQL" ? "CAST(T1.ID as varchar(17))" : "T1.ID") . "\n\t\t\t\t\tFROM (\n\t\t\t\t\t\tSELECT DISTINCT BS2.ID ID, (case when BS.ID = BS2.ID then 'D' else 'DR' end) ROLE\n\t\t\t\t\t\tFROM b_iblock_section BS\n\t\t\t\t\t\t\tLEFT JOIN b_iblock_section BS2 ON BS2.IBLOCK_ID = BS.IBLOCK_ID AND BS2.LEFT_MARGIN <= BS.LEFT_MARGIN AND BS2.RIGHT_MARGIN >= BS.RIGHT_MARGIN\n\t\t\t\t\t\tWHERE BS.ID IN (" . implode(",", $arDep) . ")\n\t\t\t\t\t\t\tAND BS.IBLOCK_ID = " . $iblockId . "\n\t\t\t\t\t\t\tAND BS2.GLOBAL_ACTIVE = 'Y'\n\t\t\t\t\t\tUNION\n\t\t\t\t\t\tSELECT BS.ID ID, 'DR' ROLE\n\t\t\t\t\t\tFROM b_iblock_section BS\n\t\t\t\t\t\tWHERE BS.ID IN (" . implode(",", $arDep) . ")\n\t\t\t\t\t\t\tAND BS.IBLOCK_ID = " . $iblockId . "\n\t\t\t\t\t\t\tAND BS.GLOBAL_ACTIVE = 'Y'\n\t\t\t\t\t) T1\n\t\t\t\t");
             //intranet user himself ('IU')
             $DB->Query("\n\t\t\t\t\tINSERT INTO b_user_access (USER_ID, PROVIDER_ID, ACCESS_CODE)\n\t\t\t\t\tVALUES (" . $USER_ID . ", '" . $DB->ForSQL($this->id) . "', 'IU" . $USER_ID . "')\n\t\t\t\t");
             //if the user is a boss let's add all his subordinates ('IU')
             $DB->Query("\n\t\t\t\t\tINSERT INTO b_user_access (USER_ID, PROVIDER_ID, ACCESS_CODE)\n\t\t\t\t\tSELECT DISTINCT " . $USER_ID . ", '" . $DB->ForSQL($this->id) . "', " . $DB->Concat("'IU'", $DB->type == "MSSQL" ? "CAST(U.ID as varchar(17))" : "U.ID") . "\n\t\t\t\t\tFROM\n\t\t\t\t\t\tb_user U\n\t\t\t\t\t\tINNER JOIN b_utm_user BUF1 ON BUF1.VALUE_ID = U.ID\n\t\t\t\t\t\tINNER JOIN b_user_field UF ON UF.ID = BUF1.FIELD_ID\n\t\t\t\t\t\tINNER JOIN (SELECT BS2.ID AS ID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tb_iblock_section BS\n\t\t\t\t\t\t\t\tINNER JOIN b_uts_iblock_" . $iblockId . "_section BUF ON BUF.VALUE_ID = BS.ID\n\t\t\t\t\t\t\t\tLEFT JOIN b_iblock_section BS2 ON BS2.IBLOCK_ID = BS.IBLOCK_ID AND BS2.LEFT_MARGIN >= BS.LEFT_MARGIN AND BS2.RIGHT_MARGIN <= BS.RIGHT_MARGIN\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tBS.IBLOCK_ID = " . $iblockId . "\n\t\t\t\t\t\t\t\tAND BS2.GLOBAL_ACTIVE = 'Y'\n\t\t\t\t\t\t\t\tAND BUF.UF_HEAD = " . $USER_ID . "\n\t\t\t\t\t\t) S ON S.ID = BUF1.VALUE_INT\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tUF.FIELD_NAME = 'UF_DEPARTMENT'\n\t\t\t\t\t\tAND U.ID <> " . $USER_ID . "\n\t\t\t\t");
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:authproviders.php

示例14: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = $input->getArgument('file');
     if (!file_exists($file) || !($fh = fopen($file, 'r'))) {
         $output->writeln('<error>Can\'t read data from file</error>');
         return null;
     }
     //выбираем группу
     $group = 0;
     $res = \CGroup::GetList($by = '', $order = '', ['STRING_ID' => 'totaldict_chairman_experts']);
     if ($ob = $res->Fetch()) {
         $group = $ob['ID'];
     }
     //выбираем список статусов
     $statusList = [];
     $rsData = \CUserTypeEntity::GetList([], ['ENTITY_ID' => 'USER', 'FIELD_NAME' => 'UF_TD_ORG_STATUS']);
     if ($fob = $rsData->GetNext()) {
         $ar = ['newby' => 'НОВИЧКИ', 'pretty_boy' => 'КРАСАВЧИКИ', 'catching' => 'ДОГОНЯЮЩИЕ', 'redneck' => 'ДЕРЕВНИ'];
         $res = \CUserFieldEnum::GetList([], ['USER_FIELD_ID' => $fob['ID']]);
         while ($ob = $res->Fetch()) {
             if (empty($ar[$ob['XML_ID']])) {
                 continue;
             }
             $statusList[$ar[$ob['XML_ID']]] = $ob['ID'];
         }
     }
     //список стран для заполнения
     $countries = GetCountryArray();
     $countries = array_combine($countries['reference'], $countries['reference_id']);
     $currentStatus = null;
     while (($data = fgetcsv($fh)) !== false) {
         //если заполнена только вторая колонка то это статус
         if (empty($data[1]) && !empty($data[0]) && isset($statusList[$data[0]])) {
             $currentStatus = $statusList[$data[1]];
             continue;
         }
         //массив для загрузки данных пользователя
         $arLoad = ['ACTIVE' => 'Y', 'PERSONAL_COUNTRY' => isset($countries['Россия']) ? $countries['Россия'] : null, 'PERSONAL_CITY' => $data[0], 'LAST_NAME' => $data[1], 'WORK_POSITION' => $data[3], 'PERSONAL_MOBILE' => $data[4], 'PERSONAL_STREET' => $data[6], 'PERSONAL_WWW' => $data[8], 'PASSWORD' => 'Test,user,passwr0d', 'CONFIRM_PASSWORD' => 'Test,user,passwr0d', 'UF_TD_ORG_STATUS' => $currentStatus, 'GROUP_ID' => [2, $group]];
         //пробуем разбить email
         if (strpos($data[5], ',')) {
             $explode = array_map('trim', explode(',', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], 'и')) {
             $explode = array_map('trim', explode('и', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], ';')) {
             $explode = array_map('trim', explode(';', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } elseif (strpos($data[5], ' ')) {
             $explode = array_map('trim', explode(' ', $data[5]));
             $arLoad['EMAIL'] = $explode[0];
             unset($explode[0]);
             $arLoad['PERSONAL_NOTES'] = implode(', ', $explode);
         } else {
             $arLoad['EMAIL'] = trim($data[5]);
         }
         //пробуем разбить фамилию и имя
         if (strpos($data[2], ' ')) {
             $explode = explode(' ', trim($data[2]));
             $arLoad['NAME'] = $explode[0];
             $arLoad['SECOND_NAME'] = $explode[1];
         } else {
             $arLoad['NAME'] = trim($data[2]);
         }
         //пробуем завести дату в базу
         if (($time = strtotime($data[7])) !== false) {
             $arLoad['PERSONAL_BIRTHDAY'] = ConvertTimeStamp($time, 'SHORT', 'ru');
         }
         //пробуем найти страну, чтобы привязать пользователя к городу
         $country = \bxpimple\Locator::$item->get('countryFinder')->mergeFilterWith(['NAME' => 'Россия'])->one();
         if ($country) {
             //если нашли страну, то пробуем найти и город
             $city = \bxpimple\Locator::$item->get('cityFinder')->mergeFilterWith(['NAME' => trim($data[0]), 'PROPERTY_TOTALDICT_GEO_CITIES_COUNTRY' => $country->getAttribute('ID')->getValue()])->one();
             if ($city) {
                 //если нашли город, то привязываем пользователя
                 $arLoad['UF_TD_CITY_IB'] = $city->getAttribute('ID')->getValue();
             }
         }
         //задаем логин, по умолчанию используем email
         $arLoad['LOGIN'] = $arLoad['EMAIL'];
         //пробуем найти пользователя по его логину
         $user = new \CUser();
         $res = \CUser::GetList($by = '', $order = '', ['LOGIN_EQUAL' => $arLoad['LOGIN']]);
         if ($ob = $res->Fetch()) {
             $arGroups = \CUser::GetUserGroup($ob['ID']);
             if (is_array($arGroups)) {
                 $arLoad['GROUP_ID'] = array_unique(array_merge($arLoad['GROUP_ID'], $arGroups));
             }
             //обновляем
             if (!$user->Update($ob['ID'], $arLoad)) {
                 $output->writeln('<error>User ' . $arLoad['LOGIN'] . ' error: ' . $user->LAST_ERROR . '</error>');
             } else {
                 $output->writeln('<info>User ' . $arLoad['LOGIN'] . ' updated</info>');
             }
//.........这里部分代码省略.........
开发者ID:bfday,项目名称:1c_bitrix_initial_repo,代码行数:101,代码来源:ImportUsersExpertsRussia.php

示例15: ImportSectionsProperties

 function ImportSectionsProperties($XML_PARENT, $IBLOCK_ID)
 {
     /** @var CMain $APPLICATION */
     global $APPLICATION;
     $obTypeManager = new CUserTypeEntity();
     $sort = 100;
     $rs = $this->_xml_file->GetList(array("ID" => "asc"), array("PARENT_ID" => $XML_PARENT), array("ID"));
     while ($ar = $rs->Fetch()) {
         $XML_ENUM_PARENT = array();
         $arField = array();
         $rsP = $this->_xml_file->GetList(array("ID" => "asc"), array("PARENT_ID" => $ar["ID"]));
         while ($arP = $rsP->Fetch()) {
             if (isset($arP["VALUE_CLOB"])) {
                 $arP["VALUE"] = $arP["VALUE_CLOB"];
             }
             if ($arP["NAME"] == $this->mess["IBLOCK_XML2_ID"]) {
                 $arField["XML_ID"] = $arP["VALUE"];
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_NAME"]) {
                 $arField["FIELD_NAME"] = $arP["VALUE"];
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_SORT"]) {
                 $arField["SORT"] = $arP["VALUE"];
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_MULTIPLE"]) {
                 $arField["MULTIPLE"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_PROPERTY_TYPE"]) {
                 $arField["USER_TYPE_ID"] = $arP["VALUE"];
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_IS_REQUIRED"]) {
                 $arField["MANDATORY"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_FILTER"]) {
                 $arField["SHOW_FILTER"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_SHOW_IN_LIST"]) {
                 $arField["SHOW_IN_LIST"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_EDIT_IN_LIST"]) {
                 $arField["EDIT_IN_LIST"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_SEARCH"]) {
                 $arField["IS_SEARCHABLE"] = $arP["VALUE"] == "true" || intval($arP["VALUE"]) ? "Y" : "N";
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_BX_SETTINGS"]) {
                 $arField["SETTINGS"] = unserialize($arP["VALUE"]);
             } elseif ($arP["NAME"] == $this->mess["IBLOCK_XML2_CHOICE_VALUES"]) {
                 $XML_ENUM_PARENT = $arP["ID"];
             }
         }
         $rsUserFields = $obTypeManager->GetList(array(), array("ENTITY_ID" => "IBLOCK_" . $IBLOCK_ID . "_SECTION", "XML_ID" => $arField["XML_ID"]));
         $arDBField = $rsUserFields->Fetch();
         if (!$arDBField) {
             $rsUserFields = $obTypeManager->GetList(array(), array("ENTITY_ID" => "IBLOCK_" . $IBLOCK_ID . "_SECTION", "FIELD_NAME" => $arField["FIELD_NAME"]));
             $arDBField = $rsUserFields->Fetch();
         }
         if ($arDBField) {
             $bChanged = false;
             foreach ($arField as $key => $value) {
                 if ($arDBField[$key] !== $value) {
                     $bChanged = true;
                     break;
                 }
             }
             if (!$bChanged) {
                 $arField["ID"] = $arDBField["ID"];
             } elseif ($obTypeManager->Update($arDBField["ID"], $arField)) {
                 $arField["ID"] = $arDBField["ID"];
             } else {
                 if ($e = $APPLICATION->GetException()) {
                     return GetMessage("IBLOCK_XML2_UF_ERROR", array("#XML_ID#" => $arField["XML_ID"], "#ERROR_TEXT#" => $e->GetString()));
                 } else {
                     return false;
                 }
             }
         } else {
             $arField["ENTITY_ID"] = "IBLOCK_" . $IBLOCK_ID . "_SECTION";
             if (!array_key_exists("SORT", $arField)) {
                 $arField["SORT"] = $sort;
             }
             $arField["ID"] = $obTypeManager->Add($arField);
             if (!$arField["ID"]) {
                 if ($e = $APPLICATION->GetException()) {
                     return GetMessage("IBLOCK_XML2_UF_ERROR", array("#XML_ID#" => $arField["XML_ID"], "#ERROR_TEXT#" => $e->GetString()));
                 } else {
                     return false;
                 }
             }
         }
         if ($XML_ENUM_PARENT) {
             $rsE = $this->_xml_file->GetList(array("ID" => "asc"), array("PARENT_ID" => $XML_ENUM_PARENT));
             while ($arE = $rsE->Fetch()) {
                 if (isset($arE["VALUE_CLOB"])) {
                     $arE["VALUE"] = $arE["VALUE_CLOB"];
                 }
                 $arEnumXmlNodes[] = $arE;
             }
             if (!empty($arEnumXmlNodes)) {
                 $this->ImportSectionPropertyEnum($arField["ID"], $arEnumXmlNodes);
             }
         }
         $sort += 100;
     }
     return true;
 }
开发者ID:nycmic,项目名称:bittest,代码行数:96,代码来源:cml2.php


注:本文中的CUserTypeEntity::GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。