diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-25 21:28:29 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-25 21:28:29 -0500 |
commit | 5fb686dd9c5474aba3e274bbe7917e8259aa27e3 (patch) | |
tree | 7e9b8ad9b34a1410fe96c5c1fde1ed2db8aef7d6 /app/Controller/Comment.php | |
parent | cdfd6a8abefa6cbea2dbae9e7f758914f7fb465e (diff) |
Move comment templates to a subfolder
Diffstat (limited to 'app/Controller/Comment.php')
-rw-r--r-- | app/Controller/Comment.php | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index efa7e066..fb21353e 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -25,7 +25,7 @@ class Comment extends Base } if (! $this->acl->isAdminUser() && $comment['user_id'] != $this->acl->getUserId()) { - $this->response->html($this->template->layout('comment_forbidden', array( + $this->response->html($this->template->layout('comment/forbidden', array( 'title' => t('Access Forbidden') ))); } @@ -38,16 +38,20 @@ class Comment extends Base * * @access public */ - public function create() + public function create(array $values = array(), array $errors = array()) { $task = $this->getTask(); - $this->response->html($this->taskLayout('comment_create', array( - 'values' => array( + if (empty($values)) { + $values = array( 'user_id' => $this->acl->getUserId(), 'task_id' => $task['id'], - ), - 'errors' => array(), + ); + } + + $this->response->html($this->taskLayout('comment/create', array( + 'values' => $values, + 'errors' => $errors, 'task' => $task, 'title' => t('Add a comment') ))); @@ -77,12 +81,7 @@ class Comment extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comments'); } - $this->response->html($this->taskLayout('comment_create', array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'title' => t('Add a comment') - ))); + $this->create($values, $errors); } /** @@ -90,14 +89,14 @@ class Comment extends Base * * @access public */ - public function edit() + public function edit(array $values = array(), array $errors = array()) { $task = $this->getTask(); $comment = $this->getComment(); - $this->response->html($this->taskLayout('comment_edit', array( - 'values' => $comment, - 'errors' => array(), + $this->response->html($this->taskLayout('comment/edit', array( + 'values' => empty($values) ? $comment : $values, + 'errors' => $errors, 'comment' => $comment, 'task' => $task, 'title' => t('Edit a comment') @@ -129,13 +128,7 @@ class Comment extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#comment-'.$comment['id']); } - $this->response->html($this->taskLayout('comment_edit', array( - 'values' => $values, - 'errors' => $errors, - 'comment' => $comment, - 'task' => $task, - 'title' => t('Edit a comment') - ))); + $this->edit($values, $errors); } /** @@ -148,7 +141,7 @@ class Comment extends Base $task = $this->getTask(); $comment = $this->getComment(); - $this->response->html($this->taskLayout('comment_remove', array( + $this->response->html($this->taskLayout('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') |