Created
December 25, 2011 15:45
-
-
Save GDmac/1519438 to your computer and use it in GitHub Desktop.
EE full_calendar demo, regular channel entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- | |
// ----------------------------------------------------------------------- | |
// template_group/fullcal_demo | |
--} | |
<script type='text/javascript'> | |
// for start_on and stop_before parameters format 2011-12-25 13:00 | |
function myDate(d) { | |
return d.getFullYear() + '-' + | |
(d.getMonth() < 9 ? '0' : '') + (d.getMonth()+1) + '-' + | |
(d.getDate() < 10 ? '0' : '') + d.getDate() + ' ' + | |
(d.getHours() <10 ? '0' : '') + d.getHours() + ':' + | |
(d.getMinutes() < 10 ? '0' : '') + d.getMinutes(); | |
} | |
$(document).ready(function() { | |
$('#calendar').fullCalendar({ | |
events: function(start, end, callback) { | |
$.ajax({ | |
url: 'fullcal_json', | |
dataType: 'json', | |
type: 'POST', | |
data: { | |
start: myDate(start), | |
end : myDate(end) | |
}, | |
success: function(data) { | |
var events = []; | |
for (i in data) { | |
events.push({ | |
id : data[i].id, | |
title: data[i].title, | |
start: data[i].start, | |
end : data[i].end, | |
allDay : Boolean(data[i].allDay) | |
}); | |
}; | |
callback(events); | |
} | |
}); | |
} | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- | |
// ----------------------------------------------------------------------- | |
// template_group/fullcal_json | |
// using the mo-variables add-on, dynamically set start and stop parameters | |
--} | |
[{exp:channel:entries | |
channel="events" | |
show_future_entries="yes" show_expired="yes" | |
start_on="{embed:get_post:start}" | |
stop_before="{embed:get_post:end}" | |
}{ | |
"id": "{entry_id}", | |
"title": "{title}", | |
"start": "{entry_date}", | |
"end": "{expiration_date}", | |
"allDay": "{if all_day}1{/if}" | |
}, | |
{/exp:channel:entries} | |
{}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment