Beispiel #1
0
        COption::SetOptionString($module_id, 'SUBORDINATE_ACCESS', serialize($SUBORDINATE_ACCESS));
    }
    if (strlen($Update) > 0 && strlen($_REQUEST["back_url_settings"]) > 0) {
        LocalRedirect($_REQUEST["back_url_settings"]);
    } else {
        LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($mid) . "&lang=" . urlencode(LANGUAGE_ID) . "&back_url_settings=" . urlencode($_REQUEST["back_url_settings"]) . "&" . $tabControl->ActiveTabParam());
    }
}
foreach ($arAllModuleOptions as $tab => $arTabOptions) {
    foreach ($arTabOptions as $key => $arOptDef) {
        $value = '';
        switch ($arOptDef[1]) {
            case 'time':
                $value = COption::GetOptionInt($module_id, $key, $arOptDef[2]);
                if ($arOptDef[3] == 'clock') {
                    $value = CTimeMan::FormatTimeOut($value);
                } else {
                    $value = CTimeMan::FormatTime($value, true);
                }
                break;
            case 'int':
                $value = COption::GetOptionInt($module_id, $key, $arOptDef[2]);
                break;
            default:
                $value = COption::GetOptionString($module_id, $key, $arOptDef[2]);
                break;
        }
        $arAllModuleOptions[$tab][$key][0] = $value;
    }
}
$workday_can_edit_current = COption::GetOptionString($module_id, 'workday_can_edit_current', 'Y');
Beispiel #2
0
 public function OpenDay($timestamp = false, $report = '')
 {
     global $APPLICATION;
     if ($this->OpenAction() !== 'OPEN') {
         return false;
     }
     if ($timestamp <= 0) {
         $timestamp = false;
     } else {
         if ($timestamp > COption::GetOptionInt('timeman', 'workday_min_finish', 64800) && $_SESSION['TM_LAST_TIME_OPEN'] != $timestamp) {
             $_SESSION['TM_LAST_TIME_OPEN'] = $timestamp;
             $APPLICATION->ThrowException(str_replace('#TIME#', CTimeMan::FormatTimeOut($timestamp), GetMessage('TM_CONFIRM_LATE_OPEN')), 'REPORT_NEEDED');
             return false;
         }
         unset($_SESSION['TM_LAST_TIME_OPEN']);
         $timestamp = CTimeMan::ConvertShortTS($timestamp - CTimeZone::GetOffset());
     }
     $arFields = array('USER_ID' => $this->USER_ID, 'DATE_START' => ConvertTimeStamp(($timestamp ? $timestamp : time()) + CTimeZone::GetOffset(), 'FULL'));
     if ($this->isEntryValid('OPEN', $timestamp)) {
         $arFields['ACTIVE'] = 'Y';
     } else {
         $arFields['ACTIVE'] = 'N';
         if (strlen($report) > 0) {
             $arFields['REPORTS'] = array();
             if ($ex = $APPLICATION->GetException()) {
                 $arFields['REPORTS'][] = array('REPORT_TYPE' => 'ERR_OPEN', 'REPORT' => $ex->GetId() . ';' . date('c') . ';' . $ex->GetString());
             }
             $arFields['REPORTS'][] = array('REPORT_TYPE' => 'REPORT_OPEN', 'REPORT' => $report);
         } else {
             if ($ex = $APPLICATION->GetException()) {
                 $APPLICATION->ThrowException($ex->GetString(), 'REPORT_NEEDED');
             }
             return false;
         }
     }
     if (($last_entry = $this->_GetLastData()) && $last_entry['TASKS']) {
         $arTasks = $this->GetTasks($last_entry['TASKS'], true);
         $arFields['TASKS'] = array();
         foreach ($arTasks as $task) {
             $arFields['TASKS'][] = $task['ID'];
         }
     }
     $arFields['IP_OPEN'] = $_SERVER['REMOTE_ADDR'];
     $ENTRY_ID = CTimeManEntry::Add($arFields);
     if ($ENTRY_ID > 0) {
         $APPLICATION->ResetException();
         unset($_SESSION['BX_TIMEMAN_LAST_PAUSE_' . $this->USER_ID]);
         if (isset($arFields['ACTIVE']) && $arFields['ACTIVE'] == 'N') {
             CTimeManNotify::SendMessage($ENTRY_ID);
         }
         $data = $this->_GetLastData(true);
         $e = GetModuleEvents('timeman', 'OnAfterTMDayStart');
         while ($a = $e->Fetch()) {
             ExecuteModuleEventEx($a, array($data));
         }
         return $data;
     }
     return false;
 }