diff options
Diffstat (limited to 'views/default/event_calendar')
-rw-r--r-- | views/default/event_calendar/full_calendar_view.php | 46 | ||||
-rw-r--r-- | views/default/event_calendar/input/date_local.php | 2 | ||||
-rw-r--r-- | views/default/event_calendar/show_events.php | 6 | ||||
-rw-r--r-- | views/default/event_calendar/strapline.php | 2 |
4 files changed, 52 insertions, 4 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 diff --git a/views/default/event_calendar/input/date_local.php b/views/default/event_calendar/input/date_local.php index f9979cb38..f4cb48d11 100644 --- a/views/default/event_calendar/input/date_local.php +++ b/views/default/event_calendar/input/date_local.php @@ -49,7 +49,7 @@ if ($timestamp) { // convert timestamps to text for display if (is_numeric($vars['value'])) { - $vars['value'] = date('Y/m/d', $vars['value']); + $vars['value'] = date('Y-m-d', $vars['value']); } $attributes = elgg_format_attributes($vars); diff --git a/views/default/event_calendar/show_events.php b/views/default/event_calendar/show_events.php index b51b1c05f..63d722247 100644 --- a/views/default/event_calendar/show_events.php +++ b/views/default/event_calendar/show_events.php @@ -5,7 +5,7 @@ * @package event_calendar * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Kevin Jardine <kevin@radagast.biz> - * @copyright Radagast Solutions 2008 + * @copyright Radagast Solutions 2008-12 * @link http://radagast.biz/ * */ @@ -17,6 +17,8 @@ if ($vars['events']) { $event_list = elgg_view('event_calendar/agenda_view',$vars); } else if ($listing_format == 'paged') { $event_list = elgg_view('event_calendar/paged_view',$vars); + } else if ($listing_format == 'full') { + $event_list = elgg_view('event_calendar/full_calendar_view',$vars); } else { $options = array( 'list_class' => 'elgg-list-entity', @@ -32,7 +34,7 @@ if ($vars['events']) { } else { $event_list = '<p>'.elgg_echo('event_calendar:no_events_found').'</p>'; } -if ($listing_format == 'paged') { +if ($listing_format == 'paged' || $listing_format == 'full') { echo $event_list; } else { ?> diff --git a/views/default/event_calendar/strapline.php b/views/default/event_calendar/strapline.php index 15c7c98d9..edc60aa3e 100644 --- a/views/default/event_calendar/strapline.php +++ b/views/default/event_calendar/strapline.php @@ -9,7 +9,7 @@ $owner = get_entity($owner_guid); echo sprintf(elgg_echo('event_calendar:strapline'), - friendly_time($time_updated), + elgg_view_friendly_time($time_updated), "<a href=\"" . $owner->getURL() . "\">" . $owner->name ."</a>" ); |