nextcloud/apps/calendar/index.php

43 lines
1.8 KiB
PHP
Raw Normal View History

2011-08-11 13:22:07 +04:00
<?php
2011-09-24 00:59:24 +04:00
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
2011-09-23 00:22:52 +04:00
require_once ('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
2011-08-22 18:59:16 +04:00
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
2011-08-22 18:59:16 +04:00
if( count($calendars) == 0){
OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'Default calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
2011-08-22 18:59:16 +04:00
}
$eventSources = array();
foreach($calendars as $calendar){
2011-10-19 21:07:56 +04:00
$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");
}
2011-10-21 00:18:17 +04:00
OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar');
OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
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();