Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Venue::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     // $query->andFilterWhere(['NOT',['status' => '0']]);
     $query->andWhere("not ((`state`=" . AppActiveRecord::STATUS_DRAFT . ") AND (`createdBy`!=" . \yii::$app->user->id . "))");
     if (!($this->load($params) && $this->validate())) {
         $query->andFilterWhere(['NOT', ['state' => AppActiveRecord::STATUS_DELETE]]);
         $dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]);
         return $dataProvider;
     }
     //$query->orderBy(['updatedOn' => SORT_DESC]);
     $query->andFilterWhere(['Id' => $this->Id, 'categoryId' => $this->categoryId, 'cityId' => $this->cityId, 'zoneId' => $this->zoneId, 'localityId' => $this->localityId, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'venueType' => $this->venueType, 'capacity' => $this->capacity, 'startTime' => $this->startTime, 'endTime' => $this->endTime, 'IsReccomended' => $this->IsReccomended, 'status' => $this->status, 'flag' => $this->flag, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'csvUpload' => $this->csvUpload, 'entityType' => $this->entityType]);
     if ($this->state !== null) {
         if ($this->state == AppActiveRecord::STATUS_DRAFT) {
             $query->andFilterWhere(['state' => $this->state, 'createdBy' => \yii::$app->user->id]);
         } else {
             $query->andFilterWhere(['state' => $this->state]);
         }
     } else {
         $query->andFilterWhere(['NOT', ['state' => AppActiveRecord::STATUS_DELETE]]);
     }
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'facility', $this->facility])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'contactName', $this->contactName])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'facebookUrl', $this->facebookUrl])->andFilterWhere(['like', 'seatType', $this->seatType])->andFilterWhere(['like', 'reservationInfo', $this->reservationInfo])->andFilterWhere(['like', 'audiVsCapcity', $this->audiVsCapcity])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'oldGuid', $this->oldGuid])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'csvRemarks', $this->csvRemarks])->andFilterWhere(['like', 'brand', $this->brand])->andFilterWhere(['like', 'mall', $this->mall]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Venue::find();
     $query->andFilterWhere(['state' => AppActiveRecord::STATUS_DELETE]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere([Venue::tableName() . '.status' => '0']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'categoryId' => $this->categoryId, 'cityId' => $this->cityId, 'zoneId' => $this->zoneId, 'localityId' => $this->localityId, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'venueType' => $this->venueType, 'capacity' => $this->capacity, 'startTime' => $this->startTime, 'endTime' => $this->endTime, 'IsReccomended' => $this->IsReccomended, 'status' => $this->status, 'flag' => $this->flag, 'createdOn' => $this->createdOn, 'createdBy' => $this->createdBy, 'updatedOn' => $this->updatedOn, 'updatedBy' => $this->updatedBy, 'csvUpload' => $this->csvUpload, 'entityType' => $this->entityType]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'facility', $this->facility])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'contactName', $this->contactName])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'facebookUrl', $this->facebookUrl])->andFilterWhere(['like', 'seatType', $this->seatType])->andFilterWhere(['like', 'reservationInfo', $this->reservationInfo])->andFilterWhere(['like', 'audiVsCapcity', $this->audiVsCapcity])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'oldGuid', $this->oldGuid])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'csvRemarks', $this->csvRemarks])->andFilterWhere(['like', 'brand', $this->brand])->andFilterWhere(['like', 'mall', $this->mall])->andFilterWhere(['like', 'tags', $this->tags]);
     return $dataProvider;
 }
Пример #3
0
 /**
  * Finds the Venue model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Venue the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Venue::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVenue()
 {
     return $this->hasOne(Venue::className(), ['Id' => 'venueId']);
 }
Пример #5
0
 /**
  * 
  * @param string $q
  * @return JSON encoded associative array of suggested venue
  * @author Atul
  */
 public function actionFetchVenue($q = null, $cityId = 0, $type = 0)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     if ($type == 0) {
         $query = Restaurant::find()->with('city', 'locality', 'zone');
     } else {
         $query = \common\models\Venue::find()->with('city', 'locality', 'zone');
     }
     if (!empty($cityId)) {
         if ($cityId) {
             $query->andFilterWhere(['cityId' => $cityId]);
         }
         if ($q) {
             $query->andFilterWhere(['like', 'name', $q . '%', false]);
         }
         //*/
         $query->andFilterWhere(['status' => \common\component\AppActiveRecord::STATUS_PUBLISH]);
         //*/
         $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
         $data = [];
         foreach ($dataProvider->getModels() as $model) {
             $NameString = $model->name . ' in ' . $model->localityname . ' ' . $model->cityname . '(' . $model->zonename . ')';
             $data[] = ['id' => $model->Id, 'value' => $NameString];
         }
         return $data;
     }
 }