예제 #1
0
 public function search($params)
 {
     $query = Hotels::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere([Hotels::tableName() . '.status' => '1']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'type' => $this->type, 'cityId' => $this->cityId, 'localityId' => $this->localityId, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'status' => $this->status, 'parent_city_id' => $this->parent_city_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
 public function actionHotelsuggest()
 {
     $request = Yii::$app->request->post();
     //var_dump($request);
     list($city, $locality) = $request['depdrop_parents'];
     if ($city == 'Loading ...') {
         $city = '';
     }
     if ($locality == 'Loading ...') {
         $locality = '';
     }
     //$model = new Locality;
     if ($city && $locality) {
         $data = \common\models\Hotels::find()->where(['status' => 1, 'cityId' => $city, 'localityId' => $locality])->all();
     } else {
         $data = \common\models\Hotels::find()->where(['status' => 1, 'cityId' => $city])->all();
     }
     $dataLoc = array();
     foreach ($data as $value) {
         $obj = new \stdClass();
         $obj->id = $value->Id;
         $obj->name = $value->name;
         $dataLoc[] = $obj;
     }
     //echo "<pre>";
     //var_dump($dataLoc);
     $result = new \stdClass();
     $result->output = $dataLoc;
     $result->selected = "";
     header('Content-Type: application/json');
     echo Json::encode($result);
     \yii::$app->end();
 }
예제 #3
0
?>
     
    <?php 
echo $form->field($model, 'types')->widget(Multiselect::className(), ['data' => ArrayHelper::merge([], ArrayHelper::map(\common\models\Types::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), 'options' => ['multiple' => 'multiple', 'size' => 5, 'title' => 'Select Types']]);
?>
     
    <?php 
echo $form->field($model, 'gpsLat')->textInput();
?>

    <?php 
echo $form->field($model, 'gpsLong')->textInput();
?>

    <?php 
echo $form->field($model, 'hotelId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-hotelid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Hotels::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid', strtolower($model->formName()) . '-localityid'], 'placeholder' => 'Select Hotel', 'url' => Url::to(['/restaurant/restaurant/hotelsuggest'])]]);
?>
 


    <?php 
echo is_array($model->resMaps) && count($model->resMaps) ? $form->field($model->resMaps[0], 'phone', ['options' => ['id' => 'multiphone', 'class' => 'multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'clientId' => 'multiphone', 'form' => $form, 'options' => ['model' => $map, 'models' => $model->resMaps]]) : $form->field($map, 'phone', ['options' => ['id' => 'multiphone', 'class' => 'multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'clientId' => 'multiphone', 'form' => $form]);
echo is_array($model->resMaps) && count($model->resMaps) ? $form->field($model->resMaps[0], 'mobile', ['options' => ['id' => 'multimobile', 'class' => 'multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'clientId' => 'multimobile', 'form' => $form, 'options' => ['model' => $map, 'models' => $model->resMaps]]) : $form->field($map, 'mobile', ['options' => ['id' => 'multimobile', 'class' => 'multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'clientId' => 'multimobile', 'form' => $form]);
?>

    <?php 
// $form->field($model, 'mobile')->textInput(['maxlength' => 255])
?>

    <?php 
//$form->field($model, 'phone')->textInput(['maxlength' => 255])
예제 #4
0
 /**
  * Finds the Hotels model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Hotels the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Hotels::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }