Exemplo n.º 1
0
 private function __getUserRow($arRes, $prefix = '')
 {
     if ($this->department) {
         $arRes['UF_DEPARTMENT'] = array_values(array_intersect($arRes['UF_DEPARTMENT'], $arFilter['UF_DEPARTMENT']));
     }
     $res = array('ID' => $arRes[$prefix . 'ID'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), array('USER_ID' => $arRes[$prefix . 'ID'], 'NAME' => $arRes[$prefix . 'NAME'], 'LAST_NAME' => $arRes[$prefix . 'LAST_NAME'], 'SECOND_NAME' => $arRes[$prefix . 'SECOND_NAME'], 'LOGIN' => $arRes[$prefix . 'LOGIN'], 'EMAIL' => $arRes[$prefix . 'EMAIL']), true, false), 'DEPARTMENT' => $arRes['UF_DEPARTMENT'][0], 'URL' => str_replace(array('#ID#', '#USER_ID#'), $arRes[$prefix . 'ID'], $this->path_user), 'TOTAL' => 0, 'TOTAL_DAYS' => 0, 'TOTAL_VIOLATIONS' => 0, 'TOTAL_INACTIVE' => 0, 'SETTINGS' => array(), 'ENTRIES' => array());
     $TMUSER = new CTimeManUser($arRes[$prefix . 'ID']);
     $res['SETTINGS'] = $TMUSER->GetSettings();
     unset($res['SETTINGS']['UF_TM_REPORT_TPL']);
     return $res;
 }
Exemplo n.º 2
0
             $res = array('ID' => $ID, 'SETTINGS' => CTimeMan::GetSectionPersonalSettings($ID, true, $arNeededSettings), 'SETTINGS_ALL' => CTimeMan::GetSectionSettings($ID, $arNeededSettings));
         } else {
             $obUser = new CUser();
             $obUser->Update($ID, $arFields);
             $CACHE_MANAGER->CleanDir("timeman_structure_" . COption::GetOptionInt('intranet', 'iblock_structure'));
             $TMUSER = new CTimeManUser($ID);
             $res = array('ID' => $ID, 'SETTINGS' => $TMUSER->GetPersonalSettings($arNeededSettings), 'SETTINGS_ALL' => $TMUSER->GetSettings($arNeededSettings));
         }
     } else {
         $res = array('DEFAULTS' => CTimeMan::GetModuleSettings($arNeededSettings), 'DEPARTMENTS' => array(), 'USERS' => array());
         foreach ($_REQUEST['DEPARTMENTS'] as $dpt) {
             $res['DEPARTMENTS'][] = array('ID' => $dpt, 'SETTINGS' => CTimeMan::GetSectionPersonalSettings($dpt, true, $arNeededSettings), 'SETTINGS_ALL' => CTimeMan::GetSectionSettings($dpt, $arNeededSettings));
         }
         foreach ($_REQUEST['USERS'] as $user) {
             $TMUSER = new CTimeManUser($user);
             $res['USERS'][] = array('ID' => $user, 'SETTINGS' => $TMUSER->GetPersonalSettings($arNeededSettings), 'SETTINGS_ALL' => $TMUSER->GetSettings($arNeededSettings));
         }
     }
     break;
 case 'admin_data':
     $obReport = new CTimeManAdminReport(array('show_all' => $_REQUEST['show_all'] == 'Y', 'ts' => $_REQUEST['ts'], 'page' => $_REQUEST['page'], 'amount' => 30, 'department' => $_REQUEST['department'], 'path_user' => COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $site_id), 'nav_handler' => 'window.BXTMREPORT.Page'));
     $bReturnRes = true;
     $res = $obReport->GetData();
     \Bitrix\Main\Type\Collection::sortByColumn($res['USERS'], array('HEAD' => SORT_DESC, 'NAME' => SORT_ASC));
     $res['DEPARTMENTS'] = array_values($res['DEPARTMENTS']);
     break;
 case 'admin_save':
     $ID = intval($_REQUEST['ID']);
     $arEntry = null;
     if (CTimeManEntry::Approve($ID, true)) {
         if ($_REQUEST['INFO']) {
Exemplo n.º 3
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;
 }