PCHomepage
Programmer
Since I'm not sure if this is a JavaScript or CSS question, I am posting here because it is a JavaScript plug-in. On fullCalendar, I need to move the day numbers to the upper left when they seem to default to the upper right but so far I've not had any luck. I found numerous postings through Google that suggest various CSS but they either do nothing or they bunch up all the dates to the left on top of one another. I would also like the day row to have its own border.
Also, I need the calendar to automatically show certain holidays but not necessarily all of them. Is this possible?
Here is my current code, which is using PHP to get calendar events from the database:
Also, I need the calendar to automatically show certain holidays but not necessarily all of them. Is this possible?
Here is my current code, which is using PHP to get calendar events from the database:
Code:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
weekMode: 'variable',
header: {
right: 'prev,next',
left: 'title'
},
firstDay: 1, // Starts week on Monday
handleWindowResize: true,
selectable: false,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true, // allow "more" link when too many events
eventRender: function(event, element, view) {
element.bind('click', function() {
var day = ($.fullCalendar.formatDate( event.start, 'dd' ));
var month = ($.fullCalendar.formatDate( event.start, 'MM' ));
var year = ($.fullCalendar.formatDate( event.start, 'yyyy' ));
alert(year+'-'+month+'-'+day);
});
},
events:
[
<?php
$n = 0;
for ($i=0;$i<=count($rowCat)-1;$i++) :
$EntryID = $rowCat[$i]["ID"];
$StartTime = strtotime(trim($rowCat[$i]["Start"]));
$EndTime = strtotime(trim($rowCat[$i]["End"]));
$DisplayName = trim($rowCat[$i]["StaffName"]);
echo "{\ntitle: '$DisplayName',\n";
if (!$rowCat[$i]["FirstName"] && !$rowCat[$i]["LastName"]) :
$FormattedStart = date("Y-m-d", $StartTime);
$FormattedEnd = ($EndTime > $StartTime) ? date('Y-m-d', strtotime('+1 day', $EndTime)): date("Y-m-d", $EndTime);
echo "start: '$FormattedStart',\n";
echo "end: '$FormattedEnd'";
if (isset($_SESSION['AccessLevel']) && $_SESSION['AccessLevel'] > 1) :
echo ",\n";
echo "url: '/administration/events_admin.php?ID=$EntryID',";
endif;
echo "className: 'specialevent'\n";
echo "}\n";
else :
$FormattedStart = date("Y-m-d\TH:i:s", $StartTime);
$FormattedEnd = date("Y-m-d\TH:i:s", $EndTime);
echo "start: '$FormattedStart',\n";
echo "end: '$FormattedEnd'";
if (isset($_SESSION['AccessLevel']) && $_SESSION['AccessLevel'] > 1) :
echo ",\n";
echo "url: '/administration/calendar_admin.php?ID=$EntryID',";
endif;
echo "className: 'calendarevent'\n";
echo "}\n";
endif;
if(++$n !== $numRows) :
echo ",\n\n";
endif;
endfor;
?>
],
timeFormat: 'hh:mmt',
});
<?php
if (isset($_COOKIE['CalendarDate'])) :
$datePieces = explode('-', $_SESSION['CalendarDate']);
$DateYear = $datePieces[0];
$DateMonth = $datePieces[1];?>
//$('#calendar').fullCalendar('gotoDate', '<?=$DateYear?>-<?=$DateMonth?>-01');
<?php endif;?>
});
</script>