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


PHP CUserTypeEntity::Update方法代码示例

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


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

示例1: UFUpdate

 /**
  * @param string $entity
  * @param array $data
  * @var bool $deleteIfExists
  */
 protected function UFUpdate(array $data)
 {
     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 ($id = $this->UFGetIdByCode($data['ENTITY_ID'], $data['FIELD_NAME'])) {
         $ib = new \CUserTypeEntity();
         $id = $ib->Update($id, $data);
         if ($id) {
             echo "Update {$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 "Update {$data['FIELD_NAME']} user field list\r\n";
             }
         }
     } else {
         throw new \Exception("Can't update {$data['FIELD_NAME']} user field");
     }
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:30,代码来源:Coded.php

示例2: 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

示例3: 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);
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:50,代码来源:Version20160818120449.php

示例4: 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);
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:47,代码来源:version20160712133400.php

示例5: 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);
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:42,代码来源:Version20160829145834.php

示例6: 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);
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:40,代码来源:Version20160720205816.php

示例7: 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);
     }
 }
开发者ID:Hawkart,项目名称:megatv,代码行数:38,代码来源:Version20160712191155.php

示例8: array

     $arLanguages[] = $arLanguage["LID"];
 }
 $arUserFields = array("UF_BROWSER_TITLE", "UF_KEYWORDS", "UF_META_DESCRIPTION");
 foreach ($arUserFields as $userField) {
     $arLabelNames = array();
     foreach ($arLanguages as $languageID) {
         WizardServices::IncludeServiceLang("property_names.php", $languageID);
         $arLabelNames[$languageID] = GetMessage($userField);
     }
     $arProperty["EDIT_FORM_LABEL"] = $arLabelNames;
     $arProperty["LIST_COLUMN_LABEL"] = $arLabelNames;
     $arProperty["LIST_FILTER_LABEL"] = $arLabelNames;
     $dbRes = CUserTypeEntity::GetList(array(), array("ENTITY_ID" => 'IBLOCK_' . $IBLOCK_CATALOG_ID . '_SECTION', "FIELD_NAME" => $userField));
     if ($arRes = $dbRes->Fetch()) {
         $userType = new CUserTypeEntity();
         $userType->Update($arRes["ID"], $arProperty);
     }
     //if($ex = $APPLICATION->GetException())
     //$strError = $ex->GetString();
 }
 //demo discount
 $dbDiscount = CCatalogDiscount::GetList(array(), array("SITE_ID" => WIZARD_SITE_ID));
 if (!$dbDiscount->Fetch()) {
     if (CModule::IncludeModule("iblock")) {
         $dbSect = CIBlockSection::GetList(array(), array("IBLOCK_TYPE" => "catalog", "IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "underwear", "IBLOCK_SITE_ID" => WIZARD_SITE_ID));
         if ($arSect = $dbSect->Fetch()) {
             $sofasSectId = $arSect["ID"];
         }
     }
     $dbSite = CSite::GetByID(WIZARD_SITE_ID);
     if ($arSite = $dbSite->Fetch()) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:catalog3.php

示例9: IntVal

);

if($lAdmin->EditAction())
{
	$obUserField = new CUserTypeEntity;
	foreach($FIELDS as $ID=>$arFields)
	{
		if(!$lAdmin->IsUpdated($ID))
			continue;
		//Rights check
		if($USER_FIELD_MANAGER->GetRights(false, $ID) < "W")
			continue;
		//Update
		$DB->StartTransaction();
		$ID = IntVal($ID);
		if(!$obUserField->Update($ID, $arFields))
		{
			if($e = $APPLICATION->GetException())
				$lAdmin->AddGroupError(GetMessage("USERTYPE_UPDATE_ERROR")." ".$e->GetString(), $ID);
			$DB->Rollback();
		}
		$DB->Commit();
	}
}

if($arID = $lAdmin->GroupAction())
{
	if($_REQUEST['action_target']=='selected')
	{
		$rsData = CUserTypeEntity::GetList(array($by=>$order), $arFilter);
		while($arRes = $rsData->Fetch())
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:userfield_admin.php

示例10: 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

示例11: CUserFieldEnum

                $obEnum = new CUserFieldEnum();
                $aTabs[] = array("DIV" => "edit2", "TAB" => GetMessage("USER_TYPE_TAB2"), "ICON" => "main_user_edit", "TITLE" => GetMessage("USER_TYPE_TAB2_TITLE"));
            }
        }
    }
}
$tabControl = new CAdminTabControl("tabControl", $aTabs);
$ID = intval($ID);
// Id of the edited record
$message = null;
$bVarsFromForm = false;
if ($REQUEST_METHOD == "POST" && ($save != "" || $apply != "") && $RIGHTS >= "W" && check_bitrix_sessid()) {
    $arFields = array("ENTITY_ID" => $ENTITY_ID, "FIELD_NAME" => $FIELD_NAME, "USER_TYPE_ID" => $USER_TYPE_ID, "XML_ID" => $XML_ID, "SORT" => $SORT, "MULTIPLE" => $MULTIPLE, "MANDATORY" => $MANDATORY, "SHOW_FILTER" => $SHOW_FILTER, "SHOW_IN_LIST" => $SHOW_IN_LIST, "EDIT_IN_LIST" => $EDIT_IN_LIST, "IS_SEARCHABLE" => $IS_SEARCHABLE, "SETTINGS" => $SETTINGS, "EDIT_FORM_LABEL" => $EDIT_FORM_LABEL, "LIST_COLUMN_LABEL" => $LIST_COLUMN_LABEL, "LIST_FILTER_LABEL" => $LIST_FILTER_LABEL, "ERROR_MESSAGE" => $ERROR_MESSAGE, "HELP_MESSAGE" => $HELP_MESSAGE);
    $obUserField = new CUserTypeEntity();
    if ($ID > 0) {
        $res = $obUserField->Update($ID, $arFields);
    } else {
        $ID = $obUserField->Add($arFields);
        $res = $ID > 0;
    }
    if (is_object($obEnum)) {
        if (is_array($LIST)) {
            foreach ($LIST as $id => $value) {
                if (is_array($value)) {
                    $LIST[$id]["DEF"] = "N";
                }
            }
        }
        if (is_array($LIST["DEF"])) {
            foreach ($LIST["DEF"] as $value) {
                if (is_array($LIST[$value])) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:userfield_edit.php

示例12: UpdateField

 public function UpdateField($ID, $arField)
 {
     $obUserField = new CUserTypeEntity();
     $res = $obUserField->Update($ID, $arField);
     if ($res) {
         UserFieldHistory::processModification(CCrmOwnerType::ResolveIDByUFEntityID($this->sUFEntityID), $ID);
     }
     if ($res && $arField['USER_TYPE_ID'] == 'enumeration' && is_array($arField['LIST'])) {
         $obEnum = new CUserFieldEnum();
         $res = $obEnum->SetEnumValues($ID, $arField['LIST']);
     }
     $this->arUFList = $this->GetUserFields($this->sUFEntityID, 0, LANGUAGE_ID);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:crm_fields.php

示例13: InstallUserFields


//.........这里部分代码省略.........
						"XML_ID" => "UF_BLOG_POST_IMPRTNT",
						"EDIT_FORM_LABEL" => Array(),
						"LIST_COLUMN_LABEL" => Array(),
						"LIST_FILTER_LABEL" => Array());

					$dbLangs = CLanguage::GetList(($b = ""), ($o = ""), array("ACTIVE" => "Y"));
					while ($arLang = $dbLangs->Fetch())
					{
						$messages = IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/socialnetwork/install/index.php", $arLang["LID"], true);
						$arImportantPostUF["EDIT_FORM_LABEL"][$arLang["LID"]] = $messages["SONETP_EDIT_FORM_LABEL"];
						$arImportantPostUF["LIST_COLUMN_LABEL"][$arLang["LID"]] = $messages["SONETP_LIST_COLUMN_LABEL"];
						$arImportantPostUF["LIST_FILTER_LABEL"][$arLang["LID"]] = $messages["SONETP_LIST_FILTER_LABEL"];
					}
					$arFields[] = $arImportantPostUF;
				}
			}

			if (IsModuleInstalled("webdav"))
			{
				$arFields[] = array(
					"USER_TYPE_ID" => "webdav_element",
					"ENTITY_ID" => "SONET_LOG",
					"FIELD_NAME" => "UF_SONET_LOG_DOC",
					"XML_ID" => "UF_SONET_LOG_DOC",
					"MULTIPLE" => "Y",
					"MANDATORY" => "N",
					"SHOW_FILTER" => "N",
					"SHOW_IN_LIST" => "N",
					"EDIT_IN_LIST" => "Y",
					"IS_SEARCHABLE" => "Y"
				);
				$arFields[] = array(
					"USER_TYPE_ID" => "webdav_element",
					"ENTITY_ID" => "SONET_COMMENT",
					"FIELD_NAME" => "UF_SONET_COM_DOC",
					"XML_ID" => "UF_SONET_COM_DOC",
					"MULTIPLE" => "Y",
					"MANDATORY" => "N",
					"SHOW_FILTER" => "N",
					"SHOW_IN_LIST" => "N",
					"EDIT_IN_LIST" => "Y",
					"IS_SEARCHABLE" => "Y"
				);
			}

			if (IsModuleInstalled("vote"))
			{
				AddEventHandler("main", "OnUserTypeBuildList", array("CUserTypeVote", "GetUserTypeDescription"));
				require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/vote/classes/general/usertypevote.php");
				$arFields[] = array(
					"USER_TYPE_ID" => "vote",
					"ENTITY_ID" => "BLOG_POST",
					"FIELD_NAME" => "UF_BLOG_POST_VOTE",
					"XML_ID" => "UF_BLOG_POST_VOTE",
					"SETTINGS" => array(
						"CHANNEL_ID" => "add",
						"CHANNEL_TITLE" => "UF_BLOG_POST_VOTE",
						"CHANNEL_SYMBOLIC_NAME" => "UF_BLOG_POST_VOTE",
						"CHANNEL_USE_CAPTCHA" => "N",
						"NOTIFY" => (IsModuleInstalled("im") ? "I" : "N"),
						"UNIQUE" => 13,
						"UNIQUE_IP_DELAY" => array(
							"DELAY" => "10",
							"DELAY_TYPE" => "D"
						)
					)
				);
			}

			$obUserField = new CUserTypeEntity;
			foreach ($arFields as $arField)
			{
				$rsData = CUserTypeEntity::GetList(array("ID" => "ASC"), $arField);
				if (!($rsData && ($arRes = $rsData->Fetch()) && !!$arRes))
				{
					$intID = $obUserField->Add($arField, false);
					if (
						false == $intID
						&& ($strEx = $APPLICATION->GetException())
					)
					{
						$errors = $strEx->GetString();
					}
					else if (
						$arField["FIELD_NAME"] == "UF_BLOG_POST_IMPRTNT" 
						&& $GLOBALS["DB"]->TableExists("b_uts_blog_post") 
						&& !$GLOBALS["DB"]->IndexExists("b_uts_blog_post", array("UF_BLOG_POST_IMPRTNT", "VALUE_ID"))
					)
					{
						$GLOBALS["DB"]->Query("CREATE INDEX UX_UF_BLOG_POST_IMPRTNT ON b_uts_blog_post(UF_BLOG_POST_IMPRTNT, VALUE_ID)", true);
					}
				}
				else if ($arField["FIELD_NAME"] == "UF_BLOG_POST_VOTE")
				{
					$obUserField->Update($arRes["ID"], $arField);
				}
			}
		}
		return $errors;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:index.php

示例14: UpdateField

 public function UpdateField($ID, $arField)
 {
     $obUserField = new CUserTypeEntity();
     $res = $obUserField->Update($ID, $arField);
     if ($res && $arField['USER_TYPE_ID'] == 'enumeration' && is_array($arField['LIST'])) {
         $obEnum = new CUserFieldEnum();
         $res = $obEnum->SetEnumValues($ID, $arField['LIST']);
     }
     $this->arUFList = $this->GetUserFields($this->sUFEntityID, 0, LANGUAGE_ID);
     return $res;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:11,代码来源:crm_fields.php

示例15: array

 function GetPropertyByXML_ID($XML_ID, $arData = null)
 {
     if (!$this->arPropertiesCache[$XML_ID]) {
         $dbRes = CUserTypeEntity::GetList(array(), array('ENTITY_ID' => 'USER', 'XML_ID' => $XML_ID));
         while ($arRes = $dbRes->Fetch()) {
             $this->arPropertiesCache[$arRes['XML_ID']] = $arRes['FIELD_NAME'];
         }
     }
     if (null != $arData) {
         if (!$this->arPropertiesCache[$XML_ID]) {
             $bAdd = true;
             $arFields = array('ENTITY_ID' => 'USER', 'FIELD_NAME' => $this->CalcPropertyFieldName($XML_ID), 'USER_TYPE_ID' => 'string', 'XML_ID' => $XML_ID, 'MULTIPLE' => 'N', 'MANDATORY' => 'N', 'SHOW_FILTER' => 'I', 'SHOW_IN_LIST' => 'Y', 'EDIT_IN_LIST' => 'Y', 'IS_SEARCHABLE' => 'Y', 'SETTINGS' => array('ROWS' => 1));
         } else {
             $bAdd = false;
             $arFields = array();
         }
         $arFields['EDIT_FORM_LABEL'] = $arFields['LIST_COLUMN_LABEL'] = $arFields['LIST_FILTER_LABEL'] = array('ru' => $arData['NAME']);
         $ob = new CUserTypeEntity();
         if ($bAdd) {
             $this->arPropertiesCache[$XML_ID] = $ob->Add($arFields);
         } else {
             $ob->Update($this->arPropertiesCache[$XML_ID], $arFields);
         }
     }
     return $this->arPropertiesCache[$XML_ID];
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:cml2.php


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