public function bookingsCalenderAction() { $bookingModel = new Bookings(); $model = new Practitioners(); isset($_REQUEST['sp_id']) ? $sp_id = $_REQUEST['sp_id'] : ($sp_id = ''); if ($sp_id != '') { $api_url = $this->getServiceLocator()->get('config')['api_url']['value']; $content = $bookingModel->getBookings($api_url, $sp_id); $delay_time = $model->getAppointmentDelay($sp_id, $api_url); if (count($content['results']) > 0) { foreach ($content['results'] as $booking) { if ($booking['booking_status']['status_id'] != '6') { switch ($booking['booking_status']['status_id']) { case '4': $color = '#96E34B'; $title = 'Confirmed'; break; case '5': $title = 'Pending Approval'; $color = '#3399FF'; break; case '6': $title = 'Canceled'; $color = '#ED4E2A'; break; default: $title = 'Pending Approval'; $color = '#FCB322'; break; } $events[] = array('title' => '', 'start' => date('D F d Y H:i:s', strtotime($booking['booking_status']['booking_time'])), 'end' => date('D F d Y H:i:s', strtotime($booking['booking_status']['booking_time']) + $booking['duration'] * 60), 'allDay' => false, 'backgroundColor' => $color, 'url' => '', 'id' => $booking['id'], 'user_id' => $booking['user_id'], 'duration' => $booking['duration']); //$events[] = array('title' => $booking['consumer_first_name'] . ' ' . $booking['consumer_last_name'] . ' ' . $booking['category_name'], 'start' => '2014-08-29T10:30:00', 'end' => '2014-08-29T12:30:00', 'allDay' => false, 'backgroundColor' => $color, 'url' => '', 'id' => $booking['user_id']); } } //print_r($events); exit; echo json_encode($events); exit; } } exit; }