public function getreservationsJsonAction()
 {
     $unit_id = $this->_getParam('unitid');
     $date = $this->_getParam('date');
     // TODO: add admin selected language here:-
     $lang = RM_Environment::getInstance()->getLocale();
     $reservations = new RM_Reservations();
     $reservationDetails = $reservations->fetchAllByUnitDate($unit_id, $date, $lang);
     $jsonReservations = array();
     $config = new RM_Config();
     $usersObj = new RM_Users();
     foreach ($reservationDetails as $reservation) {
         $jsonData = new stdClass();
         $jsonData->reservation_id = $reservation->reservation_id;
         $jsonData->unit_id = $reservation->unit_id;
         $jsonData->start_date = $config->convertDates($reservation->start_datetime, RM_Config::PHP_DATEFORMAT, RM_Config::JS_DATEFORMAT);
         $jsonData->end_date = $config->convertDates($reservation->end_datetime, RM_Config::PHP_DATEFORMAT, RM_Config::JS_DATEFORMAT);
         $jsonData->total_price = $reservation->total_price;
         $jsonData->unit_name = $reservation->name;
         $jsonData->user_id = $reservation->user_id;
         if ($reservation->confirmed) {
             $confirmed = "<img src='" . RM_Environment::getConnector()->getRootURL() . "/RM/userdata/images/system/small/reservation_confirmed.png' border='0'>";
         } else {
             $confirmed = "<img src='" . RM_Environment::getConnector()->getRootURL() . "/RM/userdata/images/system/small/reservation_unconfirmed.png' border='0'>";
         }
         $jsonData->confirmed = $confirmed;
         $titleArray = str_replace(chr(39), chr(34), $this->_translate->_('Common.JSON', 'Titles'));
         $title = $usersObj->userTitle((int) $reservation->title, $titleArray);
         $jsonData->title = $title;
         $jsonData->first_name = $reservation->first_name;
         $jsonData->last_name = $reservation->last_name;
         $jsonReservations[] = clone $jsonData;
     }
     if (empty($jsonReservations)) {
         return array('data' => array('success' => false));
     }
     $json = "{\n            data : " . Zend_Json::encode($jsonReservations) . "\n        }";
     return array('data' => $json, 'encoded' => true);
 }