protected function loadTaskData($userId) { if ($this->taskPostData === null) { try { $task = new \CTaskItem($this->entityId, $userId); $this->taskPostData = $task->getData(false); } catch (\TasksException $e) { return array(); } } return $this->taskPostData; }
/** * Get a task */ public function get($id) { global $USER; $result = array(); if ($id = $this->checkTaskId($id)) { $task = new \CTaskItem($id, $USER->GetId()); $id = $task->getId(); $data = $task->getData(false); $result['DATA']['TASK'][$id] = $data; $result['CAN']['TASK'][$id]['ACTION'] = static::translateAllowedActionNames($task->getAllowedActions()); } return $result; }
private function loadTaskData() { if ($this->taskPostData === null) { try { if (Loader::includeModule("tasks")) { $task = new \CTaskItem($this->getId(), $this->getUser()->getId()); $this->taskPostData = $task->getData(false); } else { return array(); } } catch (\TasksException $e) { return array(); } } return $this->taskPostData; }
/** * Add rights for reading files by given users. * @deprecated */ private static function addFilesRights($taskId, $arFilesIds) { $arFilesIds = array_unique(array_filter($arFilesIds)); // Nothing to do? if (empty($arFilesIds)) { return; } if (!CModule::IncludeModule('webdav')) { return; } $arRightsTasks = CWebDavIblock::GetTasks(); // tasks-operations $oTask = new CTaskItem((int) $taskId, 1); $arTask = $oTask->getData(false); $arTaskMembers = array_unique(array_merge(array($arTask['CREATED_BY'], $arTask['RESPONSIBLE_ID']), $arTask['AUDITORS'], $arTask['ACCOMPLICES'])); $ibe = new CIBlockElement(); $dbWDFile = $ibe->GetList(array(), array('ID' => $arFilesIds, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'NAME', 'SECTION_ID', 'IBLOCK_ID', 'WF_NEW')); if ($dbWDFile) { $i = 0; $arRightsForTaskMembers = array(); foreach ($arTaskMembers as $userId) { // For intranet users and their managers $arRightsForTaskMembers['n' . $i++] = array('GROUP_CODE' => 'IU' . $userId, 'TASK_ID' => $arRightsTasks['R']); // For extranet users $arRightsForTaskMembers['n' . $i++] = array('GROUP_CODE' => 'U' . $userId, 'TASK_ID' => $arRightsTasks['R']); } $iNext = $i; while ($arWDFile = $dbWDFile->Fetch()) { if (!$arWDFile['IBLOCK_ID']) { continue; } $fileId = $arWDFile['ID']; if (CIBlock::GetArrayByID($arWDFile['IBLOCK_ID'], "RIGHTS_MODE") === "E") { $ibRights = new CIBlockElementRights($arWDFile['IBLOCK_ID'], $fileId); $arCurRightsRaw = $ibRights->getRights(); // Preserve existing rights $i = $iNext; $arRights = $arRightsForTaskMembers; foreach ($arCurRightsRaw as $arRightsData) { $arRights['n' . $i++] = array('GROUP_CODE' => $arRightsData['GROUP_CODE'], 'TASK_ID' => $arRightsData['TASK_ID']); } $ibRights->setRights($arRights); } } } }
$arParams["PATH_TO_TASKS"] = str_replace("#group_id#", $arParams["GROUP_ID"], $arParams["PATH_TO_GROUP_TASKS"]); $arParams["PATH_TO_TASKS_TASK"] = str_replace("#group_id#", $arParams["GROUP_ID"], $arParams["PATH_TO_GROUP_TASKS_TASK"]); $arResult["GROUP"] = CSocNetGroup::GetByID($arParams["GROUP_ID"]); if (!$arResult["GROUP"]) { return; } } if (!$arResult["USER"]) { $rsUser = CUser::GetByID($loggedInUserId); $arResult["USER"] = $rsUser->GetNext(); } $arResult['MAX_UPLOAD_FILES_IN_COMMENTS'] = (int) COption::GetOptionString('tasks', 'MAX_UPLOAD_FILES_IN_COMMENTS'); $arTask = null; try { $oTask = new CTaskItem($arParams['TASK_ID'], $loggedInUserId); $arTask = $oTask->getData(); $arTask['~TAGS'] = $oTask->getTags(); $arTask['~FILES'] = $arTask['FILES'] = $oTask->getFiles(); $arTask['~DEPENDS_ON'] = $arTask['DEPENDS_ON'] = $oTask->getDependsOn(); $arTask['TAGS'] = array_map('htmlspecialcharsbx', $arTask['~TAGS']); // Get the fact FORUM_ID from task if ($arTask['FORUM_ID'] >= 1) { $arResult['FORUM_ID'] = $arTask['FORUM_ID']; } } catch (Exception $e) { $arTask = null; } if (isset($_REQUEST["ACTION"]) && check_bitrix_sessid()) { if ($arTask) { $action = $_REQUEST['ACTION']; $taskID = $arTask["ID"];