diff options
Diffstat (limited to 'apps/calendar/index.php')
-rw-r--r-- | apps/calendar/index.php | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 8b8ac729588..3313750d52e 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -10,15 +10,36 @@ require_once ('../../lib/base.php'); OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('calendar'); // Create default calendar ... -$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); if( count($calendars) == 0){ OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'Default calendar'); - $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); + $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); } -OC_UTIL::addScript('calendar', 'calendar'); -OC_UTIL::addStyle('calendar', 'style'); -OC_UTIL::addScript('', 'jquery.multiselect'); -OC_UTIL::addStyle('', 'jquery.multiselect'); -OC_APP::setActiveNavigationEntry('calendar_index'); -$output = new OC_TEMPLATE('calendar', 'calendar', 'user'); -$output -> printPage(); +$eventSources = array(); +foreach($calendars as $calendar){ + $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar); +} +//Fix currentview for fullcalendar +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "agendaWeek"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "list"); +} + +OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); +OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); +if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null){ + OC_UTIL::addScript('calendar', 'geo'); +} +OC_Util::addScript('calendar', 'calendar'); +OC_Util::addStyle('calendar', 'style'); +OC_Util::addScript('', 'jquery.multiselect'); +OC_Util::addStyle('', 'jquery.multiselect'); +OC_App::setActiveNavigationEntry('calendar_index'); +$tmpl = new OC_Template('calendar', 'calendar', 'user'); +$tmpl->assign('eventSources', $eventSources); +$tmpl->printPage();
\ No newline at end of file |