<div class="small-12 medium-10 columns">
{foreach $key as $events}
-
{foreach $events as $event}
+ {$showTime = true}
<div class="row glm-event-day-event">
<div class="small-12 columns">
<h2 class="agenda-event-name">{$event.name}</h2>
)
</div>
<div class="day-times-wrapper">
- {if !$event.all_day}
+ {if !$event.all_day && $showTime}
{if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
<div class="agenda-event-times">{$event.starting_date|date_format:"%l:%M %P"}</div>
{else}
var calendar = $("#eventCalendar");
var event_search = $(".glm-search-icon");
var main_content = $("#main-content");
+ var member_id = '{$memberId}';
var view = '{$cal_view}';
+ var months = '{$json_months}';
+ var category = $('#glm-event-category').val();
+ var current_month = $('{$current_month}');
+ var current_year = $('{$current_year}');
+ var custom_page = '{$customPage}';
+ var page_slug = '{$pageSlug}';
+ var retain_date;
+
+ if(!member_id){
+ member_id = null;
+ }
+
+ // add 7 days to ensure we always get the current month and not any other month view that may
+ // be visible (last few days of previous month or first few days of next month)
+ function get_current_view(){
+ var retain_date;
+ var calCurrDate = $('#eventCalendar').fullCalendar('getView').start;
+ var d = moment(calCurrDate).add(7, 'days').format('YYYY-MM-01');
+
+ return retain_date = d;
+ }
+ function in_mobile(){
+ if($(window).width() < 641 ){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ $('#glm-event-from').on("change", function(){
+ var from_date = $(this).val();
+ $('#glm-event-to').val(from_date);
- if( sessionStorage.view ){
+ });
+
+ months = JSON.parse(months);
+
+ event_search.on('click', function(){
+ sessionStorage.override = 'yes';
+ });
+
+ if( sessionStorage.view && sessionStorage.override === 'no' && !in_mobile()){
view = sessionStorage.view;
+ } else if( sessionStorage.override === 'yes' || in_mobile()){
+ view = 'agenda';
}
+
// AJAX FUNCTION ************************************************
// Get calendar month via AJAX
function eventsCalMonthAJAX(month) {
action: 'glm_members_admin_ajax',
glm_action: 'eventsCalMonthAJAX',
- month: month
-
+ month: month,
+ category: category,
+ member_id: member_id,
+ custom_page: custom_page,
+ page_slug: page_slug
};
$('.fc-event').remove();
start: i.start,
end: i.last,
allDay: i.all_day,
- url: i.url
+ url: i.url,
+ recurs: i.recurs
};
});
$("#eventCalendar").fullCalendar('removeEvents');
eventOrder: 'allDay',
height: height,
contentHeight: height,
+ eventRender: function(event, element){
+ element.attr('title', event.title);
+ },
viewRender: function (view, element){
post_start = view.start._d;
post_end = view.end._d;
{literal}month_obj = {start: view.start._d, last: view.end._d};{/literal}
},
header: {
- left: 'prev,next today',
+ left: 'prev,next,today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
dayClick: function(date, jsEvent, view) {
- $('#eventCalendar').fullCalendar('changeView', 'agendaDay');
- $('#eventCalendar').fullCalendar('gotoDate', date);
+ //$('#eventCalendar').fullCalendar('changeView', 'agendaDay');
+ //$('#eventCalendar').fullCalendar('gotoDate', date);
},
editable: false,
handleWindowResize: true,
lazyFetching: true,
eventClick : function (event){
- location.href = event.url;
+
+ sessionStorage.current_calendar_view = get_current_view();
+
+
+ if(custom_page !== ''){
+ location.href = event.url + '&glm_event_from=' + event.start.format();
+ } else {
+ location.href = event.url + '?glm_event_from=' + event.start.format();
+ }
+
+ return false;
},
eventLimit: true,
views: {
view_select.val('agenda');
}
$("#glm-event-view-select").on("change", function (){
+ sessionStorage.override = 'no';
sessionStorage.setItem("view", $(this).attr("value"));
if($("#glm-event-view-select option:selected").val() === "calendar"){
eventsCalMonthAJAX(month_obj);
calendar.fadeOut('slow', function(){});
}
});
+ $(window).on("load", function(){
+ if(sessionStorage.current_calendar_view){
+ $('#event-date-toggle option').each(function(){
+ if( $(this).val() === sessionStorage.current_calendar_view){
+ $(this).prop('selected', true);
+ }
+ });
+ }
+
+ $('#event-date-toggle-container').insertAfter( $('.fc-left')).fadeTo('slow', 1);
+
+ $('#event-date-toggle').on("change", function(){
+ var selected_date = $(this).val();
+
+ $('#eventCalendar').fullCalendar('gotoDate', selected_date);
+ eventsCalMonthAJAX(month_obj);
+ if(sessionStorage.current_calendar_view){
+ sessionStorage.current_calendar_view = '';
+ }
+ });
+ });
+ if(sessionStorage.current_calendar_view){
+ $('#eventCalendar').fullCalendar('gotoDate', sessionStorage.current_calendar_view);
+ eventsCalMonthAJAX(month_obj);
+ }
// initialize calendar with AJAX calls *************************************
$(document).on("click", "button.fc-button", function () {
+ if(sessionStorage.current_calendar_view){
+ sessionStorage.current_calendar_view = '';
+ }
+
eventsCalMonthAJAX(month_obj);
});
+ $('#eventCalendar').find('.fc-today-button').on("click", function(){
+ eventsCalMonthAJAX(month_obj);
+ var current_view = get_current_view();
+ $('#event-date-toggle option').each(function(){
+ if( $(this).val() === current_view){
+ $(this).prop('selected', true);
+ }
+ });
+ });
+
var dates = $(".agenda-event-recur-dates");
dates.each( function (){
if( $(this).text().indexOf('-') < 0 ){