Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Restaurant::find();
     if ($params['id']) {
         $query = Restaurant::find()->where('status!=0 and state !=4');
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['defaultOrder' => ['updatedOn' => SORT_DESC]]);
     //$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]]);
         return $dataProvider;
     }
     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(['Id' => $this->Id, 'sourceId' => $this->sourceId, 'chainId' => $this->chainId, 'cityId' => $this->cityId, 'localityId' => $this->localityId, 'zoneId' => $this->zoneId, 'pin' => $this->pin, 'entityType' => $this->entityType, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'priceForTwo' => $this->priceForTwo, 'capacity' => $this->capacity, 'coverFee' => $this->coverFee, 'entryFee' => $this->entryFee, 'ladiesFee' => $this->ladiesFee, 'hotelId' => $this->hotelId, 'status' => $this->status, 'healthStatus' => $this->healthStatus, 'popularityScore' => $this->popularityScore, 'popularityScroreParams' => $this->popularityScroreParams, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'popularpubs' => $this->popularpubs, 'launchdate' => $this->launchdate]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'phoneAlias', $this->phoneAlias])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'owner', $this->owner])->andFilterWhere(['like', 'manager', $this->manager])->andFilterWhere(['like', 'tips', $this->tips])->andFilterWhere(['like', 'famousFor', $this->famousFor])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'old_guid', $this->old_guid])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'specialities', $this->specialities]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Restaurant::find()->where('status=0');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'sourceId' => $this->sourceId, 'chainId' => $this->chainId, 'cityId' => $this->cityId, 'localityId' => $this->localityId, 'zoneId' => $this->zoneId, 'pin' => $this->pin, 'entityType' => $this->entityType, 'gpsLat' => $this->gpsLat, 'gpsLong' => $this->gpsLong, 'priceForTwo' => $this->priceForTwo, 'capacity' => $this->capacity, 'coverFee' => $this->coverFee, 'entryFee' => $this->entryFee, 'ladiesFee' => $this->ladiesFee, 'hotelId' => $this->hotelId, 'status' => $this->status, 'healthStatus' => $this->healthStatus, 'popularityScore' => $this->popularityScore, 'popularityScroreParams' => $this->popularityScroreParams, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'popularpubs' => $this->popularpubs, 'launchdate' => $this->launchdate]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'landmark', $this->landmark])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'tollfree', $this->tollfree])->andFilterWhere(['like', 'phoneAlias', $this->phoneAlias])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'owner', $this->owner])->andFilterWhere(['like', 'manager', $this->manager])->andFilterWhere(['like', 'tips', $this->tips])->andFilterWhere(['like', 'famousFor', $this->famousFor])->andFilterWhere(['like', 'guid', $this->guid])->andFilterWhere(['like', 'old_guid', $this->old_guid])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'specialities', $this->specialities]);
     return $dataProvider;
 }
 public function actionAutosuggestion($search = null)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $query = \common\models\Restaurant::find();
     if ($search) {
         $query->andFilterWhere(['like', 'name', $search . '%', false]);
     }
     //*/
     $query->andFilterWhere(['status' => \common\component\AppActiveRecord::STATUS_PUBLISH]);
     //*/
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
     $data = [];
     foreach ($dataProvider->getModels() as $model) {
         $NameString = $model->Id . ' - ' . $model->name . ' in ' . $model->localityname . ' ' . $model->cityname . ' (' . $model->zonename . ')';
         //$NameString = (string)$model->Id;
         $data[] = ['id' => $model->Id, 'text' => $NameString];
     }
     return $data;
 }
Пример #4
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;
     }
 }
Пример #5
0
 public function getRestaurantData($chainId, $cityId)
 {
     //echo $chainId; echo $cityId;die;
     $query = Restaurant::find()->where(['chainId' => $chainId]);
     if ($cityId) {
         $query->andFilterWhere(['cityId' => $cityId]);
     }
     $query->andFilterWhere(['status' => '1']);
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query]);
     return $dataProvider;
 }