Ejemplo n.º 1
0
 public function actionInfo($hotelId, $hotelResult, $cacheId = null, $format = 'json')
 {
     $hotelClient = new HotelBookClient();
     $response = array();
     $response['hotel'] = array();
     $response['hotel']['oldHotels'] = array();
     $response['hotel']['details'] = array();
     $hotelResultIDS = explode(',', $hotelResult);
     $hotelResult = array();
     foreach ($hotelResultIDS as $hotelStr) {
         list($resultId, $searchId) = explode(':', $hotelStr);
         $hotelResult[$resultId] = $searchId;
     }
     foreach ($hotelResult as $resultId => $searchId) {
         $response['hotel']['oldHotels'][] = new Hotel(array('searchId' => $searchId, 'resultId' => $resultId, 'hotelId' => $hotelId));
     }
     if (isset($response)) {
         $null = null;
         $hotelClient->hotelSearchDetails($null, $response['hotel']['oldHotels']);
         if ($format == 'json') {
             $this->sendJson($response);
         } elseif ($format == 'xml') {
             $this->sendXml($response, 'hotelSearchResults');
         }
         Yii::app()->end();
     }
     $this->sendError(200, 'No hotel with given hotelId found');
 }
Ejemplo n.º 2
0
 public function addHotelTripElement($hotel, $hotelSearchParams)
 {
     $hotelTripElement = new HotelTripElement();
     $hotelTripElement->fillFromSearchParams($hotelSearchParams);
     Yii::import('site.common.modules.hotel.models.*');
     $hotelClient = new HotelBookClient();
     $hotelClient->hotelSearchDetails($hotel);
     $hotelTripElement->hotel = $hotel;
     Yii::app()->shoppingCart->put($hotelTripElement);
 }