From 060b8865a4701cfe400e424765031c219330fa1a Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sat, 21 Jul 2012 00:45:13 +0200 Subject: DRY for getting calendar timezone setting --- apps/calendar/lib/app.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'apps/calendar/lib/app.php') diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 1a13f2958c0..29e5ab5b0c8 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -9,7 +9,7 @@ * This class manages our app actions */ OC_Calendar_App::$l10n = new OC_L10N('calendar'); -OC_Calendar_App::$tz = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +OC_Calendar_App::$tz = OC_Calendar_App::getTimezone(); class OC_Calendar_App{ const CALENDAR = 'calendar'; const EVENT = 'event'; @@ -282,7 +282,17 @@ class OC_Calendar_App{ public static function getWeekofMonth(){ return OC_Calendar_Object::getWeekofMonth(self::$l10n); } - + + /** + * @return (string) $timezone as set by user or the default timezone + */ + public static function getTimezone() { + return OCP\Config::getUserValue(OCP\User::getUser(), + 'calendar', + 'timezone', + date_default_timezone_get()); + } + /** * @brief checks the access for a calendar / an event * @param (int) $id - id of the calendar / event -- cgit v1.2.3