diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Core/Helper.php | 11 | ||||
-rw-r--r-- | app/Model/Config.php | 22 | ||||
-rw-r--r-- | app/Model/TaskFilter.php | 1 | ||||
-rw-r--r-- | app/Template/layout.php | 6 |
4 files changed, 33 insertions, 7 deletions
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 @@ -611,6 +611,17 @@ class Helper } /** + * Get current timezone + * + * @access public + * @return string + */ + public function getTimezone() + { + return $this->config->getCurrentTimezone(); + } + + /** * Get the link to toggle subtask status * * @access public 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 @@ <title><?= isset($title) ? $this->e($title) : 'Kanboard' ?></title> </head> - <body data-status-url="<?= $this->u('app', 'status') ?>" data-login-url="<?= $this->u('user', 'login') ?>" data-js-lang="<?= $this->jsLang() ?>"> + <body data-status-url="<?= $this->u('app', 'status') ?>" + data-login-url="<?= $this->u('user', 'login') ?>" + data-timezone="<?= $this->getTimezone() ?>" + data-js-lang="<?= $this->jsLang() ?>"> + <?php if (isset($no_layout) && $no_layout): ?> <?= $content_for_layout ?> <?php else: ?> |