예제 #1
0
 public function action_renderHotelOptions()
 {
     $response = '<option value="">' . Yii::t('general', 'Please select') . '</option>';
     if (Yii::$app->request->isAjax) {
         if (($withoutId = Yii::$app->request->post('withoutId')) && ($departmentId = Yii::$app->request->post('departmentId')) && ($checkIn = Yii::$app->request->post('checkIn')) && ($checkOut = Yii::$app->request->post('checkOut'))) {
             $rooModels = Hotel::getByParams($departmentId, $checkIn, $checkOut, $withoutId);
             $hotels = ArrayHelper::getColumn($rooModels, 'hotel');
             if (count($hotels)) {
                 foreach ($hotels as $hotel) {
                     $response .= '<option value="' . $hotel->id . '">' . $hotel->name . '</option>';
                 }
             }
         }
     }
     return $response;
 }