aboutsummaryrefslogtreecommitdiff
path: root/views/default/event_calendar/full_calendar_view.php
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2012-03-13 16:40:49 +0100
committerKevin Jardine <kevinjardine@yahoo.com>2012-03-13 16:40:49 +0100
commit1150f289dfb488cc0aaf9f1ae56183e752226312 (patch)
tree17771e41eba4eef5ddc04c2bef79babfd46ff09c /views/default/event_calendar/full_calendar_view.php
parente0e9ff33a7f5fc334af8127fc8680925ce967d14 (diff)
downloadelgg-1150f289dfb488cc0aaf9f1ae56183e752226312.tar.gz
elgg-1150f289dfb488cc0aaf9f1ae56183e752226312.tar.bz2
replaced deprecated friendly time, dates now stored properly in GMT and displayed in server time, added beginning of full calendar option
Diffstat (limited to 'views/default/event_calendar/full_calendar_view.php')
-rw-r--r--views/default/event_calendar/full_calendar_view.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/views/default/event_calendar/full_calendar_view.php b/views/default/event_calendar/full_calendar_view.php
new file mode 100644
index 000000000..b6c725908
--- /dev/null
+++ b/views/default/event_calendar/full_calendar_view.php
@@ -0,0 +1,46 @@
+<?php
+elgg_load_js('elgg.full_calendar');
+
+$events = $vars['events'];
+
+$event_array = array();
+
+foreach($events as $e) {
+ $event_array[] = array(
+ 'id' => $e->guid,
+ 'title' => $e->title,
+ 'start_date' => $e->start_date,
+ 'end_date' => $e->real_end_time,
+ );
+}
+
+$json_events_string = json_encode($event_array);
+
+// TODO: is there an easy way to avoid embedding JS?
+?>
+<script>
+$(document).ready(function() {
+ var events = <?php echo $json_events_string; ?>;
+ var cal_events = [];
+ for (var i = 0; i < events.length; i++) {
+ cal_events.push({
+ id: events[i].id,
+ title : events[i].title,
+ start : new Date(1000*events[i].start_date),
+ end : new Date(1000*events[i].end_date),
+ allDay: false
+ });
+ }
+
+ $('#calendar').fullCalendar({
+ header: {
+ left: 'prev,next today',
+ center: 'title',
+ right: 'month,agendaWeek,agendaDay'
+ },
+ editable: true,
+ events: cal_events
+ });
+});
+</script>
+<div id='calendar'></div> \ No newline at end of file