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


PHP CIntranetUtils::getSubordinateDepartments方法代码示例

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


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

示例1: explode

if (!is_array($arParams['VALUE'])) {
    $arParams['VALUE'] = explode(',', $arParams['VALUE']);
}
foreach ($arParams['VALUE'] as &$id) {
    $id = intval(trim($id));
}
unset($id);
$arParams['VALUE'] = array_unique($arParams['VALUE']);
$GLOBALS['GROUP_SITE_ID'] = $arParams['GROUP_SITE_ID'];
$bSubordinateOnly = isset($arParams["SUBORDINATE_ONLY"]) && $arParams["SUBORDINATE_ONLY"] == "Y";
$arResult["NAME"] = htmlspecialcharsbx($arParams["NAME"]);
$arResult["~NAME"] = $arParams["NAME"];
if (!isset($arParams["NAME_TEMPLATE"]) || strlen($arParams["NAME_TEMPLATE"]) <= 0) {
    $arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$arSubDeps = CIntranetUtils::getSubordinateDepartments($USER->GetID(), true);
if ($arParams["GROUP_ID_FOR_SITE"] && CModule::IncludeModule("extranet") && CModule::IncludeModule("socialnetwork")) {
    $arSites = array();
    $rsGroupSite = CSocNetGroup::GetSite($arParams["GROUP_ID_FOR_SITE"]);
    while ($arGroupSite = $rsGroupSite->Fetch()) {
        $arSites[] = $arGroupSite["LID"];
    }
    $extranetSiteId = CExtranet::GetExtranetSiteID();
    if ($extranetSiteId && in_array($extranetSiteId, $arSites)) {
        $GLOBALS['GROUP_SITE_ID'] = $extranetSiteId;
    }
}
$arManagers = array();
if (($arDepartments = CIntranetUtils::getUserDepartments($USER->GetID())) && is_array($arDepartments) && count($arDepartments) > 0) {
    $arManagers = array_keys(CIntranetUserSelectorHelper::getDepartmentManagersId($arDepartments, $USER->getID(), true));
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例2: getLastSelectedUsers

 public static function getLastSelectedUsers($arManagers, $bSubordinateOnly = false, $nameTemplate = '', $siteId = SITE_ID)
 {
     /** @var CAllUser $USER */
     static $arLastUsers;
     global $USER, $arParams;
     $cacheKey = md5(serialize($arManagers) . (string) $bSubordinateOnly . '|' . $nameTemplate . '|' . (string) $siteId);
     if (!isset($arLastUsers[$cacheKey])) {
         $arSubDeps = CIntranetUtils::getSubordinateDepartments($USER->GetID(), true);
         if (!class_exists('CUserOptions')) {
             include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
         }
         $arLastSelected = CUserOptions::GetOption("intranet", "user_search", array());
         if (is_array($arLastSelected) && strlen($arLastSelected['last_selected']) > 0) {
             $arLastSelected = array_unique(explode(',', $arLastSelected['last_selected']));
         } else {
             $arLastSelected = false;
         }
         if (is_array($arLastSelected)) {
             $currentUser = array_search($USER->getID(), $arLastSelected);
             if ($currentUser !== false) {
                 unset($arLastSelected[$currentUser]);
             }
             array_unshift($arLastSelected, $USER->getID());
         } elseif ($USER->getID()) {
             $arLastSelected = array($USER->getID());
         }
         $arFilter = array('ACTIVE' => 'Y');
         if ($bSubordinateOnly) {
             $arFilter["UF_DEPARTMENT"] = $arSubDeps;
         } else {
             $arFilter['!UF_DEPARTMENT'] = false;
         }
         // Prevent using users, that doesn't activate it's account
         // http://jabber.bx/view.php?id=29118
         if (IsModuleInstalled('bitrix24')) {
             $arFilter['CONFIRM_CODE'] = false;
         }
         $arFilter['ID'] = is_array($arLastSelected) ? implode('|', array_slice($arLastSelected, 0, 10)) : '-1';
         $dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
         $arLastUsers[$cacheKey] = array();
         while ($arRes = $dbRes->GetNext()) {
             $arLastUsers[$cacheKey][$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat() : $nameTemplate, $arRes, true, false), '~NAME' => CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat() : $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'], '~WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $siteId), 'HEAD' => false, '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');
         }
     }
     return $arLastUsers[$cacheKey];
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:46,代码来源:functions.php


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