aboutsummaryrefslogtreecommitdiff
path: root/views/default/event_calendar
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
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')
-rw-r--r--views/default/event_calendar/full_calendar_view.php46
-rw-r--r--views/default/event_calendar/input/date_local.php2
-rw-r--r--views/default/event_calendar/show_events.php6
-rw-r--r--views/default/event_calendar/strapline.php2
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>"
);