From 55ee906ba36cf66c3a390c98dde75e241de26e65 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 7 May 2016 18:05:33 -0400 Subject: Added support for language LDAP attribute --- app/Model/Timezone.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/Model/Timezone.php (limited to 'app/Model/Timezone.php') diff --git a/app/Model/Timezone.php b/app/Model/Timezone.php new file mode 100644 index 00000000..c6b33736 --- /dev/null +++ b/app/Model/Timezone.php @@ -0,0 +1,56 @@ + t('Application default')) + $listing; + } + + return $listing; + } + + /** + * Get current timezone + * + * @access public + * @return string + */ + public function getCurrentTimezone() + { + if ($this->userSession->isLogged() && ! empty($this->sessionStorage->user['timezone'])) { + return $this->sessionStorage->user['timezone']; + } + + return $this->config->get('application_timezone', 'UTC'); + } + + /** + * Set timezone + * + * @access public + */ + public function setCurrentTimezone() + { + date_default_timezone_set($this->getCurrentTimezone()); + } +} -- cgit v1.2.3