function loadEvents() { $cmd = new CalendarTypeModel(); $arrA = $cmd->getWhere("cal_type_active = 1 ORDER BY cal_type_name ASC"); $color = array(); foreach ($arrA as $a) { $color[$a->cal_type_id] = $a->cal_type_color; } $cm = new CalendarModel(); $arr = $cm->getAll(); $hasil = array(); foreach ($arr as $m) { $arr2 = array(); $arr2['title'] = $m->cal_name; $arr2['start'] = $m->cal_begin; $arr2['end'] = $m->cal_end; $arr2['id'] = $m->cal_id; $arr2['backgroundColor'] = $color[$m->cal_type]; if ($m->cal_allday) { $ad = true; } else { $ad = false; } $arr2['allDay'] = $ad; $hasil[] = $arr2; } echo json_encode($hasil); die; }