Exemple #1
0
 $arCurrentUser['PHOTO'] = $arCurrentUser['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arCurrentUser['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
 $arManagers = CTimeMan::GetUserManagers($arRes['USER_ID']);
 if (!is_array($arManagers) || count($arManagers) <= 0) {
     $arManagers = array($arRes['USER_ID']);
 }
 $user_url = COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $_REQUEST['site_id']);
 $dbManagers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arManagers)));
 $arCurrentUserManagers = array();
 while ($manager = $dbManagers->Fetch()) {
     $manager['PHOTO'] = $manager['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($manager['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
     $arCurrentUserManagers[] = array('ID' => $manager['ID'], 'LOGIN' => $manager['LOGIN'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $manager, true, false), 'URL' => str_replace(array('#ID#', '#USER_ID#'), $manager['ID'], $user_url), 'WORK_POSITION' => $manager['WORK_POSITION'], 'PHOTO' => $manager['PHOTO']['CACHE']['src']);
 }
 $arRes['DATE_START'] = MakeTimeStamp($arRes['DATE_START']) - CTimeZone::GetOffset();
 $arRes['DATE_FINISH'] = MakeTimeStamp($arRes['DATE_FINISH']) - CTimeZone::GetOffset();
 $arInfo = array('INFO' => $arRes, 'DATE_TEXT' => FormatDate('j F Y', $arRes['DATE_START']), 'CALENDAR_ENABLED' => CBXFeatures::IsFeatureEnabled('Calendar'), 'TASKS_ENABLED' => CBXFeatures::IsFeatureEnabled('Tasks') && IsModuleInstalled('tasks'));
 $cur_info = $obUser->GetCurrentInfo();
 if ($cur_info['ID'] == $ID) {
     $arInfo['STATE'] = $obUser->State();
     $arInfo['EXPIRED_DATE'] = $obUser->GetExpiredRecommendedDate();
 } else {
     $arInfo['STATE'] = 'CLOSED';
 }
 $res = array('FROM' => array('ID' => $arCurrentUser['ID'], 'LOGIN' => $arCurrentUser['LOGIN'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), $arCurrentUser, true, false), 'URL' => str_replace(array('#ID#', '#USER_ID#'), $arCurrentUser['ID'], $user_url), 'WORK_POSITION' => $arCurrentUser['WORK_POSITION'], 'PHOTO' => $arCurrentUser['PHOTO']['CACHE']['src']), 'TO' => array_values($arCurrentUserManagers), 'INFO' => $arInfo, 'REPORT' => '', 'CAN_EDIT' => $bCanEdit ? 'Y' : 'N', 'REPORTS' => array());
 if (count($res['TO']) <= 0) {
     $res['TO'] = array($res['FROM']);
 }
 $arUserIDs = array();
 $dbReports = CTimeManReport::GetList(array('ID' => 'ASC'), array('ENTRY_ID' => $arInfo['INFO']['ID']));
 while ($arReport = $dbReports->Fetch()) {
     switch ($arReport['REPORT_TYPE']) {
         case 'ERR_OPEN':
Exemple #2
0
 public static function GetActiveStatusByTimeman($userId)
 {
     if ($userId <= 0) {
         return false;
     }
     if (CModule::IncludeModule('timeman')) {
         $tmUser = new CTimeManUser($userId);
         $tmSettings = $tmUser->GetSettings(array('UF_TIMEMAN'));
         if (!$tmSettings['UF_TIMEMAN']) {
             $result = true;
         } else {
             $tmUser->GetCurrentInfo(true);
             // need for reload cache
             if ($tmUser->State() == 'OPENED') {
                 $result = true;
             } else {
                 $result = false;
             }
         }
     } else {
         $result = true;
     }
     return $result;
 }