we have a form which inserts event data into mysql table, this then feeds fullcalendar via JSON. Is it possible to set category colors, for example 'Holiday', 'Illness', 'Meeting'?
Our current json is like this, not sure how I would assign a colour to an event?
$jsonArray = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = $row['HolidayType'];
$title = $row['name'];
$start = $row['start'];
$end = $row['end'];
// Stores each database record to an array
$buildjson = array('title' => "$title", 'start' => "$start", 'end' => "$end", 'allDay' => false);
// Adds each array into the container array
array_push($jsonArray, $buildjson);
}
// Output the json formatted data so that the jQuery call can read it
echo json_encode($jsonArray);
Kind regards
Gary
The way I have done this in my implementation is to have two or more eventSources see http://arshaw.com/fullcalendar/docs/event_data/Event_Source_Object/. Each eventSource has its own json feed which returns for example just meetings, the next just holidays etc... Each eventSource has it's own colour scheme using color and textColor or backgroundColor, borderColor and textColor. HTH.
Another way that was used on earlier versions of FullCalendar but can still be used is to have an extra param sent back with your json feed which contains a css class that would be used to 'color' the event. So any holidays could have a 'holiday' class, meetings a 'meeting' class etc.