KS2 Calendar
Homework Set
')
}
} else if (event.homework_type === "due") {
element.find('.fc-content').append('Date Set: ' + moment(event.setDate).format("DD/MM/YYYY") + '
')
if (element.siblings('fc-hwtitle-due').length === 0) {
element.before('Homework Due
');
}
}
}
}
};
var calRender = function (view) {
calTransitions( false );
// Set the mini calendar to the same date as the full calendar.
if ( $calMini !== false ) { $calMini.fullCalendar( 'gotoDate', view.calendar.getDate() ); }
// Hide the list while the events are loading and being filters.
if ( view.name == 'listMonth' || view.name == 'listWeek' ) {
view.el.hide();
view.el.parent('.fc-view-container').removeClass('ui_card ui_card--void');
$('.content__calendar').addClass('content__calendar--list');
if ( $calMini !== false ) {
$calMini.fullCalendar('render');
}
} else {
view.el.parent('.fc-view-container').addClass('ui_card ui_card--void');
$('.content__calendar').removeClass('content__calendar--list');
}
currentDate = new Date();
viewDate = new Date(view.start);
if (new Date(viewDate.getFullYear(), viewDate.getMonth() + 1).getTime() <= new Date(currentDate.getFullYear() - 3, currentDate.getMonth()).getTime()){
$('.fc-prev-button').prop('disabled', true);
$('.fc-prev-button').css('opacity', 0.5);
} else {
$('.fc-prev-button').prop('disabled', false);
$('.fc-prev-button').css('opacity', 1);
}
if (new Date(viewDate.getFullYear(), viewDate.getMonth() + 1).getTime() >= new Date(currentDate.getFullYear() + 3, currentDate.getMonth()).getTime()){
$('.fc-next-button').prop('disabled', true);
$('.fc-next-button').css('opacity', 0.5);
} else {
$('.fc-next-button').prop('disabled', false);
$('.fc-next-button').css('opacity', 1);
}
};
var calSwitch = function(cell) {
$calFull.fullCalendar('changeView', 'listMonth');
if ($calMini !== false) $calMini.fullCalendar('gotoDate', cell.date);
objCalSwitchInterval = setInterval(function() {
calSwitchScroll(cell.date);
}, 250);
};
var calSwitchScroll = function (cellDate) {
if (intCalSwitchScrollCount <= 20) {
if ($('.fc-listMonth-view').length > 0) {
clearInterval(objCalSwitchInterval);
calScroll(cellDate);
}
} else {
clearInterval(objCalSwitchInterval);
}
intCalSwitchScrollCount++;
}
var calScroll = function(date) {
var $dateAnchor = $('a[name="' + date.format() + '"]');
if ( $dateAnchor.length > 0 ) {
var intScroll = $dateAnchor.offset().top,
intSpeed;
intSpeed = intScroll - $(document).scrollTop();
if (intSpeed < 0) intSpeed = -(intSpeed);
$viewport.animate({ 'scrollTop': intScroll + 'px' }, { duration: intSpeed });
}
};
$('.content__calendar__toolbar').on('change', '.content__calendar__filters input', function() {
calTransitions(true);
$selectedCals = [];
$('.content__calendar__filters input:checked').each(function() {
$selectedCals.push(parseInt($(this).val()));
});
strCalICSLink = 'www.almondburycs.org.uk/calendar/ics.asp?calid=' + $selectedCals;
$calFull.fullCalendar('rerenderEvents');
$calMini.fullCalendar('rerenderEvents');
});
var customButtons = {
printBtn: {
html: 'Print',
text: 'Print',
click: function() {
location.href = '/calendar/print.asp?calid=' + $selectedCals + '&pid=3&viewid=1';
},
type: 'button'
},
filterBtn: {
html: '