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


PHP CIntranetUtils::GetEmployeesForSorting方法代码示例

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


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

示例1: array_intersect

         $arAccessUsers['READ'] = array_intersect($arAccessUsers['READ'], $arDirectUsers);
     } else {
         $arAccessUsers['READ'] = $arDirectUsers;
     }
     //$arAccessUsers['READ'] = $arDirectUsers;
     $bCanReadAll = false;
     if (count($arAccessUsers['READ']) <= 0) {
         break;
     }
 }
 $arFilter[] = array("LOGIC" => "OR", array("LOGIC" => "AND", "<DATE_TO" => $date_to, ">=DATE_TO" => $date_from), array("LOGIC" => "AND", "<DATE_FROM" => $date_to, ">=DATE_FROM" => $date_from));
 $arFilter[] = array("LOGIC" => "AND", array("ACTIVE" => "Y"));
 if ($arAccessUsers["READ"][0] != "*") {
     $arFilter[] = array("LOGIC" => "AND", array("USER_ID" => $arAccessUsers["READ"]));
 }
 $arUserIDs = CIntranetUtils::GetEmployeesForSorting($page, $amount, $section_id, $bCanReadAll ? false : $arAccessUsers['READ']);
 $arSections = array_keys($arUserIDs);
 $arUsers = array();
 foreach ($arUserIDs as $ar) {
     $arUsers = array_merge($arUsers, $ar);
 }
 $arFilterUser = array();
 $arFilterUser['USER_ID'] = $arUsers;
 $dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arUsers), 'ACTIVE' => 'Y'), array('SELECT' => array('*', 'UF_DEPARTMENT')));
 while ($arRes = $dbRes->GetNext()) {
     $res['USERS'][$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), array('USER_ID' => $arRes['ID'], 'NAME' => $arRes['NAME'], 'LAST_NAME' => $arRes['LAST_NAME'], 'SECOND_NAME' => $arRes['SECOND_NAME']), true, false), 'DEPARTMENT' => $arRes['UF_DEPARTMENT'][0], 'URL' => str_replace(array('#ID#', '#USER_ID#'), $arRes['ID'], COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $_REQUEST['site_id'])), 'SETTINGS' => array());
     $arFilterReport = array();
     $arFilterReport[] = array("LOGIC" => "OR", array("LOGIC" => "AND", "<DATE_TO" => $date_to, ">=DATE_TO" => $date_from), array("LOGIC" => "AND", "<DATE_FROM" => $date_to, ">=DATE_FROM" => $date_from));
     //fix this in future
     $arFilterReport[] = array("LOGIC" => "AND", array("USER_ID" => $arRes["ID"]));
     $arFilterReport[] = array("LOGIC" => "AND", array("ACTIVE" => "Y"));
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:timeman.php

示例2: _getUsersData

 private function _getUsersData(&$arUserIDs)
 {
     $arResult = array();
     $arFilter = $this->__getFilter();
     if (!$this->bShowAll) {
         $arActiveUsers = array();
         $dbRes = CTimeManEntry::GetList(array('USER_ID' => 'ASC'), $arFilter, array('USER_ID'), false, array('USER_ID'));
         while ($arRes = $dbRes->GetNext()) {
             $arActiveUsers[] = $arRes['USER_ID'];
         }
         if (!$this->bCanReadAll) {
             $this->arAccessUsers['READ'] = array_intersect($this->arAccessUsers['READ'], $arActiveUsers);
         } else {
             $this->arAccessUsers['READ'] = $arActiveUsers;
         }
         $this->bCanReadAll = false;
         if (count($this->arAccessUsers['READ']) <= 0) {
             return $arResult;
         }
     }
     $arUserIDs = CIntranetUtils::GetEmployeesForSorting($this->page, $this->amount, $this->department, $this->bCanReadAll ? false : $this->arAccessUsers['READ']);
     $arUsers = array();
     foreach ($arUserIDs as $ar) {
         $arUsers = array_merge($arUsers, $ar);
     }
     $arFilter['USER_ID'] = $arUsers;
     if ($this->bShowAll) {
         $dbRes = CUser::GetList($by = 'LAST_NAME', $order = 'asc', array('ID' => implode('|', $arUsers), 'ACTIVE' => 'Y'), array('SELECT' => array('*', 'UF_DEPARTMENT')));
         while ($arRes = $dbRes->GetNext()) {
             $arResult[$arRes['ID']] = $this->__getUserRow($arRes);
         }
     }
     $dbRes = CTimeManEntry::GetList(array('USER_LAST_NAME' => 'ASC', 'DATE_START' => 'ASC'), $arFilter, false, false, array('*', 'UF_DEPARTMENT', 'ACTIVATED'));
     $arEntriesMap = array();
     while ($arRes = $dbRes->GetNext()) {
         if (!$arResult[$arRes['USER_ID']]) {
             $arResult[$arRes['USER_ID']] = $this->__getUserRow($arRes, 'USER_');
         } elseif ($arEntriesMap[$arRes['ID']]) {
             continue;
         }
         $ts_start = MakeTimeStamp($arRes['DATE_START']);
         $arEntry = array('ID' => $arRes['ID'], 'USER_ID' => $arRes['USER_ID'], 'DAY' => date('j', $ts_start), 'ACTIVE' => $arRes['ACTIVE'] == 'Y', 'PAUSED' => $arRes['PAUSED'] == 'Y', 'ACTIVATED' => $arRes['ACTIVATED'] == 'Y', 'DATE_START' => MakeTimeStamp($arRes['DATE_START']) - CTimeZone::GetOffset(), 'DATE_FINISH' => $arRes['DATE_FINISH'] ? MakeTimeStamp($arRes['DATE_FINISH']) - CTimeZone::GetOffset() : '', 'TIME_START' => $arRes['TIME_START'], 'TIME_FINISH' => $arRes['TIME_FINISH'], 'DURATION' => $arRes['DURATION'], 'TIME_LEAKS' => $arRes['TIME_LEAKS'], 'CAN_EDIT' => $this->bCanEditAll || in_array($arRes['USER_ID'], $this->arAccessUsers['WRITE']));
         if ($arRes['DATE_FINISH'] && $arRes['PAUSED'] !== 'Y') {
             if ($arRes['ACTIVE'] == 'Y') {
                 $arResult[$arRes['USER_ID']]['TOTAL'] += $arRes['DURATION'];
                 $arResult[$arRes['USER_ID']]['TOTAL_DAYS']++;
                 $arSettings = $arResult[$arRes['USER_ID']]['SETTINGS'];
                 if (!$arSettings['UF_TM_FREE'] && ($arSettings['UF_TM_MAX_START'] < $arEntry['TIME_START'] || $arSettings['UF_TM_MIN_FINISH'] > $arEntry['TIME_FINISH'] || $arSettings['UF_TM_MIN_DURATION'] > $arEntry['DURATION'])) {
                     $arResult[$arRes['USER_ID']]['TOTAL_VIOLATIONS']++;
                 }
             } else {
                 $arResult[$arRes['USER_ID']]['TOTAL_INACTIVE']++;
             }
         }
         $arEntriesMap[$arRes['ID']] = true;
         $arResult[$arRes['USER_ID']]['ENTRIES'][] = $arEntry;
     }
     return $arResult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:timeman_admin_report.php


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