I'm using full calender and I have a few events that are all day events. Generally, my php set all 'allDay' => 'false'. Now that I noticed it adds a time on it if I do not specify a time.
I want to set all defaults false for all values, unless I specify them true.
My php fetch is as follows:
$sql = "SELECT `id`, `title`, `time`, `start`, `end`, `url`, `backgroundColor`, `textColor`, `className`,
`allDay` FROM calender WHERE length('column') > '0'";
$result = $dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row){
$return[]=array('id'=>$row['id'],
'title'=>$row['title'],
"allDay" =>$row['allDay'],
'start'=>$row['start'].' '.$row['time'],
'end'=>$row['end'],
'url'=>$row['url'],
'backgroundColor'=>$row['backgroundColor'],
'textColor'=>$row['textColor'],
'className' =>$row['className']);
}
$dbh = null;
header('Content-type: application/json');
echo json_encode($return);
and the jQuery function is:
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: false,
events: "json-events.php",
eventDrop: function(event, delta) {
alert(event.title + ' was moved ' + delta + ' days\n' +
'(You cannot update these fields!)');
},
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
},
});
});
I do not know where I add the values. I have mySQL storing 'allDay' as true/false but it returns as a string. So I actually know how to go about coverting it before json encodes the file. or have jQuery/javascript change it after the data is being looked at.
allDaytwice in the array? Also you're mixin single and double quotes all over the place, not a good habit..