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


PHP CIntranetUtils::getDepartmentManagerID方法代码示例

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


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

示例1: getDepartmentUsers

 public static function getDepartmentUsers($sectionId, $siteId, $arSubDeps, $arManagers, $ynShowInactiveUsers, $nameTemplate)
 {
     static $arCacheUsers = array();
     $cacheKey = (string) $sectionId . '|' . (string) $siteId . '|' . serialize($arSubDeps) . '|' . serialize($arManagers) . '|' . $ynShowInactiveUsers;
     static $arCUserRequestedFields = array('ID', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'LOGIN', 'EMAIL', 'WORK_POSITION', 'PERSONAL_PROFESSION', 'UF_DEPARTMENT', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'EMAIL');
     // Precache data, if need
     if (!array_key_exists($cacheKey, $arCacheUsers)) {
         $arFilter = array();
         $filterACTIVE = 'Y';
         if ($ynShowInactiveUsers === 'Y') {
             $filterACTIVE = '';
         }
         $arFilter['ACTIVE'] = $filterACTIVE;
         // Prevent using users, that doesn't activate it's account
         // http://jabber.bx/view.php?id=29118
         if (IsModuleInstalled('bitrix24')) {
             $arFilter['CONFIRM_CODE'] = false;
         }
         if ($sectionId == "extranet") {
             $arFilter['GROUPS_ID'] = array(COption::GetOptionInt("extranet", "extranet_group", ""));
             //	$arFilter['UF_DEPARTMENT'] = false;
         } else {
             $arFilter['UF_DEPARTMENT'] = $sectionId;
         }
         $arUsers = array();
         if ($sectionId != "extranet") {
             $ufHead = CIntranetUtils::getDepartmentManagerID($sectionId);
             if ($ufHead > 0) {
                 $arHeadFilter = array('ID' => $ufHead, 'ACTIVE' => $filterACTIVE);
                 if (IsModuleInstalled('bitrix24')) {
                     $arHeadFilter['CONFIRM_CODE'] = false;
                 }
                 //fetch only one manager by Section
                 $dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', $arHeadFilter, array('SELECT' => $arCUserRequestedFields));
                 if ($arRes = $dbUsers->GetNext()) {
                     $arFilter['!ID'] = $arRes['ID'];
                     $arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $siteId), 'HEAD' => true, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
                 }
             }
         }
         $dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => $arCUserRequestedFields));
         while ($arRes = $dbRes->GetNext()) {
             $arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $siteId), 'HEAD' => false, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
         }
         $arCacheUsers[$cacheKey] = array_values(array_filter($arUsers, array('CIntranetUserSelectorHelper', 'filterViewableUsers')));
     }
     return $arCacheUsers[$cacheKey];
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:48,代码来源:functions.php

示例2: array

                 }
                 if (!isset($arStructure['TREE'][$iblockSectionId])) {
                     $arStructure['TREE'][$iblockSectionId] = array();
                 }
                 $arStructure['TREE'][$iblockSectionId][] = $item['ID'];
             }
         }
         CIntranetUserSelectorHelper::drawEmployeeStructure($arStructure['TREE'], $arStructure['DATA'], $sectionId, $selectorName, !$showUsers);
     }
     $arFilter['UF_DEPARTMENT'] = $sectionId;
 }
 $arUsers = array();
 if ($showUsers) {
     $arFilter["CONFIRM_CODE"] = false;
     if ($sectionId != "extranet") {
         $ufHead = CIntranetUtils::getDepartmentManagerID($sectionId);
         if ($ufHead > 0) {
             $arHeadFilter = array('ID' => $ufHead, 'ACTIVE' => $showActiveUsers, 'CONFIRM_CODE' => false);
             $dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', $arHeadFilter, array('SELECT' => array('UF_DEPARTMENT')));
             if ($arRes = $dbUsers->Fetch()) {
                 $arFilter['!ID'] = $arRes['ID'];
                 $arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, $arRes, $bUseLogin, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array()), 'HEAD' => true, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
             }
         }
     }
     $dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
     while ($arRes = $dbRes->Fetch()) {
         //exclude extranet users in accordance with SHOW_EXTRANET_USER parameter
         if (($showExtranetUsers == SHOW_FROM_MY_GROUPS || $showExtranetUsers == SHOW_FROM_EXACT_GROUP) && $arRes["UF_DEPARTMENT"] == false && !in_array($arRes["ID"], $arFilteredUserIDs)) {
             continue;
         }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php


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