]> source.dussan.org Git - nextcloud-server.git/commitdiff
Implement loading of events in calendar
authorBart Visscher <bartv@thisnet.nl>
Mon, 17 Oct 2011 17:58:56 +0000 (19:58 +0200)
committerBart Visscher <bartv@thisnet.nl>
Thu, 20 Oct 2011 21:49:27 +0000 (23:49 +0200)
apps/calendar/ajax/events.php [new file with mode: 0644]
apps/calendar/ajax/getcal.php [deleted file]
apps/calendar/index.php
apps/calendar/js/calendar.js
apps/calendar/lib/object.php
apps/calendar/templates/calendar.php

diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
new file mode 100644 (file)
index 0000000..f9911f0
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * 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.
+ */
+
+require_once ("../../../lib/base.php");
+if(!OC_USER::isLoggedIn()) {
+       die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
+}
+OC_JSON::checkAppEnabled('calendar');
+
+$start = DateTime::createFromFormat('U', $_GET['start']);
+$end = DateTime::createFromFormat('U', $_GET['end']);
+
+$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
+$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
+$return = array();
+foreach($events as $event)
+{
+       $object = Sabre_VObject_Reader::read($event['calendardata']);
+       $vevent = $object->VEVENT;
+       $dtstart = $vevent->DTSTART;
+       $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
+       $start_dt = $dtstart->getDateTime();
+       $start_dt->setTimezone(new DateTimeZone($user_timezone));
+       $end_dt = $dtend->getDateTime();
+       $end_dt->setTimezone(new DateTimeZone($user_timezone));
+
+       $return_event = array();
+       $return_event['id'] = $event['id'];
+       $return_event['title'] = $event['summary'];
+       $return_event['start'] = $start_dt->format('Y-m-d H:i');
+       $return_event['end'] = $end_dt->format('Y-m-d H:i');
+       $return_event['allDay'] = false;
+       if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE)
+       {
+               $return_event['allDay'] = true;
+               $end_dt->modify('-1 sec');
+               $return_event['end'] = $end_dt->format('Y-m-d H:i');
+       }
+       $return[] = $return_event;
+}
+OC_JSON::encodedPrint($return);
diff --git a/apps/calendar/ajax/getcal.php b/apps/calendar/ajax/getcal.php
deleted file mode 100644 (file)
index a65c6cf..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * 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.
- */
-
-require_once ("../../../lib/base.php");
-if(!OC_USER::isLoggedIn()) {
-       die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
-}
-OC_JSON::checkAppEnabled('calendar');
-
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
-$events = array();
-$return = array('calendars'=>array());
-foreach($calendars as $calendar) {
-       $tmp = OC_Calendar_Object::all($calendar['id']);
-       $events = array_merge($events, $tmp);
-       $return['calendars'][$calendar['id']] = array(
-               'displayname' => $calendar['displayname'],
-               'color'       => '#'.$calendar['calendarcolor']
-       );
-}
-
-$select_year = $_GET["year"];
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
-foreach($events as $event)
-{
-       if ($select_year != substr($event['startdate'], 0, 4))
-               continue;
-       $object = Sabre_VObject_Reader::read($event['calendardata']);
-       $vevent = $object->VEVENT;
-       $dtstart = $vevent->DTSTART;
-       $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
-       $start_dt = $dtstart->getDateTime();
-       $start_dt->setTimezone(new DateTimeZone($user_timezone));
-       $end_dt = $dtend->getDateTime();
-       $end_dt->setTimezone(new DateTimeZone($user_timezone));
-       $year  = $start_dt->format('Y');
-       $month = $start_dt->format('n') - 1; // return is 0 based
-       $day   = $start_dt->format('j');
-       $hour  = $start_dt->format('G');
-       if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
-               $hour = 'allday';
-       }
-
-       $return_event = array();
-       foreach(array('id', 'calendarid', 'objecttype', 'repeating') as $prop)
-       {
-               $return_event[$prop] = $event[$prop];
-       }
-       $return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
-       $return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
-       $return_event['description'] = $event['summary'];
-       if ($hour == 'allday')
-       {
-               $return_event['allday'] = true;
-       }
-       if (isset($return[$year][$month][$day][$hour]))
-       {
-               $return[$year][$month][$day][$hour][] = $return_event;
-       }
-       else
-       {
-               $return[$year][$month][$day][$hour] = array(1 => $return_event);
-       }
-}
-OC_JSON::encodedPrint($return);
index 499765b22c4b425f60eaab20dd2edea191df109b..9584e62e4498288400618d489f98fcad30712832 100644 (file)
@@ -15,6 +15,14 @@ if( count($calendars) == 0){
        OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'default','Default calendar');
        $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
 }
+$eventSources = array();
+foreach($calendars as $calendar){
+       $eventSources[] = array(
+               'url' => 'ajax/events.php?calendar_id='.$calendar['id'],
+               'color' => '#'.$calendar['calendarcolor'],
+               'textColor' => 'black',
+       );
+}
 OC_Util::addScript('calendar', 'calendar');
 OC_Util::addStyle('calendar', 'style');
 OC_Util::addScript('', 'jquery.multiselect');
@@ -22,5 +30,6 @@ OC_Util::addStyle('', 'jquery.multiselect');
 OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar');
 OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
 OC_App::setActiveNavigationEntry('calendar_index');
-$output = new OC_Template('calendar', 'calendar', 'user');
-$output -> printPage();
+$tmpl = new OC_Template('calendar', 'calendar', 'user');
+$tmpl->assign('eventSources', $eventSources);
+$tmpl->printPage();
index 2917d9f9134b34378d6331b81fa9fcfbe956b19c..033eec8714cc0a688699f921ccba577193193ae0 100644 (file)
@@ -113,9 +113,6 @@ Calendar={
                        return date[3] + ':' + date[4];
                },
                updateView:function() {
-                       this.current.removeEvents();
-                       this.current.renderCal();
-                       this.current.showEvents();
                },
                currentview:'none',
                setCurrentView:function(view){
@@ -174,33 +171,6 @@ Calendar={
                },
                events:[],
                loadEvents:function(year){
-                       if( typeof (year) == 'undefined') {
-                               this.events = [];
-                               year = Calendar.Date.current.getFullYear();
-                       }
-                       if( typeof (this.events[year]) == "undefined") {
-                               this.events[year] = []
-                       }
-                       $.getJSON(OC.filePath('calendar', 'ajax', 'getcal.php') + "?year=" + year, function(jsondata, status) {
-                               if(status == "nosession") {
-                                       alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
-                                       document.location(oc_webroot);
-                               }
-                               if(status == "parsingfail" || typeof (jsondata) == "undefined") {
-                                       $.ready(function() {
-                                               $( "#parsingfail_dialog" ).dialog();
-                                       });
-                               } else {
-                                       if (typeof(jsondata[year]) != 'undefined'){
-                                               Calendar.UI.calendars = jsondata['calendars'];
-                                               Calendar.UI.events[year] = jsondata[year];
-                                       }
-                                       $(document).ready(function() {
-                                               Calendar.UI.updateView();
-                                       });
-                               }
-                       });
-                       window.setTimeout("Calendar.UI.loadEvents(" + year + ")", 120000);
                },
                getEventsForDate:function(date){
                        var day = date.getDate();
@@ -576,37 +546,7 @@ Calendar={
                        cancel:function(button, calendarid){
                                $(button).closest('tr').prev().show().next().remove();
                        },
-               },/*
-               OneDay:{
-                       forward:function(){
-                               Calendar.Date.forward_day();
-                       },
-                       backward:function(){
-                               Calendar.Date.backward_day();
-                       },
-                       removeEvents:function(){
-                               $("#onedayview .calendar_row").empty();
-                       },
-                       renderCal:function(){
-                               $("#datecontrol_date").val(Calendar.UI.formatDayShort() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort() + Calendar.space + Calendar.Date.current.getFullYear());
-                               $("#onedayview_today").html(Calendar.UI.formatDayLong() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort());
-                               Calendar.UI.addDateInfo('#onedayview_today', new Date(Calendar.Date.current));
-                       },
-                       showEvents:function(){
-                               Calendar.UI.createEventsForDate(Calendar.Date.current, 0);
-                       },
-                       getEventContainer:function(week, weekday, when){
-                               return $("#onedayview ." + when);
-                       },
-                       createEventLabel:function(event){
-                               var time = '';
-                               if (!event['allday']){
-                                       time = '<strong>' + Calendar.UI.formatTime(event['startdate']) + ' - ' + Calendar.UI.formatTime(event['enddate']) + '</strong> ';
-                               }
-                               return $(document.createElement('p'))
-                                       .html(time + event['description'])
-                       },
-               },*/
+               },
                OneWeek:{
                        forward:function(){
                                Calendar.Date.forward_week();
@@ -614,48 +554,8 @@ Calendar={
                        backward:function(){
                                Calendar.Date.backward_week();
                        },
-                       removeEvents:function(){
-                               for( i = 0; i <= 6; i++) {
-                                       $("#oneweekview ." + Calendar.UI.weekdays[i]).empty();
-                               }
-                               $("#oneweekview .thisday").removeClass("thisday");
-                       },
                        renderCal:function(){
                                $("#datecontrol_date").val(Calendar.UI.cw_label + ": " + Calendar.Date.calw());
-                               var dates = this.generateDates();
-                               var today = new Date();
-                               for(var i = 0; i <= 6; i++){
-                                       $("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+Calendar.firstdayofweek)%7) + Calendar.space + dates[i].getDate() + Calendar.space + Calendar.UI.formatMonthShort(dates[i].getMonth()));
-                                       $("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + "allday");
-                                       $("#oneweekview td." + Calendar.UI.weekdays[i] + ".allday").droppable({
-                                               drop: function() {
-                                                       Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
-                                                       Calendar.UI.loadEvents();
-                                               }
-                                       });
-                                       for(var ii = 0;ii <= 23; ii++){
-                                               $("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).attr('title', dates[i].getDate() + "." + String(parseInt(dates[i].getMonth()) + 1) + "." + dates[i].getFullYear() + "-" + String(ii) + ":00");
-                                               $("#oneweekview td." + Calendar.UI.weekdays[i] + "." + String(ii)).droppable({
-                                                       drop: function() {
-                                                               Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
-                                                               Calendar.UI.loadEvents();
-                                                       }
-                                               });
-                                       }
-                                       if(dates[i].getDate() == today.getDate() && dates[i].getMonth() == today.getMonth() && dates[i].getFullYear() == today.getFullYear()){
-                                               $("#oneweekview ." + Calendar.UI.weekdays[i]).addClass("thisday");
-                                       }
-                                       Calendar.UI.addDateInfo('#oneweekview th.' + Calendar.UI.weekdays[i], dates[i]);
-                               }
-                       },
-                       showEvents:function(){
-                               var dates = this.generateDates();
-                               for(var weekday = 0; weekday <= 6; weekday++) {
-                                       Calendar.UI.createEventsForDate(dates[weekday], 0);
-                               }
-                       },
-                       getEventContainer:function(week, weekday, when){
-                               return $("#oneweekview ." + Calendar.UI.weekdays[weekday] + "." + when);
                        },
                        createEventLabel:function(event){
                                var time = '';
@@ -665,122 +565,7 @@ Calendar={
                                return $(document.createElement('p'))
                                        .html(time + event['description'])
                        },
-                       generateDates:function(){
-                               var dates = new Array();
-                               var date = new Date(Calendar.Date.current)
-                               var dayofweek = date.getDay();
-                               if(dayofweek == 0) {
-                                       dayofweek = 7;
-                               }
-                               if(Calendar.firstdayofweek > dayofweek){
-                                       date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
-                               }else{
-                                       date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
-                               }
-                               for(var i = 0; i <= 6; i++) {
-                                       dates[i] = new Date(date)
-                                       date.setDate(date.getDate() + 1);
-                               }
-                               return dates;
-                       },
-               },/*
-               FourWeeks:{
-                       forward:function(){
-                               Calendar.Date.forward_week();
-                       },
-                       backward:function(){
-                               Calendar.Date.backward_week();
-                       },
-                       removeEvents:function(){
-                               $('#fourweeksview .day.thisday').removeClass('thisday');
-                               $('#fourweeksview .day .events').empty();
-                       },
-                       renderCal:function(){
-                               var calw1 = Calendar.Date.calw();
-                               var calw2 = calw1 + 1;
-                               var calw3 = calw1 + 2;
-                               var calw4 = calw1 + 3;
-                               switch(calw1) {
-                                       case 50:
-                                               calw4 = 1;
-                                               break;
-                                       case 51:
-                                               calw3 = 1;
-                                               calw4 = 2;
-                                               break;
-                                       case 52:
-                                               calw2 = 1;
-                                               calw3 = 2;
-                                               calw4 = 3;
-                                               break;
-                               }
-                               var calwplusfour = calw4;
-                               var dates = this.generateDates();
-                               var week = 1;
-                               var weekday = 0;
-                               var today = new Date();
-                               for(var i = 0; i <= 27; i++){
-                                       var dayofmonth = dates[i].getDate();
-                                       var month = dates[i].getMonth();
-                                       var year = dates[i].getFullYear();
-                                       $("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
-                                       if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
-                                               $("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
-                                       }
-                                       Calendar.UI.addDateInfo('#fourweeksview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
-                                       if(weekday == 6){
-                                               weekday = 0;
-                                               week++;
-                                       }else{
-                                               weekday++;
-                                       }
-                               }
-                               $("#fourweeksview .week_1 .calw").html(calw1);
-                               $("#fourweeksview .week_2 .calw").html(calw2);
-                               $("#fourweeksview .week_3 .calw").html(calw3);
-                               $("#fourweeksview .week_4 .calw").html(calw4);
-                               $("#datecontrol_date").val(Calendar.UI.cws_label + ": " + Calendar.Date.calw() + " - " + calwplusfour);
-                       },
-                       showEvents:function(){
-                               var dates = this.generateDates();
-                               var weekdaynum = 0;
-                               var weeknum = 1;
-                               for(var i = 0; i <= 27; i++) {
-                                       Calendar.UI.createEventsForDate(dates[i], weeknum);
-                                       if(weekdaynum == 6){
-                                               weekdaynum = 0;
-                                               weeknum++;
-                                       }else{
-                                               weekdaynum++;
-                                       }
-                               }
-                       },
-                       getEventContainer:function(week, weekday, when){
-                               return $("#fourweeksview .week_" + week + " .day." + Calendar.UI.weekdays[weekday] + " .events");
-                       },
-                       createEventLabel:function(event){
-                               var time = '';
-                               if (!event['allday']){
-                                       time = '<strong>' + Calendar.UI.formatTime(event['startdate']) + '</strong> ';
-                               }
-                               return $(document.createElement('p'))
-                                       .html(time + event['description'])
-                       },
-                       generateDates:function(){
-                               var dates = new Array();
-                               var date = new Date(Calendar.Date.current)
-                               var dayofweek = date.getDay();
-                               if(dayofweek == 0) {
-                                       dayofweek = 7;
-                               }
-                               date.setDate(date.getDate() - dayofweek + 1);
-                               for(var i = 0; i <= 27; i++) {
-                                       dates[i] = new Date(date)
-                                       date.setDate(date.getDate() + 1);
-                               }
-                               return dates;
-                       },
-               },*/
+               },
                OneMonth:{
                        forward:function(){
                                Calendar.Date.forward_month();
@@ -788,89 +573,8 @@ Calendar={
                        backward:function(){
                                Calendar.Date.backward_month();
                        },
-                       removeEvents:function(){
-                               $('#onemonthview .day.thisday').removeClass('thisday');
-                               $('#onemonthview .day .events').empty();
-                       },
                        renderCal:function(){
                                $("#datecontrol_date").val(Calendar.UI.formatMonthLong() + Calendar.space + Calendar.Date.current.getFullYear());
-                               var cal = Calendar.Date.getnumberofdays(Calendar.Date.current.getFullYear());
-                               var monthview_dayofweek = Calendar.Date.current.getDay();
-                               var monthview_dayofmonth = Calendar.Date.current.getDate();
-                               for(var i = monthview_dayofmonth; i > 1; i--) {
-                                       if(monthview_dayofweek == 0) {
-                                               monthview_dayofweek = 6;
-                                       } else {
-                                               monthview_dayofweek--;
-                                       }
-                               }
-                               $("#onemonthview .week_5").hide();
-                               $("#onemonthview .week_6").hide();
-                               this.rows = monthview_dayofweek + cal[Calendar.Date.current.getMonth()];
-                               this.rows = this.rows / 7;
-                               this.rows = Math.ceil(this.rows);
-                               var dates = this.generateDates();
-                               var week = 1;
-                               var weekday = 0;
-                               var today = new Date();
-                               for(var i = 0; i <= 41; i++){
-                                       var dayofmonth = dates[i].getDate();
-                                       var month = dates[i].getMonth();
-                                       var year = dates[i].getFullYear();
-                                       $("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
-                                       $("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).attr('title', dayofmonth + "." + String(parseInt(month) + 1) + "." + year);
-                                       $("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).droppable({
-                                               drop: function() {
-                                                       Calendar.UI.moveevent(Calendar.UI.drageventid, this.title);
-                                                       Calendar.UI.loadEvents();
-                                               }
-                                       });
-                                       if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
-                                               $("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
-                                       }
-                                       Calendar.UI.addDateInfo('#onemonthview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
-                                       if(weekday == 6){
-                                               weekday = 0;
-                                               week++;
-                                       }else{
-                                               weekday++;
-                                       }
-                               }
-                               if(this.rows == 4){
-                                       for(var i = 1;i <= 6;i++){
-                                               $("#onemonthview .week_" + String(i)).height("23%");
-                                       }
-                               }
-                               if(this.rows == 5) {
-                                       $("#onemonthview .week_5").show();
-                                       for(var i = 1;i <= 6;i++){
-                                               $("#onemonthview .week_" + String(i)).height("18%");
-                                       }
-                               }
-                               if(this.rows == 6) {
-                                       $("#onemonthview .week_5").show();
-                                       $("#onemonthview .week_6").show();
-                                       for(var i = 1;i <= 6;i++){
-                                               $("#onemonthview .week_" + String(i)).height("14%");
-                                       }
-                               }
-                       },
-                       showEvents:function(){
-                               var dates = this.generateDates();
-                               var weekdaynum = 0;
-                               var weeknum = 1;
-                               for(var i = 0; i <= 41; i++) {
-                                       Calendar.UI.createEventsForDate(dates[i], weeknum);
-                                       if(weekdaynum == 6){
-                                               weekdaynum = 0;
-                                               weeknum++;
-                                       }else{
-                                               weekdaynum++;
-                                       }
-                               }
-                       },
-                       getEventContainer:function(week, weekday, when){
-                               return $("#onemonthview .week_" + week + " .day." + Calendar.UI.weekdays[weekday] + " .events");
                        },
                        createEventLabel:function(event){
                                var time = '';
@@ -880,26 +584,6 @@ Calendar={
                                return $(document.createElement('p'))
                                        .html(time + event['description'])
                        },
-                       generateDates:function(){
-                               var dates = new Array();
-                               var date = new Date(Calendar.Date.current)
-                               date.setDate(1);
-                               var dayofweek = date.getDay();
-                               if(dayofweek == 0) {
-                                       dayofweek = 7;
-                                       this.rows++;
-                               }
-                               if(Calendar.firstdayofweek > dayofweek){
-                                       date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek - 7);
-                               }else{
-                                       date.setDate(date.getDate() - dayofweek + Calendar.firstdayofweek);
-                               }
-                               for(var i = 0; i <= 41; i++) {
-                                       dates[i] = new Date(date)
-                                       date.setDate(date.getDate() + 1);
-                               }
-                               return dates;
-                       },
                },
                List:{
                        removeEvents:function(){
index 0c3e497d4f2e71d3bbc110b5ddaac59365a6b3d8..4afeb341a9c9264d7dd2cdc423bcaf1ef5f5d87a 100644 (file)
@@ -30,6 +30,34 @@ class OC_Calendar_Object{
                return $calendarobjects;
        }
 
+       /**
+        * @brief Returns all objects of a calendar between $start and $end
+        * @param integer $id
+        * @param DateTime $start
+        * @param DateTime $end
+        * @return array
+        *
+        * The objects are associative arrays. You'll find the original vObject
+        * in ['calendardata']
+        */
+       public static function allInPeriod($id, $start, $end){
+               $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?'
+               .' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)'
+               .' OR (startdate <= ? AND enddate >= ? AND repeating = 1))' );
+               $start = self::getUTCforMDB($start);
+               $end = self::getUTCforMDB($end);
+               $result = $stmt->execute(array($id,
+                                       $start, $end,
+                                       $end, $start));
+
+               $calendarobjects = array();
+               while( $row = $result->fetchRow()){
+                       $calendarobjects[] = $row;
+               }
+
+               return $calendarobjects;
+       }
+
        /**
         * @brief Returns an object
         * @param integer $id
index e087ce40617bef48f36bc27006a4d86ea0fca903..3aa6ef66dc7e9c52113e5d02868dd74dee38f10b 100644 (file)
                                        </div>
                                </div>
 <script type='text/javascript'>
-
        $(document).ready(function() {
-
-               var date = new Date();
-               var d = date.getDate();
-               var m = date.getMonth();
-               var y = date.getFullYear();
-
                $('#calendar_holder').fullCalendar({
                        editable: true,
-                       events: [
-                               {
-                                       title: 'All Day Event',
-                                       start: new Date(y, m, 1)
-                               },
-                               {
-                                       title: 'Long Event',
-                                       start: new Date(y, m, d-5),
-                                       end: new Date(y, m, d-2)
-                               },
-                               {
-                                       id: 999,
-                                       title: 'Repeating Event',
-                                       start: new Date(y, m, d-3, 16, 0),
-                                       allDay: false
-                               },
-                               {
-                                       id: 999,
-                                       title: 'Repeating Event',
-                                       start: new Date(y, m, d+4, 16, 0),
-                                       allDay: false
-                               },
-                               {
-                                       title: 'Meeting',
-                                       start: new Date(y, m, d, 10, 30),
-                                       allDay: false
-                               },
-                               {
-                                       title: 'Lunch',
-                                       start: new Date(y, m, d, 12, 0),
-                                       end: new Date(y, m, d, 14, 0),
-                                       allDay: false
-                               },
-                               {
-                                       title: 'Birthday Party',
-                                       start: new Date(y, m, d+1, 19, 0),
-                                       end: new Date(y, m, d+1, 22, 30),
-                                       allDay: false
-                               },
-                               {
-                                       title: 'Click for Google',
-                                       start: new Date(y, m, 28),
-                                       end: new Date(y, m, 29),
-                                       url: 'http://google.com/'
-                               }
-                       ]
+                       eventSources: <?php echo json_encode($_['eventSources']) ?>
                });
 
        });