Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRestaurants()
 {
     return $this->hasMany(Restaurant::className(), ['sourceId' => 'id']);
 }
Ejemplo n.º 4
0
 

    <?php 
echo $form->field($modelBrandsCityField, 'name')->checkbox(['label' => 'Lock']);
?>

    <?php 
echo $form->field($model, 'website')->textInput(['maxlength' => 225]);
?>

    <?php 
echo $form->field($modelBrandsCityField, 'website')->checkbox(['label' => 'Lock']);
?>

    <?php 
echo $form->field($model, 'pricefortwo')->dropDownList(ArrayHelper::merge(['' => 'Select'], \common\models\Restaurant::priceForTwo()));
?>
 

    <?php 
echo $form->field($modelBrandsCityField, 'pricefortwo')->checkbox(['label' => 'Lock']);
?>
 

    <?php 
/*/?><?= $form->field($model, 'cuisine')->dropDownList(ArrayHelper::merge([],ArrayHelper::map(\common\models\Cuisine::find()->andWhere(['status' => 1])->All(), 'Id', 'name')),['multiple'=>'multiple','size'=>7,'title'=>'Select Cuisines']) ?> <?php //*/
?>

    <?php 
echo $form->field($model, 'cuisine')->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']]);
?>
Ejemplo n.º 5
0
 public function actionChainrestaurant()
 {
     \yii::$app->user->setIdentity(\common\models\User::findByUsername('admin'));
     $usersData = \yii::$app->oldcmsdb->createCommand("SELECT est_id, est_est_grp_id\n                    FROM \n                        tc_establishments order by est_id")->query();
     while ($row = $usersData->read()) {
         $attributes = array('Id' => $row['est_id'], 'chainId' => $row['est_est_grp_id'], 'createdBy' => 40, 'updatedBy' => 40, 'status' => 1);
         //print_r($attributes);
         //echo "\n";
         if (($restaurant = Restaurant::findOne($attributes['Id'])) !== null) {
             $restaurant->detachBehavior('timestamp');
             $restaurant->detachBehavior('user');
             $restaurant->setAttributes($attributes);
             //$restaurant->Id = $attributes['Id'];
             if ($restaurant->update(false) !== false) {
                 echo "restaurant Id:" . $attributes['Id'] . ": imported\n";
             } else {
                 echo "restaurant Id:" . $attributes['Id'] . ": not imported\n";
             }
         } else {
             //echo "restaurant Id:".$attributes['Id'].": not available\n";
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRestaurants()
 {
     return $this->hasMany(Restaurant::className(), ['hotelId' => 'Id']);
 }
 protected function findRestaurantModel($id)
 {
     if (($model = Restaurant::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRestaurant()
 {
     return $this->hasOne(Restaurant::className(), ['Id' => 'restaurantID']);
 }
 public function actionLoadchain()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $model = new Restaurant();
     $map = new \common\models\ResMap();
     if ($model->load(Yii::$app->request->post())) {
         $chaindata = $model->chainCity;
         $chainmapstatus = $chaindata->chainFieldStatusMaps;
         \yii::trace(print_r($chainmapstatus, true));
         $finalmap = [];
         foreach ($model->chainFieldMap() as $map) {
             $map['id'] = \yii\helpers\BaseHtml::getInputId($model, $map['id']);
             $map['lock'] = $chainmapstatus->{$map['value']};
             $map['value'] = $chaindata->{$map['value']};
             $finalmap[] = $map;
         }
         return ['responce' => ['map' => $finalmap]];
     } else {
         return ['responce' => 'false'];
     }
 }
Ejemplo n.º 10
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;
     }
 }
Ejemplo n.º 11
0
 public function getEst()
 {
     return $this->hasOne(Restaurant::className(), ['Id' => 'estId']);
 }
Ejemplo n.º 12
0
 public function AddRestaurants($restaurantIds)
 {
     $db = static::getDb();
     $transaction = $db->beginTransaction();
     $restaurantAr = [];
     try {
         foreach ($restaurantIds as $values) {
             $restaurantAr[] = $model = Restaurant::findOne($values);
             $model->alocateChain($this, false);
         }
         $transaction->commit();
         try {
             foreach ($restaurantAr as $resmodel) {
                 $resmodel->published();
             }
         } catch (\Exception $e) {
             \yii::trace($e->getMessage());
             return false;
         }
     } catch (\Exception $e) {
         \yii::trace($e->getMessage());
         $transaction->rollBack();
         return false;
     }
 }
Ejemplo n.º 13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRestaurants()
 {
     return $this->hasMany(Restaurant::className(), ['chainId' => 'chainId'])->via('chainCityMaps');
 }