public function search($params) { $query = Features::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]); $query->andFilterWhere([features::tableName() . '.status' => '0']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'createdOn' => $this->createdOn, 'status' => $this->status, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'flag' => $this->flag]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'ip', $this->ip]); return $dataProvider; }
/** * Finds the Features model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Features the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Features::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getFeature() { return $this->hasOne(Features::className(), ['Id' => 'featureId']); }
/** * @return array */ public function getFacility() { return $this->hasMany(Features::className(), ['Id' => 'facilityId'])->via('venueMap'); }
echo $form->field($model, 'tollfree')->textInput(['maxlength' => 15]); ?> <p><h4 class="box-title">Location Details</h4></p> <?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, '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'])]]); echo $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'])]]); echo $form->field($model, 'address')->textInput(['maxlength' => 255]); echo $form->field($model, 'landmark')->textInput(['maxlength' => 255]); echo $form->field($model, 'gpsLat')->textInput(); echo $form->field($model, 'gpsLong')->textInput(); ?> <p><h4 class="box-title">More Details</h4></p> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); echo $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']); echo $form->field($model, 'url')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://timescity.com']); echo $form->field($model, 'facebookUrl')->textInput(['maxlength' => 100, 'placeholder' => 'Type a valid url ex: http://facebook.com']); echo $form->field($model, 'seatType')->textInput(['maxlength' => 100]); echo $form->field($model, 'capacity')->textInput(); echo $form->field($model, 'reservationInfo')->textInput(['maxlength' => 100]); echo $form->field($model, 'startTime')->textInput(['placeholder' => '(e.g: HH:MM)']); echo $form->field($model, 'endTime')->textInput(['placeholder' => '(e.g: HH:MM)']); echo $model->multipleFormField('tag', $model->getTagData()); ?> <p><h4 class="box-title">Images</h4></p> <?php echo MediaUpload::widget(['data' => $model->media['images'], 'previewurl' => yii::$app->params['imagepreviewurl'], 'path' => 'venue', 'options' => ['addRemoveLinks' => true, 'inputparam' => $model->formName() . '[media][]']]); ?>
<?php echo $form->field($model, 'priceForTwo')->dropDownList(ArrayHelper::merge(['' => 'Select'], \common\models\Restaurant::priceForTwo())); ?> <?php // $form->field($model, 'pin')->textInput() ?> <?php echo $form->field($model, 'cuisines')->widget(Multiselect::className(), ['data' => ArrayHelper::merge([], ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), 'options' => ['multiple' => 'multiple', 'size' => 7, 'title' => 'Select Cuisines']]); ?> <?php echo $form->field($model, 'feature')->widget(Multiselect::className(), ['data' => ArrayHelper::merge([], ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), 'options' => ['multiple' => 'multiple', 'size' => 7, 'title' => 'Select Features']]); ?> <?php echo $form->field($model, 'payment')->widget(Multiselect::className(), ['data' => ArrayHelper::merge([], ArrayHelper::map(\common\models\Payments::find()->andWhere(['status' => 1])->All(), 'Id', 'name')), 'options' => ['multiple' => 'multiple', 'size' => 7, 'title' => 'Select Payment']]); ?> <?php // $form->field($model, 'description')->textarea(['rows' => 6]) ?> <?php // $form->field($model, 'alias')->textInput(['maxlength' => 255]) ?>
/** * @return \yii\db\ActiveQuery */ public function getFeature() { return $this->hasMany(Features::className(), ['Id' => 'featureId'])->via('resMaps'); /*/ $data = []; foreach($this->resMaps as $model){ if($model->featureId){ $data[]=$model->featureId; } } return $data; //*/ }
} $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() ?>
?> <?php //<?= $form->field($model, 'old_guid')->textInput(['maxlength' => 512]) ?> <?php echo $form->field($model, 'cuisines')->dropDownList(ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[cuisineId][]']); ?> <?php echo $form->field($model, 'types')->dropDownList(ArrayHelper::map(\common\models\Types::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[typesId][]']); ?> <?php echo $form->field($model, 'feature')->dropDownList(ArrayHelper::map(\common\models\Features::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[featureId][]']); ?> <?php echo $form->field($model, 'payment')->dropDownList(ArrayHelper::map(\common\models\Payments::find()->andWhere(['status' => 1])->All(), 'Id', 'name'), ['multiple' => 'multiple', 'size' => 5, 'name' => 'Pivot[paymentId][]']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>