本文整理汇总了PHP中CUserTypeEntity类的典型用法代码示例。如果您正苦于以下问题:PHP CUserTypeEntity类的具体用法?PHP CUserTypeEntity怎么用?PHP CUserTypeEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUserTypeEntity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __IRM_InitReservation
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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:init.php
示例2: __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
示例3: 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;
}
}
}
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:27,代码来源:index.php
示例4: 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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:57,代码来源:crm_activity_task.php
示例5: deleteUserTypeEntityIfExists
public function deleteUserTypeEntityIfExists($entityId, $fieldName)
{
$aItem = $this->getUserTypeEntity($entityId, $fieldName);
if (!$aItem) {
return false;
}
$entity = new \CUserTypeEntity();
if ($entity->Delete($aItem['ID'])) {
return true;
}
$this->throwException(__METHOD__, 'UserType not deleted');
}
开发者ID:andreyryabin,项目名称:sprint.migration,代码行数:12,代码来源:UserTypeEntityHelper.php
示例6: 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
示例7: 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
示例8: 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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:50,代码来源:crm_activity_calendar.php
示例9: 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
示例10: 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
示例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: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: 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_u
|
请发表评论