本文整理汇总了PHP中CUserTypeEntity::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserTypeEntity::Add方法的具体用法?PHP CUserTypeEntity::Add怎么用?PHP CUserTypeEntity::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUserTypeEntity
的用法示例。
在下文中一共展示了CUserTypeEntity::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InstallDBUserFields
function InstallDBUserFields()
{
$ImportantUserFields = $this->GetIdeaUserFields();
foreach ($ImportantUserFields as $UserFieldName => $Exists) {
if (!$Exists) {
$UserType = new CUserTypeEntity();
switch ($UserFieldName) {
case "UF_CATEGORY_CODE":
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "string", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => array(LANGUAGE_ID => GetMessage("IDEA_UF_CATEGORY_CODE_DESCRIPTION"))));
break;
case "UF_ANSWER_ID":
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "integer", "IS_SEARCHABLE" => "N", "MULTIPLE" => "Y", "EDIT_FORM_LABEL" => array(LANGUAGE_ID => GetMessage("IDEA_UF_ANSWER_ID_DESCRIPTION"))));
break;
case "UF_ORIGINAL_ID":
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "string", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => array(LANGUAGE_ID => GetMessage("IDEA_UF_ORIGINAL_ID_DESCRIPTION"))));
break;
case "UF_STATUS":
$ID = $UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "enumeration", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => array(LANGUAGE_ID => GetMessage("IDEA_UF_STATUS_DESCRIPTION"))));
if (intval($ID) > 0) {
$UserTypeEnum = new CUserFieldEnum();
$UserTypeEnum->SetEnumValues($ID, array("n0" => array("SORT" => 100, "XML_ID" => "NEW", "VALUE" => GetMessage("IDEA_UF_STATUS_NEW_TITLE"), "DEF" => "Y"), "n1" => array("SORT" => 200, "XML_ID" => "PROCESSING", "VALUE" => GetMessage("IDEA_UF_STATUS_PROCESSING_TITLE"), "DEF" => "N"), "n2" => array("SORT" => 300, "XML_ID" => "COMPLETED", "VALUE" => GetMessage("IDEA_UF_STATUS_COMPLETED_TITLE"), "DEF" => "N")));
}
break;
}
}
}
}
示例2: intval
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();
}
}
示例3: UFCreate
/**
* @param string $entity
* @param array $data
* @var bool $deleteIfExists
*/
protected function UFCreate(array $data, $deleteIfExists = false)
{
global $USER_FIELD_MANAGER;
if (empty($data['FIELD_NAME'])) {
throw new \Exception('You must set group FIELD_NAME');
}
if (empty($data['ENTITY_ID'])) {
throw new \Exception('You must set group ENTITY_ID');
}
$fire = false;
if ($this->UFGetIdByCode($data['ENTITY_ID'], $data['FIELD_NAME'])) {
if ($deleteIfExists) {
$this->UFDelete($data['ENTITY_ID'], $data['FIELD_NAME']);
$fire = true;
}
} else {
$fire = true;
}
if ($fire) {
$ib = new \CUserTypeEntity();
$id = $ib->Add(array_merge(['USER_TYPE_ID' => 'string'], $data));
if ($id) {
echo "Add {$data['FIELD_NAME']} user field\r\n";
if (!empty($data['LIST']) && ($arType = $USER_FIELD_MANAGER->GetUserType($data['USER_TYPE_ID'])) && $arType['BASE_TYPE'] == 'enum') {
$obEnum = new \CUserFieldEnum();
$res = $obEnum->SetEnumValues($id, $data['LIST']);
echo "Add {$data['FIELD_NAME']} user field list\r\n";
}
} else {
throw new \Exception("Can't create {$data['FIELD_NAME']} user field");
}
}
}
示例4: array
function __IRM_InitReservation($iblockId)
{
$arResult = array();
$arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
$arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
$arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
foreach ($arKeys as $key) {
if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
if (!Array_Key_Exists($key, $arUserFields)) {
$arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
$obUserField = new CUserTypeEntity();
$obUserField->Add($arFields);
}
}
}
$arResult["ALLOWED_ITEM_PROPERTIES"] = array("UF_PERSONS" => array("NAME" => GetMessage("INTASK_C29_UF_PERSONS"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "UF_PERSONS", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "UF_RES_TYPE" => array("NAME" => GetMessage("INTASK_C29_UF_RES_TYPE"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "UF_RES_TYPE", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEA"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "A"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEB"), "DEF" => "N", "SORT" => 200, "XML_ID" => "B"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEC"), "DEF" => "N", "SORT" => 200, "XML_ID" => "C"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPED"), "DEF" => "N", "SORT" => 300, "XML_ID" => "D"))), "UF_PREPARE_ROOM" => array("NAME" => GetMessage("INTASK_C29_UF_PREPARE_ROOM"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "UF_PREPARE_ROOM", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_TYPE" => array("NAME" => GetMessage("INTASK_C29_PERIOD_TYPE"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_TYPE", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "NONE", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_COUNT" => array("NAME" => GetMessage("INTASK_C29_PERIOD_COUNT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_COUNT", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "EVENT_LENGTH" => array("NAME" => GetMessage("INTASK_C29_EVENT_LENGTH"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "EVENT_LENGTH", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_ADDITIONAL" => array("NAME" => GetMessage("INTASK_C29_PERIOD_ADDITIONAL"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_ADDITIONAL", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
$dbIBlockProps = CIBlock::GetProperties($iblockId);
while ($arIBlockProps = $dbIBlockProps->Fetch()) {
if (Array_Key_Exists($arIBlockProps["CODE"], $arResult["ALLOWED_ITEM_PROPERTIES"])) {
$arResult["ALLOWED_ITEM_PROPERTIES"][$arIBlockProps["CODE"]]["ID"] = $arIBlockProps["ID"];
}
}
$keys = Array_Keys($arResult["ALLOWED_ITEM_PROPERTIES"]);
foreach ($keys as $key) {
if (IntVal($arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"]) <= 0) {
$ibp = new CIBlockProperty();
$arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"] = $ibp->Add($arResult["ALLOWED_ITEM_PROPERTIES"][$key]);
}
}
return $arResult;
}
示例5: GetList
public static function GetList($arOrder = array('CREATED_DATE' => 'DESC'), $arFilter = array(), $arSelect = array(), $nPageTop = false)
{
$ENTITY_ID = 'TASKS_TASK';
$arElement = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields($ENTITY_ID, 0, LANGUAGE_ID);
if ($arElement == false || !isset($arElement['UF_CRM_TASK'])) {
$arFields = array();
$arFields['ENTITY_ID'] = $ENTITY_ID;
$arFields['FIELD_NAME'] = 'UF_CRM_TASK';
$arFields['USER_TYPE_ID'] = 'crm';
$arFields['EDIT_FORM_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['LIST_COLUMN_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['LIST_FILTER_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['SETTINGS']['LEAD'] = 'Y';
$arFields['SETTINGS']['CONTACT'] = 'Y';
$arFields['SETTINGS']['COMPANY'] = 'Y';
$arFields['SETTINGS']['DEAL'] = 'Y';
$arFields['MULTIPLE'] = 'Y';
$CAllUserTypeEntity = new CUserTypeEntity();
$CAllUserTypeEntity->Add($arFields);
}
if (isset($arFilter['ENTITY_TYPE']) && isset($arFilter['ENTITY_ID'])) {
$arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
$arFilter['UF_CRM_TASK'] = $arFilter['ENTITY_TYPE'] . '_' . $arFilter['ENTITY_ID'];
unset($arFilter['ENTITY_TYPE'], $arFilter['ENTITY_ID']);
} else {
if (isset($arFilter['ENTITY_TYPE'])) {
if (!empty($arFilter['ENTITY_TYPE'])) {
$arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
$arFilter['%UF_CRM_TASK'] = $arFilter['ENTITY_TYPE'] . '_';
} else {
$arFilter['!=UF_CRM_TASK'] = '';
}
unset($arFilter['ENTITY_TYPE']);
} else {
$arFilter['!=UF_CRM_TASK'] = '';
}
}
if (isset($arFilter['TITLE'])) {
$arFilter['%TITLE'] = $arFilter['TITLE'];
unset($arFilter['TITLE']);
}
if (isset($arFilter['REAL_STATUS'])) {
$arFilter['STATUS'] = $arFilter['REAL_STATUS'];
unset($arFilter['REAL_STATUS']);
}
if (isset($arOrder['ID']) || isset($arOrder['id'])) {
$arSelect[] = 'ID';
}
if (in_array('RESPONSIBLE_ID', $arSelect)) {
$arSelect[] = 'RESPONSIBLE_NAME';
$arSelect[] = 'RESPONSIBLE_LAST_NAME';
$arSelect[] = 'RESPONSIBLE_SECOND_NAME';
$arSelect[] = 'RESPONSIBLE_LOGIN';
}
$obRes = CTasks::GetList($arOrder, $arFilter, $arSelect, $nPageTop);
return $obRes;
}
示例6: internationalize
/**
* @inheritdoc
*
* @throws PropertyAlreadyExistException
*/
public function internationalize($propCodePublicId, $propCodeLang, $defaultLang)
{
global $APPLICATION;
$isExistPropPublicId = $this->checkExistProperty($propCodePublicId, PublicIdField::USER_TYPE);
$isExistPropLang = $this->checkExistProperty($propCodeLang, LangField::USER_TYPE);
$userTypeModel = new \CUserTypeEntity();
if (!$isExistPropPublicId) {
$addResult = $userTypeModel->Add(['ENTITY_ID' => 'IBLOCK_' . $this->getIblockId() . '_SECTION', 'FIELD_NAME' => 'UF_' . $propCodePublicId, 'USER_TYPE_ID' => PublicIdField::USER_TYPE, 'XML_ID' => 'UF_' . $propCodePublicId, 'MANDATORY' => 'N', 'SHOW_FILTER' => 'Y', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'EDIT_FORM_LABEL' => ['ru' => 'Публичный ID', 'en' => 'Public ID'], 'LIST_COLUMN_LABEL' => ['ru' => 'Публичный ID', 'en' => 'Public ID'], 'LIST_FILTER_LABEL' => ['ru' => 'Публичный ID', 'en' => 'Public ID']]);
if ($addResult === false) {
throw new InternationalizeException([$APPLICATION->GetException()->GetString()]);
}
}
if (!$isExistPropLang) {
$addResult = $userTypeModel->Add(['ENTITY_ID' => 'IBLOCK_' . $this->getIblockId() . '_SECTION', 'FIELD_NAME' => 'UF_' . $propCodeLang, 'USER_TYPE_ID' => LangField::USER_TYPE, 'XML_ID' => 'UF_' . $propCodeLang, 'MANDATORY' => 'N', 'SHOW_FILTER' => 'Y', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'EDIT_FORM_LABEL' => ['ru' => 'Язык', 'en' => 'Language'], 'LIST_COLUMN_LABEL' => ['ru' => 'Язык', 'en' => 'Language'], 'LIST_FILTER_LABEL' => ['ru' => 'Язык', 'en' => 'Language']]);
if ($addResult === false) {
throw new InternationalizeException();
}
}
parent::internationalize($propCodePublicId, $propCodeLang, $defaultLang);
}
示例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']));
}
}
示例8: up
public function up()
{
global $APPLICATION;
$arHlData = $this->arHlData;
\Bitrix\Main\Loader::includeModule("highloadblock");
$arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\RecordTable::getTableName())))->fetch();
if ($arHlblock) {
$oUserTypeEntity = new \CUserTypeEntity();
$sort = 500;
foreach ($arHlData['FIELDS'] as $fieldName => $fieldValue) {
$aUserField = array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName, 'USER_TYPE_ID' => $fieldValue[1], 'SORT' => $sort, 'MULTIPLE' => 'N', 'MANDATORY' => $fieldValue[0], 'SHOW_FILTER' => 'N', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'N', 'SETTINGS' => array());
if (isset($fieldValue[2]) && is_array($fieldValue[2])) {
$aUserField = array_merge($aUserField, $fieldValue[2]);
}
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $aUserField['ENTITY_ID'], 'FIELD_NAME' => $aUserField['FIELD_NAME']));
if ($aUserHasField = $resProperty->Fetch()) {
$idUserTypeProp = $aUserHasField['ID'];
if ($oUserTypeEntity->Update($idUserTypeProp, $aUserField)) {
$this->out('Обновлено свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
} else {
if ($idUserTypeProp = $oUserTypeEntity->Add($aUserField)) {
$this->out('Добавлено новое свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
}
$sort += 100;
}
$arFilter = array();
$arSelect = array("ID");
$result = \Hawkart\Megatv\RecordTable::getList(array('filter' => $arFilter, 'select' => $arSelect));
while ($arRecord = $result->fetch()) {
\Hawkart\Megatv\RecordTable::update($arRecord["ID"], array('UF_DATETIME_ADD' => new \Bitrix\Main\Type\DateTime(date('Y-m-d H:i:s'), 'Y-m-d H:i:s')));
}
$oUserTypeEntity = new \CUserTypeEntity();
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => "UF_SOTAL_ID"));
if ($aUserHasField = $resProperty->Fetch()) {
$oUserTypeEntity->Delete($aUserHasField['ID']);
$this->outSuccess("Свойство удалено!");
}
$this->outSuccess('Все готово на %d%%', 100);
}
}
示例9: GetList
public static function GetList($arOrder = array('CREATED_DATE' => 'DESC'), $arFilter = array(), $arSelect = array(), $nPageTop = false)
{
// Fix for #27449
if (!CModule::IncludeModule('calendar')) {
$obRes = new CDBResult();
$obRes->InitFromArray(array());
return $obRes;
}
global $USER;
$ENTITY_ID = 'CALENDAR_EVENT';
$arElement = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields($ENTITY_ID, 0, LANGUAGE_ID);
if ($arElement == false || !isset($arElement['UF_CRM_CAL_EVENT'])) {
$arFields = array();
$arFields['ENTITY_ID'] = $ENTITY_ID;
$arFields['FIELD_NAME'] = 'UF_CRM_CAL_EVENT';
$arFields['USER_TYPE_ID'] = 'crm';
$arFields['EDIT_FORM_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['LIST_COLUMN_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['LIST_FILTER_LABEL'][LANGUAGE_ID] = GetMessage('CRM_UF_NAME');
$arFields['SETTINGS']['LEAD'] = 'Y';
$arFields['SETTINGS']['CONTACT'] = 'Y';
$arFields['SETTINGS']['COMPANY'] = 'Y';
$arFields['SETTINGS']['DEAL'] = 'Y';
$arFields['MULTIPLE'] = 'Y';
$CAllUserTypeEntity = new CUserTypeEntity();
$CAllUserTypeEntity->Add($arFields);
}
if (isset($arFilter['ENTITY_TYPE']) && isset($arFilter['ENTITY_ID'])) {
$arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
$arFilter['UF_CRM_CAL_EVENT'] = $arFilter['ENTITY_TYPE'] . '_' . $arFilter['ENTITY_ID'];
unset($arFilter['ENTITY_TYPE'], $arFilter['ENTITY_ID']);
} else {
if (!empty($arFilter['ENTITY_TYPE'])) {
$arFilter['ENTITY_TYPE'] = CUserTypeCrm::GetShortEntityType($arFilter['ENTITY_TYPE']);
$arFilter['%UF_CRM_CAL_EVENT'] = $arFilter['ENTITY_TYPE'] . '_';
unset($arFilter['ENTITY_TYPE']);
} else {
$arFilter['!=UF_CRM_CAL_EVENT'] = '';
}
}
$arFilter['CAL_TYPE'] = 'user';
$arFilter['DELETED'] = 'N';
if (isset($arFilter['OWNER_ID']) && is_array($arFilter['OWNER_ID'])) {
$arFilter['OWNER_ID'] = current($arFilter['OWNER_ID']);
}
$arCal = CCalendarEvent::GetList(array('arFilter' => $arFilter, 'parseRecursion' => false, 'userId' => $USER->GetID(), 'fetchAttendees' => false, 'fetchMeetings' => true));
$obRes = new CDBResult();
$obRes->InitFromArray($arCal);
return $obRes;
}
示例10: up
public function up()
{
$arHlData = array('FIELDS' => array('UF_DATETIME' => array('N', 'datetime', array('EDIT_FORM_LABEL' => array('ru' => 'Дата добавления'), 'LIST_COLUMN_LABEL' => array('ru' => 'Дата добавления')))));
global $APPLICATION;
\Bitrix\Main\Loader::includeModule("highloadblock");
$arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\ProgExternalTable::getTableName())))->fetch();
if ($arHlblock) {
$oUserTypeEntity = new \CUserTypeEntity();
$sort = 500;
foreach ($arHlData['FIELDS'] as $fieldName => $fieldValue) {
$aUserField = array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName, 'USER_TYPE_ID' => $fieldValue[1], 'SORT' => $sort, 'MULTIPLE' => 'N', 'MANDATORY' => $fieldValue[0], 'SHOW_FILTER' => 'N', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'N', 'SETTINGS' => array());
if (isset($fieldValue[2]) && is_array($fieldValue[2])) {
$aUserField = array_merge($aUserField, $fieldValue[2]);
}
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $aUserField['ENTITY_ID'], 'FIELD_NAME' => $aUserField['FIELD_NAME']));
if ($aUserHasField = $resProperty->Fetch()) {
$idUserTypeProp = $aUserHasField['ID'];
if ($oUserTypeEntity->Update($idUserTypeProp, $aUserField)) {
$this->out('Обновлено свойство - ' . $aUserField['FIELD_NAME']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
} else {
if ($idUserTypeProp = $oUserTypeEntity->Add($aUserField)) {
$this->out('Добавлено новое свойство - ' . $aUserField['FIELD_NAME']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
}
$sort += 100;
}
//Import datetime to field from Json field
$result = \Hawkart\Megatv\ProgExternalTable::getList(array('filter' => array(), 'select' => array("ID", "UF_JSON")));
while ($row = $result->fetch()) {
$datetime = $row["UF_JSON"]["created_ts"];
if (!empty($datetime)) {
$datetime = new \Bitrix\Main\Type\DateTime(date("Y-m-d H:i:s", strtotime($datetime)), 'Y-m-d H:i:s');
\Hawkart\Megatv\ProgExternalTable::update($row["ID"], array("UF_DATETIME" => $datetime));
}
}
$this->outSuccess('Все готово на %d%%', 100);
}
}
示例11: up
public function up()
{
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) {
$oUserTypeEntity = new \CUserTypeEntity();
$sort = 500;
foreach ($arHlData['FIELDS'] as $fieldName => $fieldValue) {
$aUserField = array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName, 'USER_TYPE_ID' => $fieldValue[1], 'SORT' => $sort, 'MULTIPLE' => 'N', 'MANDATORY' => $fieldValue[0], 'SHOW_FILTER' => 'N', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'N', 'SETTINGS' => array());
if (isset($fieldValue[2]) && is_array($fieldValue[2])) {
$aUserField = array_merge($aUserField, $fieldValue[2]);
}
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $aUserField['ENTITY_ID'], 'FIELD_NAME' => $aUserField['FIELD_NAME']));
if ($aUserHasField = $resProperty->Fetch()) {
$idUserTypeProp = $aUserHasField['ID'];
if ($oUserTypeEntity->Update($idUserTypeProp, $aUserField)) {
$this->out('Обновлено свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
} else {
if ($idUserTypeProp = $oUserTypeEntity->Add($aUserField)) {
$this->out('Добавлено новое свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
}
$sort += 100;
}
$dbUsers = \CUser::GetList($by = "EMAIL", $order = "desc", array("UF_SOTAL_LOGIN" => false));
while ($arUser = $dbUsers->Fetch()) {
\CUserEx::generateDataSotal($arUser["ID"]);
}
$this->outSuccess('Все готово на %d%%', 100);
}
}
示例12: InstallUserFields
function InstallUserFields($id = "all")
{
global $USER_FIELD_MANAGER;
$errors = null;
if ($id == 'disk' || $id == 'all') {
self::installDiskUserFields();
}
if ($id == 'all') {
$arFields = array("BLOG_POST" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_DOC", "XML_ID" => "UF_BLOG_POST_DOC", "USER_TYPE_ID" => "file", "MULTIPLE" => "Y"), "BLOG_COMMENT" => array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMMENT_DOC", "XML_ID" => "UF_BLOG_COMMENT_DOC", "USER_TYPE_ID" => "file", "MULTIPLE" => "Y"), "UF_BLOG_POST_URL_PRV" => array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_BLOG_POST_URL_PRV", "XML_ID" => "UF_BLOG_POST_URL_PRV", "USER_TYPE_ID" => "url_preview", "MULTIPLE" => "N"), "UF_BLOG_COMM_URL_PRV" => array("ENTITY_ID" => "BLOG_COMMENT", "FIELD_NAME" => "UF_BLOG_COMM_URL_PRV", "XML_ID" => "UF_BLOG_COMM_URL_PRV", "USER_TYPE_ID" => "url_preview", "MULTIPLE" => "N"));
$arFieldProps = array("SORT" => 100, "MANDATORY" => "N", "SHOW_FILTER" => "N", "SHOW_IN_LIST" => "N", "EDIT_IN_LIST" => "Y", "IS_SEARCHABLE" => "Y", "SETTINGS" => array(), "EDIT_FORM_LABEL" => "", "LIST_COLUMN_LABEL" => "", "LIST_FILTER_LABEL" => "", "ERROR_MESSAGE" => "", "HELP_MESSAGE" => "", "MAX_ALLOWED_SIZE" => COption::GetOptionString("blog", "image_max_size", "5000000"));
foreach ($arFields as $fieldName => $arField) {
$rsData = CUserTypeEntity::GetList(array($by => $order), $arField);
if ($arRes = $rsData->Fetch()) {
$intID = $arRes['ID'];
} else {
$arProps = $arFieldProps + $arField;
$obUserField = new CUserTypeEntity();
$intID = $obUserField->Add($arProps, false);
if (false == $intID) {
if ($strEx = $GLOBALS['APPLICATION']->GetException()) {
$errors = $strEx->GetString();
}
}
}
}
if (is_null($errors)) {
$rsData = CUserTypeEntity::GetList(array($by => $order), array("ENTITY_ID" => "BLOG_POST", "XML_ID" => "UF_GRATITUDE"));
if ($arRes = $rsData->Fetch()) {
$intID = $arRes['ID'];
} else {
$arFieldProps = array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => "UF_GRATITUDE", "XML_ID" => "UF_GRATITUDE", "USER_TYPE_ID" => "integer", "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" => "");
$obUserField = new CUserTypeEntity();
$intID = $obUserField->Add($arFieldProps, false);
if (false == $intID && ($strEx = $GLOBALS['APPLICATION']->GetException())) {
$errors = $strEx->GetString();
}
}
}
}
return $errors;
}
示例13: up
public function up()
{
$arHlData = array('FIELDS' => array('UF_DATETIME_TO' => array('N', 'datetime', array('EDIT_FORM_LABEL' => array('ru' => 'Дата окончания подписки'), 'LIST_COLUMN_LABEL' => array('ru' => 'Дата окончания подписки')))));
global $APPLICATION, $DB;
\Bitrix\Main\Loader::includeModule("highloadblock");
$arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\SubscribeTable::getTableName())))->fetch();
if ($arHlblock) {
$oUserTypeEntity = new \CUserTypeEntity();
$sort = 500;
foreach ($arHlData['FIELDS'] as $fieldName => $fieldValue) {
$aUserField = array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName, 'USER_TYPE_ID' => $fieldValue[1], 'SORT' => $sort, 'MULTIPLE' => 'N', 'MANDATORY' => $fieldValue[0], 'SHOW_FILTER' => 'N', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'N', 'SETTINGS' => array());
if (isset($fieldValue[2]) && is_array($fieldValue[2])) {
$aUserField = array_merge($aUserField, $fieldValue[2]);
}
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $aUserField['ENTITY_ID'], 'FIELD_NAME' => $aUserField['FIELD_NAME']));
if ($aUserHasField = $resProperty->Fetch()) {
$idUserTypeProp = $aUserHasField['ID'];
if ($oUserTypeEntity->Update($idUserTypeProp, $aUserField)) {
$this->out('Обновлено свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
} else {
if ($idUserTypeProp = $oUserTypeEntity->Add($aUserField)) {
$this->out('Добавлено новое свойство - ' . $fieldValue[2]['EDIT_FORM_LABEL']['ru']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
}
$sort += 100;
}
$strSql = "UPDATE " . \Hawkart\Megatv\SubscribeTable::getTableName() . " SET UF_DATETIME_TO=curdate() + INTERVAL 1 DAY + INTERVAL 3 HOUR + INTERVAL 30 MINUTE";
$res = $DB->Query($strSql, false, $err_mess . __LINE__);
$this->outSuccess('Все готово на %d%%', 100);
}
}
示例14: InstallUserFields
function InstallUserFields()
{
$ImportantUserFields = $this->GetIdeaUserFields();
$messages = array();
$db_res = \Bitrix\Main\Localization\LanguageTable::getList(array('order' => array('SORT' => 'ASC')));
while ($ar = $db_res->fetch()) {
$messages[$ar["LID"]] = IncludeModuleLangFile(__FILE__, $ar["LID"], true);
}
foreach ($ImportantUserFields as $UserFieldName => $Exists) {
if (!$Exists) {
$EDIT_FORM_LABEL = array();
foreach ($messages as $lid => $mess) {
$EDIT_FORM_LABEL[$lid] = $mess["IDEA_" . $UserFieldName . "_DESCRIPTION"];
}
$UserType = new CUserTypeEntity();
switch ($UserFieldName) {
case "UF_CATEGORY_CODE":
GetMessage("IDEA_UF_CATEGORY_CODE_DESCRIPTION");
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "string", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => $EDIT_FORM_LABEL));
break;
case "UF_ANSWER_ID":
GetMessage("IDEA_UF_ANSWER_ID_DESCRIPTION");
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "integer", "IS_SEARCHABLE" => "N", "MULTIPLE" => "Y", "EDIT_FORM_LABEL" => $EDIT_FORM_LABEL));
break;
case "UF_ORIGINAL_ID":
GetMessage("IDEA_UF_ORIGINAL_ID_DESCRIPTION");
$UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "string", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => $EDIT_FORM_LABEL));
break;
case "UF_STATUS":
GetMessage("IDEA_UF_STATUS_DESCRIPTION");
$ID = $UserType->Add(array("ENTITY_ID" => "BLOG_POST", "FIELD_NAME" => $UserFieldName, "USER_TYPE_ID" => "enumeration", "IS_SEARCHABLE" => "N", "EDIT_FORM_LABEL" => $EDIT_FORM_LABEL));
if (intval($ID) > 0) {
$UserTypeEnum = new CUserFieldEnum();
$UserTypeEnum->SetEnumValues($ID, array("n0" => array("SORT" => 100, "XML_ID" => "NEW", "VALUE" => GetMessage("IDEA_UF_STATUS_NEW_TITLE"), "DEF" => "Y"), "n1" => array("SORT" => 200, "XML_ID" => "PROCESSING", "VALUE" => GetMessage("IDEA_UF_STATUS_PROCESSING_TITLE"), "DEF" => "N"), "n2" => array("SORT" => 300, "XML_ID" => "COMPLETED", "VALUE" => GetMessage("IDEA_UF_STATUS_COMPLETED_TITLE"), "DEF" => "N")));
}
break;
}
}
}
}
示例15: up
public function up()
{
$arHlData = array('FIELDS' => array('UF_DEFAULT' => array('N', 'boolean', array('EDIT_FORM_LABEL' => array('ru' => 'Город по умолчанию'), 'LIST_COLUMN_LABEL' => array('ru' => 'Город по умолчанию')))));
global $APPLICATION;
\Bitrix\Main\Loader::includeModule("highloadblock");
$arHlblock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter' => array('TABLE_NAME' => \Hawkart\Megatv\CityTable::getTableName())))->fetch();
if ($arHlblock) {
$oUserTypeEntity = new \CUserTypeEntity();
$sort = 500;
foreach ($arHlData['FIELDS'] as $fieldName => $fieldValue) {
$aUserField = array('ENTITY_ID' => 'HLBLOCK_' . $arHlblock["ID"], 'FIELD_NAME' => $fieldName, 'USER_TYPE_ID' => $fieldValue[1], 'SORT' => $sort, 'MULTIPLE' => 'N', 'MANDATORY' => $fieldValue[0], 'SHOW_FILTER' => 'N', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'N', 'SETTINGS' => array());
if (isset($fieldValue[2]) && is_array($fieldValue[2])) {
$aUserField = array_merge($aUserField, $fieldValue[2]);
}
$resProperty = \CUserTypeEntity::GetList(array(), array('ENTITY_ID' => $aUserField['ENTITY_ID'], 'FIELD_NAME' => $aUserField['FIELD_NAME']));
if ($aUserHasField = $resProperty->Fetch()) {
$idUserTypeProp = $aUserHasField['ID'];
if ($oUserTypeEntity->Update($idUserTypeProp, $aUserField)) {
$this->out('Обновлено свойство - ' . $aUserField['FIELD_NAME']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
} else {
if ($idUserTypeProp = $oUserTypeEntity->Add($aUserField)) {
$this->out('Добавлено новое свойство - ' . $aUserField['FIELD_NAME']);
} else {
if ($ex = $APPLICATION->GetException()) {
$this->outError('Ошибка - ' . $ex->GetString());
}
}
}
$sort += 100;
}
$this->outSuccess('Все готово на %d%%', 100);
}
}