public function listresJsonAction() { $id = $this->_getParam('id'); $config = new RM_Config(); // used for date conversion $model = new RM_Reservations(); $Users_Reservation_Total = $model->fetchAllByUserID($id)->count(); $Users_Reservation_Info = $model->fetchAllByUserID($id)->toArray(); $jsonReservations = array(); $reservationDetailsModel = new RM_ReservationDetails(); foreach ($Users_Reservation_Info as $reservation) { $tempVal->reservation_id = $reservation['reservation_id']; $tempVal->unit_id = $reservation['unit_id']; //TODO: We need to convert this to a meaningful word ie: unitname (ID:X) $tempVal->start_date = $config->convertDates($reservation['start_datetime'], RM_Config::MYSQL_DATEFORMAT, RM_Config::JS_DATEFORMAT); $tempVal->end_date = $config->convertDates($reservation['end_datetime'], RM_Config::MYSQL_DATEFORMAT, RM_Config::JS_DATEFORMAT); $jsonReservations[] = clone $tempVal; } $ret = array("data" => '{"total": ' . $Users_Reservation_Total . ', "data" : ' . Zend_Json::encode($jsonReservations) . '}', 'encoded' => true); return $ret; }