@@ 267-283 (lines=17) @@ | ||
264 | /** |
|
265 | * Save new task start date and due date. |
|
266 | */ |
|
267 | public function set_date() |
|
268 | { |
|
269 | $this->getProject(); |
|
270 | $values = $this->request->getJson(); |
|
271 | ||
272 | $result = $this->taskModel->update([ |
|
273 | 'id' => $values['id'], |
|
274 | 'date_started' => strtotime($values['start']), |
|
275 | 'date_due' => strtotime($values['end']), |
|
276 | ]); |
|
277 | ||
278 | if (!$result) { |
|
279 | $this->response->json(['message' => 'Unable to save task'], 400); |
|
280 | } else { |
|
281 | $this->response->json(['message' => 'OK'], 201); |
|
282 | } |
|
283 | } |
|
284 | ||
285 | /** |
|
286 | * Display a form to edit a task. |
@@ 164-179 (lines=16) @@ | ||
161 | /** |
|
162 | * Update new project start date and end date. |
|
163 | */ |
|
164 | public function updateDate() |
|
165 | { |
|
166 | $values = $this->request->getJson(); |
|
167 | ||
168 | $result = $this->projectModel->update([ |
|
169 | 'id' => $values['id'], |
|
170 | 'start_date' => $this->dateParser->getIsoDate(strtotime($values['start'])), |
|
171 | 'end_date' => $this->dateParser->getIsoDate(strtotime($values['end'])), |
|
172 | ]); |
|
173 | ||
174 | if (!$result) { |
|
175 | $this->response->json(['message' => 'Unable to save project'], 400); |
|
176 | } else { |
|
177 | $this->response->json(['message' => 'OK'], 201); |
|
178 | } |
|
179 | } |
|
180 | ||
181 | /** |
|
182 | * Create or duplicate a project. |