diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Comment.php | 5 | ||||
-rw-r--r-- | app/Model/Notification.php | 4 | ||||
-rw-r--r-- | app/Model/UserSession.php | 22 |
3 files changed, 27 insertions, 4 deletions
diff --git a/app/Model/Comment.php b/app/Model/Comment.php index e3ffc1be..c1c800c3 100644 --- a/app/Model/Comment.php +++ b/app/Model/Comment.php @@ -34,9 +34,10 @@ class Comment extends Base * * @access public * @param integer $task_id Task id + * @param string $sorting ASC/DESC * @return array */ - public function getAll($task_id) + public function getAll($task_id, $sorting = 'ASC') { return $this->db ->table(self::TABLE) @@ -51,7 +52,7 @@ class Comment extends Base User::TABLE.'.email' ) ->join(User::TABLE, 'id', 'user_id') - ->orderBy(self::TABLE.'.date_creation', 'ASC') + ->orderBy(self::TABLE.'.date_creation', $sorting) ->eq(self::TABLE.'.task_id', $task_id) ->findAll(); } diff --git a/app/Model/Notification.php b/app/Model/Notification.php index dbd60a2f..525e7f13 100644 --- a/app/Model/Notification.php +++ b/app/Model/Notification.php @@ -113,7 +113,7 @@ class Notification extends Base */ public function saveSettings($user_id, array $values) { - // $this->db->startTransaction(); + $this->db->startTransaction(); if (isset($values['notifications_enabled']) && $values['notifications_enabled'] == 1) { $this->enableNotification($user_id); @@ -130,7 +130,7 @@ class Notification extends Base $this->disableNotification($user_id); } - // $this->db->closeTransaction(); + $this->db->closeTransaction(); } /** diff --git a/app/Model/UserSession.php b/app/Model/UserSession.php index 1ae3fdf4..4c0364ce 100644 --- a/app/Model/UserSession.php +++ b/app/Model/UserSession.php @@ -154,4 +154,26 @@ class UserSession extends Base { $_SESSION['board_collapsed'][$project_id] = $collapsed; } + + /** + * Set comments sorting + * + * @access public + * @param string $order + */ + public function setCommentSorting($order) + { + $this->session['comment_sorting'] = $order; + } + + /** + * Get comments sorting direction + * + * @access public + * @return string + */ + public function getCommentSorting() + { + return $this->session['comment_sorting'] ?: 'ASC'; + } } |