public static function setOccurAsUserId($userId = 'get key') { static $key = null; if ($key === null) { $key = 'occurAs_key:' . md5(mt_rand(1000, 999999) . '-' . mt_rand(1000, 999999)); if ($userId !== 'get key') { CTasksPerHitOption::set('tasks', $key, false); } } if ($userId !== 'get key') { CTaskAssert::assertLaxIntegers($userId); $userId = (int) $userId; /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $rs = CUser::getById($userId); if (!($rs && $rs->fetch())) { throw new TasksException('User not found', TasksException::TE_ITEM_NOT_FOUND_OR_NOT_ACCESSIBLE); } CTasksPerHitOption::set('tasks', $key, $userId); } return $key; }
return; } $arParams["PATH_TO_USER_TASKS_TASK"] = isset($arParams["PATH_TO_USER_TASKS_TASK"]) ? trim($arParams["PATH_TO_USER_TASKS_TASK"]) : ""; if (strlen($arParams["PATH_TO_USER_TASKS_TASK"]) <= 0) { $arParams["PATH_TO_USER_TASKS_TASK"] = COption::GetOptionString("tasks", "paths_task_user_action", null, SITE_ID); } $arParams["USER_ID"] = $USER->GetID(); $arParams["PATH_TO_TASKS"] = str_replace("#user_id#", $arParams["USER_ID"], $arParams["PATH_TO_USER_TASKS_TASK"]); // Mark that we are called not first at this hit. Template will skip some work in this case. $arResult['FIRST_RUN_AT_HIT'] = true; $arParams['ALLOW_NOT_FIRST_RUN_OPTIMIZATION'] = isset($arParams['ALLOW_NOT_FIRST_RUN_OPTIMIZATION']) ? $arParams['ALLOW_NOT_FIRST_RUN_OPTIMIZATION'] : 'Y'; $bAlreadyRun = CTasksPerHitOption::get('tasks', 'componentTaskIframePopupAlreadyRunned'); if ($bAlreadyRun) { $arResult['FIRST_RUN_AT_HIT'] = false; } else { CTasksPerHitOption::set('tasks', 'componentTaskIframePopupAlreadyRunned', true); } $arResult['OPTIMIZE_REPEATED_RUN'] = false; if ($arParams['ALLOW_NOT_FIRST_RUN_OPTIMIZATION'] === 'Y') { // If it isn't first run => optimize if ($arResult['FIRST_RUN_AT_HIT'] === false) { $arResult['OPTIMIZE_REPEATED_RUN'] = true; } } $arResult['COMPANY_WORKTIME'] = array('START' => array('H' => 9, 'M' => 0, 'S' => 0), 'END' => array('H' => 19, 'M' => 0, 'S' => 0)); if (CModule::IncludeModule('calendar')) { $calendarSettings = CCalendar::GetSettings(array('getDefaultForEmpty' => false)); $time = explode('.', (string) $calendarSettings['work_time_start']); if (intval($time[0])) { $arResult['COMPANY_WORKTIME']['START']['H'] = intval($time[0]); }