public function search($params) { $query = Locality::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->andFilterWhere([Locality::tableName() . '.status' => '1']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'cityId' => $this->cityId, 'zoneId' => $this->zoneId, 'createdOn' => $this->createdOn, 'status' => $this->status, 'isFg' => $this->isFg, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'pin' => $this->pin, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'nearBy', $this->nearBy])->andFilterWhere(['like', 'ip', $this->ip]); return $dataProvider; }
echo $form->field($model, 'name')->textInput(['maxlength' => 200]); ?> <?php echo $form->field($model, 'type')->dropDownList(['' => 'Select', '0' => 'Other', '1' => 'Hotel', '2' => 'Mall', '3' => 'Shopping Complex', '4' => '4/5 Star Hotel']); ?> <?php echo $form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))); echo $form->field($model, 'localityId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-localityid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Locality::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid', strtolower($model->formName()) . '-zoneid'], 'placeholder' => 'Select Locality', 'url' => Url::to(['/locality/locality/autosuggest'])]]); ?> <?php echo $form->field($model, 'status')->hiddenInput(['value' => 1])->label(''); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?>
public function getLocality() { return $this->hasOne(Locality::className(), ['Id' => 'localityId']); }
/** * Finds the Locality model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Locality the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Locality::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionZonesuggest() { $request = Yii::$app->request->post(); $locality = $request['depdrop_parents'][0]; $data = \common\models\Locality::findOne(['status' => 1, 'Id' => $locality]); $obj = new \stdClass(); $obj->id = $data->zoneId; $obj->name = $data->name; $dataLoc[] = $obj; $result = new \stdClass(); $result->output = $dataLoc; $result->selected = $obj->id; header('Content-Type: application/json'); echo Json::encode($result); \yii::$app->end(); }
public function behaviors() { return array_merge(parent::behaviors(), ['url' => ['class' => 'yii\\behaviors\\AttributeBehavior', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => 'guid', ActiveRecord::EVENT_BEFORE_UPDATE => 'guid'], 'value' => function ($event) { $url = ''; $estId = $this->Id; $estName = $this->urlFilter($this->name); $locality = Locality::findOne(['Id' => $this->localityId]); $estLocName = $locality->name; $estAdd1 = $this->address; $estLandmark = $this->landmark; if (isset($this->cuisines[0]['Id'])) { $cuisine = Cuisine::findOne(['Id' => $this->cuisines[0]['Id']]); } else { $cuisine = Cuisine::findOne(['Id' => $this->cuisines[0]]); } $estCuisineName = $cuisine->name; $estWhichTypeID = $this->entityType; $popLocName = ''; if ($estLocName != '') { $popLocName = $this->urlFilter($estLocName); } $estCityName = $this->urlFilter($this->cityname); if ($popLocName == "" && $estAdd1 != "") { $popLocName = $this->urlFilter(stripslashes($estAdd1)); } else { if ($popLocName == "" && $estAdd1 == "" && $estLandmark != "") { $popLocName = $this->urlFilter(stripslashes($estLandmark)); } } if ($popLocName == "") { $popLocName = "no-location"; } if ($estWhichTypeID == 1) { if (trim($estCuisineName) != '') { $popCusName = $this->urlFilter($estCuisineName) . "-"; } $url = '/' . $estCityName . '/' . $popLocName . '/' . $popCusName . 'restaurant-' . $estName . '/' . $estId; } else { $url = '/' . $estCityName . '/' . $popLocName . '/bar-' . $estName . '/' . $estId; } return $url; }], 'chainId' => ['class' => 'yii\\behaviors\\AttributeBehavior', 'attributes' => [ActiveRecord::EVENT_BEFORE_INSERT => 'chainId', ActiveRecord::EVENT_BEFORE_UPDATE => 'chainId'], 'value' => function ($event) { if ($this->chainId > 0) { return $this->chainId; } else { return 0; } }]]); }
} $mobile_form = ''; if(is_array($model->venueMap) && count($model->venueMap)){ foreach($model->venueMap as $mapmodel){ $mobile_form .= $form->field($mapmodel->venueMap, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']); } }else{ $mobile_form = $form->field($map, 'mobile')->textInput(['maxlength' => 255,'name'=>$model->formName().'[mobile][]']); } //*/ //echo "<pre>"; // // // var_dump($model); echo Collapse::widget(['box' => true, 'items' => ['Basic Details' => ['content' => implode("\n", [$form->field($model, 'venueType')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\VenueType::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'name')->textInput(['maxlength' => 255])]), 'contentOptions' => ['class' => 'in'], 'options' => ['class' => 'box-primary']], 'Contact Details' => ['content' => implode("\n", [$form->field($model, 'contactName')->textInput(['maxlength' => 255]), $form->field($model, 'email')->textInput(['maxlength' => 255]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'phone', ['selectors' => ['input' => '.multiphone']])->widget(DynamicField::className(), ['name' => $model->formName() . '[phone][]', 'options' => ['class' => 'multiphone']]), is_array($model->venueMap) && count($model->venueMap) ? $form->field($model->venueMap[0], 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile', 'model' => $map, 'models' => $model->venueMap]]) : $form->field($map, 'mobile', ['selectors' => ['input' => '.multimobile']])->widget(DynamicField::className(), ['name' => $model->formName() . '[mobile][]', 'options' => ['class' => 'multimobile']]), $form->field($model, 'tollfree')->textInput(['maxlength' => 15])]), 'options' => ['class' => 'box-success']], 'Location Details' => ['content' => implode("\n", [$form->field($model, 'cityId')->dropDownList(ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\City::find()->andWhere(['status' => 1])->All(), 'Id', 'name'))), $form->field($model, 'zoneId')->widget(DepDrop::classname(), ['options' => ['id' => strtolower($model->formName()) . '-zoneid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Zone::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid'], 'placeholder' => 'Select Zone', 'url' => Url::to(['/zone/zone/autosuggest'])]]), $form->field($model, 'localityId')->widget(DepDrop::classname(), ['options' => ['id' => 'venue-localityid'], 'data' => ArrayHelper::merge(['' => 'Select'], ArrayHelper::map(\common\models\Locality::find()->andWhere(['status' => 1, 'cityId' => $model->cityId])->All(), 'Id', 'name')), 'type' => DepDrop::TYPE_SELECT2, 'pluginOptions' => ['depends' => [strtolower($model->formName()) . '-cityid', strtolower($model->formName()) . '-zoneid'], 'placeholder' => 'Select Locality', 'url' => Url::to(['/locality/locality/autosuggest'])]]), $form->field($model, 'address')->textInput(['maxlength' => 255]), $form->field($model, 'landmark')->textInput(['maxlength' => 255]), $form->field($model, 'gpsLat')->textInput(), $form->field($model, 'gpsLong')->textInput()]), 'options' => ['class' => 'box-danger']], 'More Details' => ['content' => implode("\n", [$form->field($model, 'description')->textarea(['rows' => 6]), $form->field($model, 'facility')->listBox(ArrayHelper::merge([0 => 'Select'], ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1, 'flag' => 1])->All(), 'Id', 'name')), ['id' => 'facility', 'multiple' => 'multiple']), $form->field($model, 'url')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://timescity.com']), $form->field($model, 'facebookUrl')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://facebook.com']), $form->field($model, 'seatType')->textInput(['maxlength' => 100]), $form->field($model, 'capacity')->textInput(), $form->field($model, 'reservationInfo')->textInput(['maxlength' => 100]), $form->field($model, 'startTime')->textInput(), $form->field($model, 'endTime')->textInput(), $model->multipleFormField('tag', $model->getTagData())]), 'options' => ['class' => 'box-info']], 'Images' => ['content' => MediaUpload::widget(['data' => $model->media['images'], 'previewurl' => yii::$app->params['imagepreviewurl'], 'path' => 'venue', 'options' => ['addRemoveLinks' => true, 'inputparam' => $model->formName() . '[media][]']]), 'options' => ['class' => 'box-info']]]]); echo WorkflowButtons::widget(['view' => $this, 'model' => $model]); Column::end(); Row::end(); ?> <?php /*/?> <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?> <?= $form->field($model, 'cityId')->textInput() ?> <?= $form->field($model, 'zoneId')->textInput() ?> <?= $form->field($model, 'localityId')->textInput() ?>