From d634a53e9c2c9b5c4dac6c701557f6b69dc06213 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 8 Feb 2015 17:37:13 -0500 Subject: Update moment.js and add timezone in template --- app/Core/Helper.php | 11 +++++++++++ app/Model/Config.php | 22 ++++++++++++++++------ app/Model/TaskFilter.php | 1 + app/Template/layout.php | 6 +++++- 4 files changed, 33 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/Core/Helper.php b/app/Core/Helper.php index c3ffe95a..9bbaea57 100644 --- a/app/Core/Helper.php +++ b/app/Core/Helper.php @@ -610,6 +610,17 @@ class Helper return $this->config->getJsLanguageCode(); } + /** + * Get current timezone + * + * @access public + * @return string + */ + public function getTimezone() + { + return $this->config->getCurrentTimezone(); + } + /** * Get the link to toggle subtask status * diff --git a/app/Model/Config.php b/app/Model/Config.php index 542cedf7..48640f4e 100644 --- a/app/Model/Config.php +++ b/app/Model/Config.php @@ -202,18 +202,28 @@ class Config extends Base } /** - * Set timezone + * Get current timezone * * @access public + * @return string */ - public function setupTimezone() + public function getCurrentTimezone() { if ($this->userSession->isLogged() && ! empty($this->session['user']['timezone'])) { - date_default_timezone_set($this->session['user']['timezone']); - } - else { - date_default_timezone_set($this->get('application_timezone', 'UTC')); + return $this->session['user']['timezone']; } + + return $this->get('application_timezone', 'UTC'); + } + + /** + * Set timezone + * + * @access public + */ + public function setupTimezone() + { + date_default_timezone_set($this->getCurrentTimezone()); } /** diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index eac90aab..b5a90154 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -100,6 +100,7 @@ class TaskFilter extends Base foreach ($this->query->findAll() as $task) { $events[] = array( + 'timezoneParam' => $this->config->getCurrentTimezone(), 'id' => $task['id'], 'title' => t('#%d', $task['id']).' '.$task['title'], 'start' => date('Y-m-d', $task['date_due']), diff --git a/app/Template/layout.php b/app/Template/layout.php index 0e44569e..9e85e9ae 100644 --- a/app/Template/layout.php +++ b/app/Template/layout.php @@ -25,7 +25,11 @@ <?= isset($title) ? $this->e($title) : 'Kanboard' ?> - + + -- cgit v1.2.3