I am creating a calendar without jquery calendar plugin. I could retrieve the data which is in the database to the calendar. But when there are multiple data per day only on
If you want to show all four boxes for the dates which has data, try to change the get_calendar_data() foreach as below,
$content = "";
$lastDay = -1;
$index = 0;
foreach ($query->result() as $row) {
if($lastDay != intval(substr($row->date_cal, 8, 2))){
if($index > 0 ){
if($content != ''){
$cal_data[$lastDay] = $content;
$content = '';
}
}
$index = 0;
}
if ($row->title == 'GK' && $row->type == 'AM') {
$content .= '' . $row->title . ' ' . $row->type . '';
} else if ($row->title == 'GK' && $row->type == 'PM') {
$content .= '' . $row->title . ' ' . $row->type . '';
}else if ($row->title == 'RP' && $row->type == 'AM') {
$content .= '' . $row->title . ' ' . $row->type . '';
} else if ($row->title == 'RP' && $row->type == 'PM') {
$content .= '' . $row->title . ' ' . $row->type . '';
}
$lastDay = intval(substr($row->date_cal, 8, 2));
$index++;
}
if($lastDay != -1 && $content != ''){
$cal_data[$lastDay] = $content;
}
Let me know whether it works now or not.