/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ModulesModules::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['order' => SORT_ASC]]]); $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(['module_id' => $this->module_id, 'isFrontend' => $this->isFrontend, 'isAdmin' => $this->isAdmin, 'order' => $this->order, 'status' => $this->status]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'class', $this->class])->andFilterWhere(['like', 'controllerNamespace', $this->controllerNamespace])->andFilterWhere(['like', 'viewPath', $this->viewPath])->andFilterWhere(['like', 'AdminControllerNamespace', $this->AdminControllerNamespace])->andFilterWhere(['like', 'AdminViewPath', $this->AdminViewPath])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'icon', $this->icon])->andFilterWhere(['like', 'settings', $this->settings]); return $dataProvider; }
public function actionSetting($name) { $model = ModulesModules::find()->where(['name' => $name])->one(); if (Yii::$app->request->post('Settings')) { $model->setSettings(Yii::$app->request->post('Settings')); if ($model->save()) { $this->flash('alert-success', Yii::t('admin', 'Module settings updated')); if (Yii::$app->request->post('submit-type') == 'continue') { return $this->redirect(['settings', 'id' => $model->id]); } else { return $this->redirect(['index']); } } else { $this->flash('error', Yii::t('easyii', Yii::t('easyii', 'Update error. {0}', $model->formatErrors()))); return $this->redirect(['settings', 'id' => $model->id]); } } else { return $this->render('settings', ['model' => $model]); } }