Пример #1
0
 /**
  * Displays profile homepage.
  *
  * @return mixed
  */
 public function actionIndex($code = null)
 {
     $codes = Yii::$app->user->identity->availableCodes;
     $allCodes = array_merge($codes, Yii::$app->user->identity->availableGroupCodes);
     $campaigns = CodeBankCampaign::find()->where(['codeBank_code' => $allCodes])->all();
     $model = CodeBank::find()->where(['code' => $codes])->all();
     return $this->render('index', ['model' => $model, 'roleOptions' => $this->roleOptions, 'allCodes' => $allCodes, 'selectedCode' => $code, 'campaigns' => $campaigns]);
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CodeBankCampaign::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'objectId' => $this->objectId, 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'active' => $this->active, 'codeBank_code' => $this->codeBank_code]);
     //        $query->andFilterWhere(['like', 'codeBank_code', $this->codeBank_code])
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'modelClass', $this->modelClass]);
     return $dataProvider;
 }