/** * Update an elapsed time record */ public function update($id, array $data, array $parameters = array()) { global $USER; $result = array(); $mgrResult = array(); if ($id = $this->checkId($id)) { $taskId = $this->getOwnerTaskId($id); if ($taskId) { $mgrResult = Manager\Task\ElapsedTime::update($USER->GetId(), $taskId, $id, $data, array('PUBLIC_MODE' => true, 'ERRORS' => $this->errors)); } } return array('DATA' => $mgrResult['DATA'], 'CAN' => $mgrResult['CAN']); }
public static function get($userId, $taskId, array $parameters) { $errors = static::ensureHaveErrorCollection($parameters); list($data, $can) = static::getBasic($userId, $taskId, $parameters); // select sub-entity related data if (!is_array($parameters['GET_PARAMETERS']['ENTITY_SELECT'])) { $parameters['GET_PARAMETERS']['ENTITY_SELECT'] = array('CHECKLIST', 'REMINDER', 'ELAPSEDTIME', 'LOG', 'TAG'); } $entitySelect = array_flip($parameters['GET_PARAMETERS']['ENTITY_SELECT']); if (isset($entitySelect['TAG'])) { $mgrResult = Task\Tag::getList($userId, $taskId); $data[static::SE_PREFIX . 'TAG'] = $mgrResult['DATA']; if (!empty($mgrResult['CAN'])) { $can[static::SE_PREFIX . 'TAG'] = $mgrResult['CAN']; } } if (isset($entitySelect['CHECKLIST'])) { $mgrResult = Task\CheckList::getList($userId, $taskId, $parameters); $data[static::SE_PREFIX . 'CHECKLIST'] = $mgrResult['DATA']; if (!empty($mgrResult['CAN'])) { $can[static::SE_PREFIX . 'CHECKLIST'] = $mgrResult['CAN']; } } if (isset($entitySelect['REMINDER'])) { $mgrResult = Task\Reminder::getList($userId, $taskId, $parameters); $data[static::SE_PREFIX . 'REMINDER'] = $mgrResult['DATA']; if (!empty($mgrResult['CAN'])) { $can[static::SE_PREFIX . 'REMINDER'] = $mgrResult['CAN']; } } if (isset($entitySelect['LOG'])) { $mgrResult = Task\Log::getList($userId, $taskId, $parameters); $data[static::SE_PREFIX . 'LOG'] = $mgrResult['DATA']; if (!empty($mgrResult['CAN'])) { $can[static::SE_PREFIX . 'LOG'] = $mgrResult['CAN']; } } if (isset($entitySelect['ELAPSEDTIME'])) { $mgrResult = Task\ElapsedTime::getList($userId, $taskId, $parameters); $data[static::SE_PREFIX . 'ELAPSEDTIME'] = $mgrResult['DATA']; if (!empty($mgrResult['CAN'])) { $can[static::SE_PREFIX . 'ELAPSEDTIME'] = $mgrResult['CAN']; } } // load ingoing and outgoing dependences separately here //static::injectIngoingDependenceFields($parameters, $mgrResult['DATA'], $mgrResult['CAN']); $subData = array($data['ID'] => &$data); $subCan = array($data['ID'] => &$can); static::injectTimemanFields($userId, $parameters, $subData, $subCan); return array('DATA' => $data, 'CAN' => $can, 'ERRORS' => $errors); }