Пример #1
0
 /**
  * This method is deprecated. Use CTaskItem class instead.
  * @deprecated
  */
 public static function GetByID($ID, $bCheckPermissions = true, $arParams = array())
 {
     $bReturnAsArray = false;
     $bSkipExtraData = false;
     $arGetListParams = array();
     if (isset($arParams['returnAsArray'])) {
         $bReturnAsArray = $arParams['returnAsArray'] === true;
     }
     if (isset($arParams['bSkipExtraData'])) {
         $bSkipExtraData = $arParams['bSkipExtraData'] === true;
     }
     if (isset($arParams['USER_ID'])) {
         $arGetListParams['USER_ID'] = $arParams['USER_ID'];
     }
     $arFilter = array("ID" => (int) $ID);
     if (!$bCheckPermissions) {
         $arFilter["CHECK_PERMISSIONS"] = "N";
     }
     $res = CTasks::GetList(array(), $arFilter, array("*", "UF_*"), $arGetListParams);
     if ($res && ($task = $res->Fetch())) {
         $task["ACCOMPLICES"] = $task["AUDITORS"] = array();
         $rsMembers = CTaskMembers::GetList(array(), array("TASK_ID" => $ID));
         while ($arMember = $rsMembers->Fetch()) {
             if ($arMember["TYPE"] == "A") {
                 $task["ACCOMPLICES"][] = $arMember["USER_ID"];
             } elseif ($arMember["TYPE"] == "U") {
                 $task["AUDITORS"][] = $arMember["USER_ID"];
             }
         }
         if (!$bSkipExtraData) {
             $arTagsFilter = array("TASK_ID" => $ID);
             $arTagsOrder = array("NAME" => "ASC");
             $rsTags = CTaskTags::GetList($arTagsOrder, $arTagsFilter);
             $task["TAGS"] = array();
             while ($arTag = $rsTags->Fetch()) {
                 $task["TAGS"][] = $arTag["NAME"];
             }
             $rsFiles = CTaskFiles::GetList(array(), array("TASK_ID" => $ID));
             $task["FILES"] = array();
             while ($arFile = $rsFiles->Fetch()) {
                 $task["FILES"][] = $arFile["FILE_ID"];
             }
             $rsDependsOn = CTaskDependence::GetList(array(), array("TASK_ID" => $ID));
             $task["DEPENDS_ON"] = array();
             while ($arDependsOn = $rsDependsOn->Fetch()) {
                 $task["DEPENDS_ON"][] = $arDependsOn["DEPENDS_ON_ID"];
             }
         }
         if ($bReturnAsArray) {
             return $task;
         } else {
             $rsTask = new CDBResult();
             $rsTask->InitFromarray(array($task));
             return $rsTask;
         }
     } else {
         if ($bReturnAsArray) {
             return false;
         } else {
             return $res;
         }
     }
 }
Пример #2
0
 /**
  * Get id of tasks that current task depends on
  */
 public function getDependsOn()
 {
     // ensure we have access to the task
     $this->checkCanReadThrowException();
     if ($this->arTaskDependsOn === null) {
         $rsDependsOn = CTaskDependence::GetList(array(), array('TASK_ID' => $this->taskId));
         $arTaskDependsOn = array();
         while ($arDependsOn = $rsDependsOn->fetch()) {
             $arTaskDependsOn[] = $arDependsOn['DEPENDS_ON_ID'];
         }
         $this->arTaskDependsOn = $arTaskDependsOn;
     }
     return $this->arTaskDependsOn;
 }
Пример #3
0
 /**
  * Get id of tasks that current task depends on
  */
 public function getDependsOn()
 {
     if ($this->arTaskDependsOn === null) {
         $rsDependsOn = CTaskDependence::GetList(array(), array('TASK_ID' => $this->taskId));
         $arTaskDependsOn = array();
         while ($arDependsOn = $rsDependsOn->fetch()) {
             $arTaskDependsOn[] = $arDependsOn['DEPENDS_ON_ID'];
         }
         $this->arTaskDependsOn = $arTaskDependsOn;
     }
     return $this->arTaskDependsOn;
 }