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/Model/Config.php | 22 ++++++++++++++++------ app/Model/TaskFilter.php | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'app/Model') 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']), -- cgit v1.2.3