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


PHP CIntranetUtils::GetSubordinateDepartments方法代码示例

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


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

示例1: getImmediateEmployees

 /**
  * if ($arAllowedDepartments === null) => all departments headed by user will be used
  */
 public static function getImmediateEmployees($userId, $arAllowedDepartments = null)
 {
     if (!CModule::IncludeModule('intranet')) {
         return false;
     }
     $arDepartmentHeads = array();
     $arQueueDepartmentsEmployees = array();
     // IDs of departments where we need employees
     // Departments where given user is head
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $arManagedDepartments = CIntranetUtils::GetSubordinateDepartments($userId);
     if (is_array($arAllowedDepartments)) {
         $arManagedDepartments = array_intersect($arManagedDepartments, $arAllowedDepartments);
     }
     if (is_array($arManagedDepartments)) {
         foreach ($arManagedDepartments as $departmentId) {
             $arQueueDepartmentsEmployees[] = $departmentId;
             $result = self::searchImmediateEmployeesInSubDepartments($departmentId);
             $arDepartmentHeads = array_merge($arDepartmentHeads, $result['arDepartmentHeads']);
             $arQueueDepartmentsEmployees = array_merge($arQueueDepartmentsEmployees, $result['arQueueDepartmentsEmployees']);
         }
     }
     $arEmployees = $arDepartmentHeads;
     if (!empty($arQueueDepartmentsEmployees)) {
         $arEmployees = array_merge($arEmployees, self::getDepartmentsUsersIds($arQueueDepartmentsEmployees));
     }
     if (!empty($arEmployees)) {
         $arEmployees = array_unique(array_filter($arEmployees));
         // Remove itself
         $curUserIndex = array_search($userId, $arEmployees);
         if ($curUserIndex !== false) {
             unset($arEmployees[$curUserIndex]);
         }
     }
     return $arEmployees;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:39,代码来源:intranettools.php

示例2: GetSubordinateEmployees

 function GetSubordinateEmployees($USER_ID = null, $bRecursive = false, $onlyActive = 'Y')
 {
     $arDepartments = CIntranetUtils::GetSubordinateDepartments($USER_ID, $bRecursive);
     return CIntranetUtils::GetDepartmentEmployees($arDepartments, false, true, $onlyActive);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:5,代码来源:utils.php

示例3: ob_start

     $navResult->NavPageCount = $page_count;
     $navResult->NavPageNomer = $page;
     ob_start();
     $APPLICATION->IncludeComponent('bitrix:system.pagenavigation', 'js', array('NAV_RESULT' => $navResult, 'HANDLER' => 'window.BXTMREPORT.Page'));
     $res['NAV'] = ob_get_contents();
     ob_end_clean();
     break;
 case 'admin_data_settings':
     $bReturnRes = true;
     $arNeededSettings = array('UF_TIMEMAN', 'UF_TM_MAX_START', 'UF_TM_MIN_FINISH', 'UF_TM_MIN_DURATION', 'UF_TM_REPORT_REQ', 'UF_TM_FREE', 'UF_TM_ALLOWED_DELTA');
     if (isset($_REQUEST['ID'])) {
         $ID = $_REQUEST['ID'];
         $source = $_REQUEST['source'];
         if ($source == 'department') {
             if (!CTimeMan::IsAdmin()) {
                 $arSubordination = CIntranetUtils::GetSubordinateDepartments($USER->GetID(), true);
                 if (!in_array($ID, $arSubordination)) {
                     echo "{error: 'access denied', type: 'fatal'}";
                     die;
                 }
             }
         } else {
             $arAccessUsers = CTimeMan::GetAccess();
             $bCanEditAll = in_array('*', $arAccessUsers['WRITE']);
             $bCanReadAll = in_array('*', $arAccessUsers['READ']);
             if (!$bCanReadAll && !in_array($ID, $arAccessUsers["READ"])) {
                 echo "{error: 'access denied', type: 'fatal'}";
                 die;
             }
         }
         $arFields = array();
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:timeman.php

示例4: GetGratMedalUsers

 public static function GetGratMedalUsers($arParams = array())
 {
     global $USER;
     $userId = intval($USER->GetID());
     if (!isset($GLOBALS["SOCNET_LOG_DESTINATION"]["GetGratMedalUsers"][$userId])) {
         $arSubordinateDepts = array();
         if (CModule::IncludeModule("intranet")) {
             $arSubordinateDepts = CIntranetUtils::GetSubordinateDepartments($userId, true);
         }
         $arFilter = array("ACTIVE" => "Y", "!UF_DEPARTMENT" => false);
         $arExtParams = array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION", "IS_ONLINE"), "SELECT" => array("UF_DEPARTMENT"));
         if (isset($arParams["id"])) {
             if (empty($arParams["id"])) {
                 $arFilter["ID"] = $userId;
             } else {
                 $arSelect = array();
                 foreach ($arParams["id"] as $value) {
                     $arSelect[] = intval($value);
                 }
                 $arFilter["ID"] = implode("|", $arSelect);
             }
         }
         $arGratUsers = array();
         $arMedalUsers = array();
         $dbUsers = CUser::GetList($sort_by = array("last_name" => "asc", "IS_ONLINE" => "desc"), $dummy = '', $arFilter, $arExtParams);
         while ($arUser = $dbUsers->GetNext()) {
             $sName = trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser));
             if (empty($sName)) {
                 $sName = $arUser["~LOGIN"];
             }
             $arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => 32, "height" => 32), BX_RESIZE_IMAGE_EXACT, false);
             $arGratUsers['U' . $arUser["ID"]] = array("id" => "U" . $arUser["ID"], "entityId" => $arUser["ID"], "name" => $sName, "avatar" => empty($arFileTmp["src"]) ? '' : $arFileTmp["src"], "desc" => $arUser["WORK_POSITION"] ? $arUser["WORK_POSITION"] : ($arUser["PERSONAL_PROFESSION"] ? $arUser["PERSONAL_PROFESSION"] : " "));
             if (count($arSubordinateDepts) > 0 && count(array_intersect($arSubordinateDepts, $arUser["UF_DEPARTMENT"])) > 0) {
                 $arMedalUsers['U' . $arUser["ID"]] = $arGratUsers['U' . $arUser["ID"]];
             }
         }
         $GLOBALS["SOCNET_LOG_DESTINATION"]["GetGratMedalUsers"][$userId] = array("GRAT" => $arGratUsers, "MEDAL" => $arMedalUsers);
     }
     return $GLOBALS["SOCNET_LOG_DESTINATION"]["GetGratMedalUsers"][$userId];
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:40,代码来源:log_destination.php

示例5: checkUserSubordination

 /**
  * @param int $headUserId
  * @param int $subUserId
  * @return bool
  */
 public static function checkUserSubordination($headUserId, $subUserId)
 {
     if (CModule::IncludeModule('intranet')) {
         $headUserId = (int) $headUserId;
         $subUserId = (int) $subUserId;
         if ($headUserId && $subUserId) {
             $headDepts = (array) CIntranetUtils::GetSubordinateDepartments($headUserId, true);
             if (!empty($headDepts)) {
                 $subDepts = (array) CIntranetUtils::GetUserDepartments($subUserId);
                 return sizeof(array_intersect($headDepts, $subDepts)) > 0;
             }
         }
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:20,代码来源:helper.php

示例6: elseif

}
$arResult['SHOW_SECTION_MANAGE'] = $arParams['SHOW_SECTION_MANAGE'];
$arResult['F_SEARCH'] = null;
if (strlen($fTitle = tasksGetFilter("F_TITLE")) > 0) {
    $arResult['F_SEARCH'] = $fTitle;
} elseif (intval($fID = tasksGetFilter("F_META::ID_OR_NAME")) > 0) {
    $arResult['F_SEARCH'] = $fID;
}
if ($arParams['SHOW_SECTIONS_BAR'] === 'Y' || $arParams['SHOW_FILTER_BAR'] === 'Y' || $arParams['SHOW_COUNTERS_BAR'] === 'Y') {
    // Show this section ONLY if given user is head of department
    // and logged in user is admin or given user or manager of given user
    if ($arParams['SHOW_SECTION_MANAGE'] === 'A') {
        $arResult['SHOW_SECTION_MANAGE'] = 'N';
        if ($isAccessToCounters) {
            if (CModule::Includemodule('intranet')) {
                $arDepartments = CIntranetUtils::GetSubordinateDepartments($arParams['USER_ID'], $bRecursive = false);
            }
            if (!empty($arDepartments)) {
                $arResult['SHOW_SECTION_MANAGE'] = 'Y';
            }
        }
    }
    if ($arResult['SHOW_SECTION_MANAGE'] === 'Y' && $arParams['GROUP_ID'] > 0) {
        $arResult['SHOW_SECTION_MANAGE'] = 'N';
    }
    if ($arResult['SHOW_SECTION_MANAGE'] === 'Y') {
        $arResult['SECTION_MANAGE_COUNTER'] = 0;
        if ($arEmployees = CTaskIntranetTools::getImmediateEmployees($arParams['USER_ID'])) {
            foreach ($arEmployees as $employeeId) {
                $employeeId = (int) $employeeId;
                $arResult['SECTION_MANAGE_COUNTER'] += CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_RESPONSIBLE) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_ACCOMPLICE) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_ORIGINATOR) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_AUDITOR);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: GetDirectAccess

 public static function GetDirectAccess($USER_ID = false)
 {
     global $USER;
     $USER_ID = intval($USER_ID);
     if ($USER_ID <= 0) {
         $USER_ID = $USER->GetID();
     }
     $arSDeps = CIntranetUtils::GetSubordinateDepartments($USER_ID, true);
     $arStruct = CIntranetUtils::GetStructure();
     $arEmployees = array();
     foreach ($arSDeps as $dpt) {
         $arCurDpt = $arStruct['DATA'][$dpt];
         $employee = $arCurDpt["UF_HEAD"] ? $arCurDpt["UF_HEAD"] : (count($arCurDpt["EMPLOYEES"]) > 0 ? $arCurDpt["EMPLOYEES"][0] : false);
         if ($employee && $employee == $USER_ID) {
             foreach ($arCurDpt["EMPLOYEES"] as $empUser) {
                 $arEmployees[] = $empUser;
             }
         } elseif ($employee) {
             $headManager = CTimeMan::GetUserManagers($employee);
             //find head manager of employee
             if ($USER_ID == $headManager[0]) {
                 if ($arCurDpt["UF_HEAD"]) {
                     $arEmployees[] = $employee;
                 } else {
                     foreach ($arCurDpt["EMPLOYEES"] as $empUser) {
                         $arEmployees[] = $empUser;
                     }
                 }
             }
         }
     }
     return array_unique($arEmployees);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:timeman.php

示例8: getInitDepartmentsIds

 private function getInitDepartmentsIds()
 {
     global $USER;
     // Start from given department or from user-managed
     if (isset($_GET['DEP_ID'])) {
         $startFromDepartmentsDraft = array((int) $_GET['DEP_ID']);
     } else {
         // Departments where given user is head
         $startFromDepartmentsDraft = array_unique(array_filter(array_map('intval', CIntranetUtils::GetSubordinateDepartments($this->arParams['USER_ID'], $bRecursive = false))));
     }
     if ($USER->isAdmin() || CTasksTools::IsPortalB24Admin()) {
         // access to any departments
         $startFromDepartments = $startFromDepartmentsDraft;
     } else {
         $arAllAccessibleDepartments = array_unique(array_filter(array_map('intval', CIntranetUtils::GetSubordinateDepartments($this->arResult['LOGGED_IN_USER'], $bRecursive = true))));
         $startFromDepartments = array();
         foreach ($startFromDepartmentsDraft as $departmentId) {
             if (in_array($departmentId, $arAllAccessibleDepartments, true)) {
                 $startFromDepartments[] = $departmentId;
             }
         }
     }
     return $startFromDepartments;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:24,代码来源:class.php


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