* @package entries * @version 1 * @link https://www.zentao.net */ class taskStartEntry extends entry { /** * POST method. * * @param int $taskID * @access public * @return string */ public function post($taskID) { $control = $this->loadController('task', 'start'); $task = $this->loadModel('task')->getByID($taskID); $fields = 'assignedTo,consumed,left,comment'; $this->batchSetPost($fields); $this->setPost('realStarted', $this->request('realStarted', helper::now())); $control->start($taskID); $data = $this->getData(); if(!$data) return $this->send400('error'); if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); $task = $this->loadModel('task')->getByID($taskID); return $this->send(200, $task); } }