server/apps/calendar/index.php

63 lines
2.9 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.
*/
2012-05-01 20:59:38 +00:00
OCP\User::checkLoggedIn();
2012-05-02 17:08:37 +00:00
OCP\App::checkAppEnabled('calendar');
2011-08-22 14:59:16 +00:00
// Create default calendar ...
2012-06-14 22:50:42 +00:00
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
// if( count($calendars) == 0){
// OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar');
// $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
// }
$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
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar
2012-05-02 13:54:34 +00:00
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
2012-05-02 13:54:34 +00:00
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
2012-05-02 13:54:34 +00:00
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list");
}
2012-05-01 18:03:41 +00:00
OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
2012-05-01 18:03:41 +00:00
OCP\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-02 13:54:34 +00:00
if(OCP\Config::getUserValue(OCP\USER::getUser(), "calendar", "timezone") == null || OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
2012-05-01 18:03:41 +00:00
OCP\Util::addscript('calendar', 'geo');
2011-11-11 14:51:44 +00:00
}
2012-05-01 18:03:41 +00:00
OCP\Util::addscript('calendar', 'calendar');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('calendar', 'style');
2012-05-01 18:03:41 +00:00
OCP\Util::addscript('', 'jquery.multiselect');
2012-05-01 07:49:22 +00:00
OCP\Util::addStyle('', 'jquery.multiselect');
2012-05-01 18:03:41 +00:00
OCP\Util::addscript('contacts','jquery.multi-autocomplete');
OCP\Util::addscript('','oc-vcategories');
2012-05-01 22:50:26 +00:00
OCP\App::setActiveNavigationEntry('calendar_index');
2012-05-06 21:00:36 +00:00
$tmpl = new OCP\Template('calendar', 'calendar', 'user');
2012-06-11 17:07:51 +00:00
$tmpl->assign('eventSources', $eventSources,false);
2012-06-11 11:27:32 +00:00
$tmpl->assign('categories', $categories);
2012-01-06 13:36:24 +00:00
if(array_key_exists('showevent', $_GET)){
2012-06-11 17:07:51 +00:00
$tmpl->assign('showevent', $_GET['showevent'], false);
2012-01-06 13:36:24 +00:00
}
$tmpl->printPage();