Beispiel #1
0
 private static function searchImmediateEmployeesInSubDepartments($departmentId)
 {
     $arDepartmentHeads = array();
     $arQueueDepartmentsEmployees = array();
     // IDs of departments where we need employees
     $arSubDepartments = CIntranetUtils::getSubDepartments($departmentId);
     if (is_array($arSubDepartments)) {
         foreach ($arSubDepartments as $subDepId) {
             $headUserId = CIntranetUtils::GetDepartmentManagerID($subDepId);
             if ($headUserId) {
                 $arDepartmentHeads[] = $headUserId;
             } else {
                 $arQueueDepartmentsEmployees[] = $subDepId;
                 $result = self::searchImmediateEmployeesInSubDepartments($subDepId);
                 $arDepartmentHeads = array_merge($arDepartmentHeads, $result['arDepartmentHeads']);
                 $arQueueDepartmentsEmployees = array_merge($arQueueDepartmentsEmployees, $result['arQueueDepartmentsEmployees']);
             }
         }
     }
     return array('arDepartmentHeads' => $arDepartmentHeads, 'arQueueDepartmentsEmployees' => $arQueueDepartmentsEmployees);
 }
Beispiel #2
0
 public function executeComponent()
 {
     global $APPLICATION;
     $APPLICATION->SetTitle(GetMessage('TASKS_TITLE_TASKS'));
     if (!CModule::IncludeModule('tasks')) {
         ShowError(GetMessage('TASKS_MODULE_NOT_FOUND'));
         return 0;
     }
     if (!CModule::IncludeModule('intranet')) {
         return 0;
     }
     $this->arResult['DEPARTMENTS'] = array();
     $this->processParams();
     // preparw arResult
     if (!($this->arResult['LOGGED_IN_USER'] >= 1)) {
         return 0;
     }
     $nameTemplate = $this->arResult['NAME_TEMPLATE'];
     $startFromDepartments = $this->getInitDepartmentsIds();
     $arDepartmentsData = CIntranetUtils::GetDepartmentsData($startFromDepartments);
     if (!is_array($arDepartmentsData) || empty($arDepartmentsData)) {
         $this->IncludeComponentTemplate();
         return 0;
     }
     $allUsersIds = array();
     $arSubDepartmentsUsers = array();
     foreach ($arDepartmentsData as $departmentId => $departmentName) {
         $departmentHead = CIntranetUtils::GetDepartmentManagerID($departmentId);
         $arSubDepartmentsIds = CIntranetUtils::getSubDepartments($departmentId);
         $this->arResult['DEPARTMENTS'][$departmentId] = array('~TITLE' => $departmentName, 'TITLE' => htmlspecialcharsbx($departmentName), 'HEAD_USER_ID' => $departmentHead, 'RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0, 'USERS' => array(), 'SUBDEPARTMENTS' => array());
         $rsUsers = CTaskIntranetTools::getDepartmentsUsers(array($departmentId), array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'WORK_POSITION'));
         $arUsers = array();
         $arDepartmentUsersIds = array();
         while ($arUser = $rsUsers->getNext()) {
             $arUser['USER_IN_SUBDEPS'] = false;
             $arUsers[] = $arUser;
             $arDepartmentUsersIds[] = (int) $arUser['ID'];
         }
         if ($departmentHead > 0) {
             $arImmediateEmployees = CTaskIntranetTools::getImmediateEmployees($departmentHead, array($departmentId));
             if (is_array($arImmediateEmployees) && !empty($arImmediateEmployees)) {
                 // Remove immediate manager's employees in subdeps, if they are already in current department
                 $arImmediateEmployees = array_diff($arImmediateEmployees, $arDepartmentUsersIds);
                 if (!empty($arImmediateEmployees)) {
                     $rsUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('ACTIVE' => 'Y', 'ID' => implode('|', array_unique($arImmediateEmployees))), array('SELECT' => array('UF_DEPARTMENT'), 'FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'WORK_POSITION')));
                     while ($arUser = $rsUsers->getNext()) {
                         $arUser['USER_IN_SUBDEPS'] = true;
                         $arUsers[] = $arUser;
                     }
                 }
             }
         }
         foreach ($arUsers as $arUser) {
             $userId = (int) $arUser['ID'];
             $allUsersIds[] = $userId;
             $userPhoto = false;
             if ($arUser['PERSONAL_PHOTO'] > 0) {
                 $userPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30, 0, BX_RESIZE_IMAGE_EXACT);
             }
             $tasksHref = CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_USER_TASKS'], array('user_id' => $userId));
             $this->arResult['DEPARTMENTS'][$departmentId]['USERS'][] = array('ID' => $userId, 'PHOTO' => $userPhoto, 'DEPARTMENT_HEAD' => $departmentHead == $userId ? 'Y' : 'N', 'USER_IN_SUBDEPS' => $arUser['USER_IN_SUBDEPS'] ? 'Y' : 'N', 'FORMATTED_NAME' => CUser::FormatName($nameTemplate, array('NAME' => $arUser['~NAME'], 'LAST_NAME' => $arUser['~LAST_NAME'], 'SECOND_NAME' => $arUser['~SECOND_NAME'], 'LOGIN' => $arUser['~LOGIN']), true, true), 'WORK_POSITION' => $arUser['WORK_POSITION'], '~WORK_POSITION' => $arUser['~WORK_POSITION'], 'NAME' => $arUser['NAME'], 'LAST_NAME' => $arUser['LAST_NAME'], 'SECOND_NAME' => $arUser['SECOND_NAME'], '~NAME' => $arUser['~NAME'], '~LAST_NAME' => $arUser['~LAST_NAME'], '~SECOND_NAME' => $arUser['~SECOND_NAME'], 'HREF' => CComponentEngine::MakePathFromTemplate($this->arResult['PATH_TO_USER'], array('user_id' => $userId)), 'RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0, 'RESPONSIBLES_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sR400', 'RESPONSIBLES_NOTICED_HREF' => null, 'ACCOMPLICES_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sR800', 'ACCOMPLICES_NOTICED_HREF' => null, 'ORIGINATORS_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sRg00', 'ORIGINATORS_NOTICED_HREF' => null, 'AUDITORS_TOTAL_HREF' => $tasksHref . '?F_CANCEL=Y&F_STATE=sRc00', 'AUDITORS_NOTICED_HREF' => null);
         }
         if (is_array($arSubDepartmentsIds)) {
             $arSubDepartmentsData = CIntranetUtils::GetDepartmentsData($arSubDepartmentsIds);
             foreach ($arSubDepartmentsIds as $subDepartmentId) {
                 $title = '';
                 if (array_key_exists($subDepartmentId, $arSubDepartmentsData)) {
                     $title = $arSubDepartmentsData[$subDepartmentId];
                 }
                 $this->arResult['DEPARTMENTS'][$departmentId]['SUBDEPARTMENTS'][$subDepartmentId] = array('ID' => $subDepartmentId, '~TITLE' => $title, 'TITLE' => htmlspecialcharsbx($title), 'COUNTERS' => array('RESPONSIBLES_TOTAL_TASKS' => 0, 'RESPONSIBLES_NOTICED_TASKS' => 0, 'ACCOMPLICES_TOTAL_TASKS' => 0, 'ACCOMPLICES_NOTICED_TASKS' => 0, 'ORIGINATORS_TOTAL_TASKS' => 0, 'ORIGINATORS_NOTICED_TASKS' => 0, 'AUDITORS_TOTAL_TASKS' => 0, 'AUDITORS_NOTICED_TASKS' => 0), 'HREF' => '?DEP_ID=' . (int) $subDepartmentId);
                 $arSubDepartmentsUsers[$subDepartmentId] = array();
             }
             $rsUsers = CIntranetUtils::GetDepartmentEmployees($arSubDepartmentsIds, $bRecursive = false, $bSkipSelf = false);
             while ($arUser = $rsUsers->fetch()) {
                 if (is_array($arUser['UF_DEPARTMENT'])) {
                     $userId = (int) $arUser['ID'];
                     $allUsersIds[] = $userId;
                     foreach ($arUser['UF_DEPARTMENT'] as $subDepartmentId) {
                         if ($subDepartmentId > 0) {
                             $arSubDepartmentsUsers[$subDepartmentId][] = $userId;
                         }
                     }
                 }
             }
         }
         usort($this->arResult['DEPARTMENTS'][$departmentId]['USERS'], function ($a, $b) {
             if ($a['USER_IN_SUBDEPS'] !== $b['USER_IN_SUBDEPS']) {
                 if ($a['USER_IN_SUBDEPS'] === 'N') {
                     return -1;
                 } else {
                     return 1;
                 }
             }
             if ($a['DEPARTMENT_HEAD'] !== $b['DEPARTMENT_HEAD']) {
                 if ($a['DEPARTMENT_HEAD'] === 'Y') {
                     return -1;
                 } else {
                     return 1;
                 }
             }
             return strcmp($a['FORMATTED_NAME'], $b['FORMATTED_NAME']);
         });
     }
     $arCounters = self::getCounts($allUsersIds);
     foreach ($startFromDepartments as $departmentId) {
         foreach ($this->arResult['DEPARTMENTS'][$departmentId]['USERS'] as &$userData) {
             $arCounter = $arCounters[$userData['ID']];
             $userData['RESPONSIBLES_TOTAL_TASKS'] = $arCounter['RESPONSIBLES_TOTAL_TASKS'];
             $userData['RESPONSIBLES_NOTICED_TASKS'] = $arCounter['RESPONSIBLES_NOTICED_TASKS'];
             $userData['ACCOMPLICES_TOTAL_TASKS'] = $arCounter['ACCOMPLICES_TOTAL_TASKS'];
             $userData['ACCOMPLICES_NOTICED_TASKS'] = $arCounter['ACCOMPLICES_NOTICED_TASKS'];
             $userData['ORIGINATORS_TOTAL_TASKS'] = $arCounter['ORIGINATORS_TOTAL_TASKS'];
             $userData['ORIGINATORS_NOTICED_TASKS'] = $arCounter['ORIGINATORS_NOTICED_TASKS'];
             $userData['AUDITORS_TOTAL_TASKS'] = $arCounter['AUDITORS_TOTAL_TASKS'];
             $userData['AUDITORS_NOTICED_TASKS'] = $arCounter['AUDITORS_NOTICED_TASKS'];
             if ($userData['USER_IN_SUBDEPS'] === 'N') {
                 $this->arResult['DEPARTMENTS'][$departmentId]['RESPONSIBLES_TOTAL_TASKS'] += $arCounter['RESPONSIBLES_TOTAL_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['RESPONSIBLES_NOTICED_TASKS'] += $arCounter['RESPONSIBLES_NOTICED_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['ACCOMPLICES_TOTAL_TASKS'] += $arCounter['ACCOMPLICES_TOTAL_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['ACCOMPLICES_NOTICED_TASKS'] += $arCounter['ACCOMPLICES_NOTICED_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['ORIGINATORS_TOTAL_TASKS'] += $arCounter['ORIGINATORS_TOTAL_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['ORIGINATORS_NOTICED_TASKS'] += $arCounter['ORIGINATORS_NOTICED_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['AUDITORS_TOTAL_TASKS'] += $arCounter['AUDITORS_TOTAL_TASKS'];
                 $this->arResult['DEPARTMENTS'][$departmentId]['AUDITORS_NOTICED_TASKS'] += $arCounter['AUDITORS_NOTICED_TASKS'];
             }
         }
         unset($userData);
         foreach ($this->arResult['DEPARTMENTS'][$departmentId]['SUBDEPARTMENTS'] as $subDepartmentId => &$subDepData) {
             foreach ($arSubDepartmentsUsers[$subDepartmentId] as $userId) {
                 $arCounter = $arCounters[$userId];
                 $subDepData['COUNTERS']['RESPONSIBLES_TOTAL_TASKS'] += $arCounter['RESPONSIBLES_TOTAL_TASKS'];
                 $subDepData['COUNTERS']['RESPONSIBLES_NOTICED_TASKS'] += $arCounter['RESPONSIBLES_NOTICED_TASKS'];
                 $subDepData['COUNTERS']['ACCOMPLICES_TOTAL_TASKS'] += $arCounter['ACCOMPLICES_TOTAL_TASKS'];
                 $subDepData['COUNTERS']['ACCOMPLICES_NOTICED_TASKS'] += $arCounter['ACCOMPLICES_NOTICED_TASKS'];
                 $subDepData['COUNTERS']['ORIGINATORS_TOTAL_TASKS'] += $arCounter['ORIGINATORS_TOTAL_TASKS'];
                 $subDepData['COUNTERS']['ORIGINATORS_NOTICED_TASKS'] += $arCounter['ORIGINATORS_NOTICED_TASKS'];
                 $subDepData['COUNTERS']['AUDITORS_TOTAL_TASKS'] += $arCounter['AUDITORS_TOTAL_TASKS'];
                 $subDepData['COUNTERS']['AUDITORS_NOTICED_TASKS'] += $arCounter['AUDITORS_NOTICED_TASKS'];
             }
         }
         unset($subDepData);
     }
     $this->IncludeComponentTemplate();
 }
Beispiel #3
0
 public function executeComponent()
 {
     if (!CModule::IncludeModule('intranet')) {
         ShowError(GetMessage('INTR_ISL_INTRANET_MODULE_NOT_INSTALLED'));
         return;
     }
     if (!CModule::IncludeModule('socialnetwork')) {
         return;
     }
     $showDepHeadAdditional = $this->arParams['SHOW_DEP_HEAD_ADDITIONAL'] == 'Y';
     $bNav = $this->arParams['SHOW_NAV_TOP'] == 'Y' || $this->arParams['SHOW_NAV_BOTTOM'] == 'Y';
     $isEnoughFiltered = $this->fillFilter();
     list($cntStartCacheId, $cntStart) = $this->getCacheIdWithDepartment();
     if ($this->arParams['SHOW_UNFILTERED_LIST'] == 'N' && !$this->bExcel && !$isEnoughFiltered) {
         $this->arResult['EMPTY_UNFILTERED_LIST'] = 'Y';
         $this->includeComponentTemplate();
         return;
     }
     $this->arParams['bCache'] = $cntStart == count($this->arFilter) && !$this->bExcel && $this->arParams['CACHE_TYPE'] == 'Y' && $this->arParams['CACHE_TIME'] > 0;
     $this->arResult['FILTER_VALUES'] = $this->arFilter;
     if (!$this->bExcel && $bNav) {
         CPageOption::SetOptionString("main", "nav_page_in_session", "N");
     }
     $bFromCache = false;
     if ($this->arParams['bCache']) {
         if ($bFromCache = $this->initCache($cntStartCacheId)) {
             $vars = $this->obCache->getVars();
             $this->arResult['USERS'] = $vars['USERS'];
             $this->arResult['DEPARTMENTS'] = $vars['DEPARTMENTS'];
             $this->arResult['DEPARTMENT_HEAD'] = $vars['DEPARTMENT_HEAD'];
             $this->arResult['USERS_NAV'] = $vars['USERS_NAV'];
             $strUserIDs = $vars['STR_USER_ID'];
         } else {
             $this->obCache->startDataCache();
             $this->getCacheManager()->startTagCache($this->cacheDir);
             $this->getCacheManager()->registerTag('intranet_users');
         }
     }
     if (!$bFromCache) {
         // get users list
         $obUser = new CUser();
         $arSelect = array('ID', 'ACTIVE', 'CONFIRM_CODE', 'DEP_HEAD', 'GROUP_ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'LID', 'DATE_REGISTER', 'PERSONAL_PROFESSION', 'PERSONAL_WWW', 'PERSONAL_ICQ', 'PERSONAL_GENDER', 'PERSONAL_BIRTHDATE', 'PERSONAL_PHOTO', 'PERSONAL_PHONE', 'PERSONAL_FAX', 'PERSONAL_MOBILE', 'PERSONAL_PAGER', 'PERSONAL_STREET', 'PERSONAL_MAILBOX', 'PERSONAL_CITY', 'PERSONAL_STATE', 'PERSONAL_ZIP', 'PERSONAL_COUNTRY', 'PERSONAL_NOTES', 'WORK_COMPANY', 'WORK_DEPARTMENT', 'WORK_POSITION', 'WORK_WWW', 'WORK_PHONE', 'WORK_FAX', 'WORK_PAGER', 'WORK_STREET', 'WORK_MAILBOX', 'WORK_CITY', 'WORK_STATE', 'WORK_ZIP', 'WORK_COUNTRY', 'WORK_PROFILE', 'WORK_LOGO', 'WORK_NOTES', 'PERSONAL_BIRTHDAY', 'LAST_ACTIVITY_DATE', 'LAST_LOGIN', 'IS_ONLINE');
         $this->arResult['USERS'] = array();
         $this->arResult['DEPARTMENTS'] = array();
         $this->arResult['DEPARTMENT_HEAD'] = 0;
         // disable/enable appearing of department head on page
         if ($showDepHeadAdditional && !empty($this->arFilter['UF_DEPARTMENT']) && is_array($this->arFilter['UF_DEPARTMENT'])) {
             if ($this->arParams['bCache']) {
                 $this->getCacheManager()->registerTag('intranet_department_' . $this->arFilter['UF_DEPARTMENT'][0]);
             }
             $managerId = CIntranetUtils::GetDepartmentManagerID($this->arFilter['UF_DEPARTMENT'][0]);
             $appendManager = CUser::GetByID($managerId)->Fetch();
             if ($appendManager) {
                 $this->arResult['DEPARTMENT_HEAD'] = $appendManager['ID'];
                 $this->arFilter['!ID'] = $appendManager['ID'];
                 $this->arResult['USERS'][$appendManager['ID']] = $appendManager;
             }
         }
         $bDisable = false;
         if (CModule::IncludeModule('extranet')) {
             if (CExtranet::IsExtranetSite() && !CExtranet::IsExtranetAdmin()) {
                 $arIDs = array_merge(CExtranet::GetMyGroupsUsers(SITE_ID), CExtranet::GetPublicUsers());
                 if ($this->arParams['bCache']) {
                     $this->getCacheManager()->registerTag('extranet_public');
                     $this->getCacheManager()->registerTag('extranet_user_' . $this->getUser()->getID());
                 }
                 if (false !== ($key = array_search($this->getUser()->getID(), $arIDs))) {
                     unset($arIDs[$key]);
                 }
                 if (count($arIDs) > 0) {
                     $this->arFilter['ID'] = implode('|', array_unique($arIDs));
                 } else {
                     $bDisable = true;
                 }
             }
         }
         if ($bDisable) {
             $dbUsers = new CDBResult();
             $dbUsers->initFromArray(array());
         } else {
             $arListParams = array('SELECT' => array('UF_*'), 'ONLINE_INTERVAL' => static::LAST_ACTIVITY);
             if (!$this->bExcel && $this->arParams['USERS_PER_PAGE'] > 0) {
                 $arListParams['NAV_PARAMS'] = array('nPageSize' => $this->arParams['USERS_PER_PAGE'], 'bShowAll' => false);
             }
             $dbUsers = $obUser->GetList($sortBy = 'last_name', $sortDir = 'asc', $this->arFilter, $arListParams);
         }
         $strUserIDs = '';
         while ($arUser = $dbUsers->Fetch()) {
             $this->arResult['USERS'][$arUser['ID']] = $arUser;
             $strUserIDs .= ($strUserIDs === '' ? '' : '|') . $arUser['ID'];
         }
         $structure = CIntranetUtils::getStructure();
         $this->arResult['DEPARTMENTS'] = $structure['DATA'];
         $this->setDepWhereUserIsHead();
         $arAdmins = array();
         /** @noinspection PhpUndefinedVariableInspection */
         $rsUsers = CUser::GetList($o, $b, array("GROUPS_ID" => array(static::ADMIN_GROUP_ID)), array("SELECT" => array("ID")));
         while ($ar = $rsUsers->Fetch()) {
             $arAdmins[$ar["ID"]] = $ar["ID"];
         }
         $extranetUsers = array();
         if (CModule::IncludeModule('extranet') && ($extranetGroupID = CExtranet::GetExtranetUserGroupID())) {
             $rsUsers = CUser::GetList($o, $b, array("GROUPS_ID" => array($extranetGroupID)), array("SELECT" => array("ID")));
             while ($ar = $rsUsers->Fetch()) {
                 $extranetUsers[$ar["ID"]] = $ar["ID"];
             }
         }
         $displayPhoto = $this->displayPersonalPhoto();
         foreach ($this->arResult['USERS'] as $key => &$arUser) {
             // cache optimization
             foreach ($arUser as $k => $value) {
                 if (is_array($value) && count($value) <= 0 || !is_array($value) && strlen($value) <= 0 || !in_array($k, $arSelect) && substr($k, 0, 3) != 'UF_') {
                     unset($arUser[$k]);
                 } elseif ($k == "PERSONAL_COUNTRY" || $k == "WORK_COUNTRY") {
                     $arUser[$k] = GetCountryByID($value);
                 }
             }
             $arUser['IS_ONLINE'] = $arUser['IS_ONLINE'] == 'Y' ? true : false;
             if ($this->arParams['bCache']) {
                 $this->getCacheManager()->registerTag('intranet_user_' . $arUser['ID']);
             }
             $arUser['DETAIL_URL'] = str_replace(array('#ID#', '#USER_ID#'), $arUser['ID'], $this->arParams['DETAIL_URL']);
             $arUser['ADMIN'] = isset($arAdmins[$arUser['ID']]);
             //is user admin/extranet
             $arUser['ACTIVITY_STATUS'] = 'active';
             $arUser['EXTRANET'] = false;
             if (isset($extranetUsers[$arUser['ID']]) && empty($arUser['UF_DEPARTMENT'][0])) {
                 $arUser["ACTIVITY_STATUS"] = 'extranet';
                 $arUser['EXTRANET'] = true;
             }
             if ($arUser["ACTIVE"] == "N") {
                 $arUser["ACTIVITY_STATUS"] = 'fired';
             }
             if (!empty($arUser["CONFIRM_CODE"])) {
                 $arUser["ACTIVITY_STATUS"] = 'inactive';
             }
             $arUser['SHOW_USER'] = $this->arParams["SHOW_USER"];
             $arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
             $arDep = array();
             foreach ((array) $arUser['UF_DEPARTMENT'] as $sect) {
                 $arDep[$sect] = $this->arResult['DEPARTMENTS'][$sect]['NAME'];
             }
             $arUser['UF_DEPARTMENT'] = $arDep;
             if (!$this->bExcel && $displayPhoto) {
                 $this->resizePersonalPhoto($arUser);
             }
             if (count($arUser['UF_DEPARTMENT']) <= 0 && !$arUser['EXTRANET']) {
                 unset($this->arResult['USERS'][$key]);
             }
         }
         unset($arUser, $key);
         $this->arResult["USERS_NAV"] = $bNav ? $dbUsers->GetPageNavStringEx($navComponentObject = null, $this->arParams["NAV_TITLE"]) : '';
         if ($this->arParams['bCache']) {
             $this->getCacheManager()->endTagCache();
             $this->obCache->endDataCache(array('USERS' => $this->arResult['USERS'], 'STR_USER_ID' => $strUserIDs, 'DEPARTMENTS' => $this->arResult['DEPARTMENTS'], 'DEPARTMENT_HEAD' => $this->arResult['DEPARTMENT_HEAD'], 'USERS_NAV' => $this->arResult['USERS_NAV']));
         }
     }
     $this->initSonetUserPerms(array_keys($this->arResult['USERS']));
     $this->workWithNonCacheAttr($bFromCache, $strUserIDs);
     if (!$this->bExcel) {
         $this->arResult['bAdmin'] = $this->getUser()->canDoOperation('edit_all_users') || $this->getUser()->canDoOperation('edit_subordinate_users');
         $this->IncludeComponentTemplate();
     } else {
         $this->getApplication()->restartBuffer();
         // hack. any '.default' customized template should contain 'excel' page
         $this->setTemplateName('.default');
         Header("Content-Type: application/force-download");
         Header("Content-Type: application/octet-stream");
         Header("Content-Type: application/download");
         Header("Content-Disposition: attachment;filename=users.xls");
         Header("Content-Transfer-Encoding: binary");
         $this->IncludeComponentTemplate('excel');
         die;
     }
     return;
 }