From 12a688347ce9374e060f4adb98af3892542285d4 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 16 Sep 2014 13:25:44 +0200 Subject: Improve Board::Index() and avoid useless HTTP redirects --- app/Model/User.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'app/Model') diff --git a/app/Model/User.php b/app/Model/User.php index b99be2cb..9eccb207 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -27,6 +27,39 @@ class User extends Base */ const EVERYBODY_ID = -1; + /** + * Get the default project from the session + * + * @access public + * @return integer + */ + public function getFavoriteProjectId() + { + return isset($_SESSION['user']['default_project_id']) ? $_SESSION['user']['default_project_id'] : 0; + } + + /** + * Get the last seen project from the session + * + * @access public + * @return integer + */ + public function getLastSeenProject() + { + return empty($_SESSION['user']['last_show_project_id']) ? 0 : $_SESSION['user']['last_show_project_id']; + } + + /** + * Set the last seen project from the session + * + * @access public + * @@param integer $project_id Project id + */ + public function storeLastSeenProject($project_id) + { + $_SESSION['user']['last_show_project_id'] = (int) $project_id; + } + /** * Get a specific user by id * -- cgit v1.2.3