owncalendar/index.php

63 lines
2.8 KiB
PHP
Raw Normal View History

2011-08-11 09:22:07 +00:00
<?php
2011-09-23 20:59:24 +00: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.
*/
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
2011-08-22 14:59:16 +00:00
// Create default calendar ...
2012-05-01 16:50:31 +00:00
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
2011-08-22 14:59:16 +00:00
if( count($calendars) == 0){
2012-05-01 16:50:31 +00:00
OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
2011-08-22 14:59:16 +00:00
}
$eventSources = array();
foreach($calendars as $calendar){
2011-10-19 17:07:56 +00:00
$eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
}
2012-03-03 14:06:51 +00:00
2012-04-23 18:13:55 +00:00
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
2012-03-03 14:06:51 +00:00
OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar
2012-05-01 16:50:31 +00:00
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
2012-05-01 16:50:31 +00:00
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
2012-05-01 16:50:31 +00:00
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list");
}
2011-10-20 20:18:17 +00:00
OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
2012-05-01 16:50:31 +00:00
if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
2011-11-11 14:51:44 +00:00
OC_UTIL::addScript('calendar', 'geo');
}
OC_Util::addScript('calendar', 'calendar');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('calendar', 'style');
OC_Util::addScript('', 'jquery.multiselect');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('', 'jquery.multiselect');
OC_Util::addScript('contacts','jquery.multi-autocomplete');
OC_Util::addScript('','oc-vcategories');
OC_App::setActiveNavigationEntry('calendar_index');
$tmpl = new OC_Template('calendar', 'calendar', 'user');
$tmpl->assign('eventSources', $eventSources);
$tmpl->assign('categories', $categories);
2012-01-06 13:36:24 +00:00
if(array_key_exists('showevent', $_GET)){
$tmpl->assign('showevent', $_GET['showevent']);
}
$tmpl->printPage();