Added basic comments on tasks

This commit is contained in:
rzeka
2014-03-04 20:17:26 +01:00
parent 86bee36784
commit ccc54c65cf
8 changed files with 128 additions and 4 deletions

View File

@@ -45,17 +45,45 @@ class Task extends Base
$task = $this->task->getById($this->request->getIntegerParam('task_id'), true);
if (! $task) $this->notfound();
$this->checkProjectPermissions($task['project_id']);
$values = $values = $this->request->getValues();
$errors = $this->comment($values, $task['id']);
$comments = $this->task->getCommentsByTask($task['id']);
$this->response->html($this->template->layout('task_show', array(
'task' => $task,
'columns_list' => $this->board->getColumnsList($task['project_id']),
'colors_list' => $this->task->getColors(),
'menu' => 'tasks',
'title' => $task['title']
'title' => $task['title'],
'comments' => $comments,
'errors' => $errors,
'values' => $values
)));
}
//add a comment
public function comment(array $values, $task_id)
{
$errors = array();
if ($_POST) {
list($valid, $errors) = $this->task->validateComment($values);
if ($valid) {
$this->task->addComment(array(
'task_id' => $task_id,
'comment' => $values['comment'],
'user_id' => $this->acl->getUserId()
));
}
}
return $errors;
}
// Display a form to create a new task
public function create()
{