- - - - - - -
diff --git a/common/models/OptionHelper.php b/common/models/OptionHelper.php index 4623524..fb374ef 100755 --- a/common/models/OptionHelper.php +++ b/common/models/OptionHelper.php @@ -14,7 +14,7 @@ class OptionHelper extends Model const OPTION_VALUE = 3; public function getRule($return = 3) { - $result = Options::find()->where(['name' => 'rules'])->with('value'); + $result = Option::find()->where(['name' => 'rules'])->with('value'); if($return == self::OPTION_OBJECT) { return $result->one(); } elseif($return == self::OPTION_ARRAY) { diff --git a/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php index 81a322a..ad43512 100755 --- a/console/migrations/m130524_201442_init.php +++ b/console/migrations/m130524_201442_init.php @@ -16,6 +16,9 @@ class m130524_201442_init extends Migration $this->createTable('{{%user}}', [ 'id' => $this->primaryKey(), 'username' => $this->string()->notNull()->unique(), + 'lastname' => $this->string(), + 'firstname' => $this->string(), + 'middlename' => $this->string(), 'auth_key' => $this->string(32)->notNull(), 'password_hash' => $this->string()->notNull(), 'password_reset_token' => $this->string()->unique(), @@ -25,6 +28,19 @@ class m130524_201442_init extends Migration 'created_at' => $this->integer()->notNull(), 'updated_at' => $this->integer()->notNull(), ], $tableOptions); + + $this->insert('{{%user}}', [ + 'username' => 'admin', + 'lastname' => 'admin', + 'firstname' => 'admin', + 'middlename' => '', + 'auth_key' => 'SlJ315le5enaDJ4OsdvXX83i_drf-JXl', + 'password_hash' => '$2y$13$LfYpoaZkKzniNw/7rySAnOVPHy8wKFFznxBVoAWTnbLv/Di0oXqvi', + 'password_reset_token' => 'NULL', + 'email' => 'admin@admin.com', + 'created_at' => '1', + 'updated_at' => '1', + ]); } public function down() diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 177872e..579ba3f 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -26,7 +26,8 @@ class AppAsset extends AssetBundle 'js/markerclusterer.js', 'js/jquery.scrollbox.min.js', 'js/slider.js', - 'js/jquery.rating.js' + 'js/jquery.rating.js', + '/admin/js/option.js' ]; public $depends = [ 'yii\web\YiiAsset', diff --git a/frontend/controllers/OptionController.php b/frontend/controllers/OptionController.php index 4efd7d5..6c68bf9 100755 --- a/frontend/controllers/OptionController.php +++ b/frontend/controllers/OptionController.php @@ -3,12 +3,11 @@ namespace frontend\controllers; use Yii; -use frontend\models\Option; -use frontend\models\OptionSearch; +use common\models\Option; +use common\models\OptionSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; -use frontend\models\OptionLang; /** * OptionController implements the CRUD actions for Option model. @@ -61,14 +60,17 @@ class OptionController extends Controller */ public function actionCreate() { - $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]], true); - if($form[0]['success'] == false) { - return $this->render('create', ['forms' => $form]); + $model = new Option(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_id]); } else { - return $this->redirect(['index']); + return $this->render('create', [ + 'model' => $model, + ]); } } - + /** * Updates an existing Option model. * If update is successful, the browser will be redirected to the 'view' page. @@ -77,11 +79,14 @@ class OptionController extends Controller */ public function actionUpdate($id) { - $form[0] = Option::change($id, \Yii::$app->request->post(), 'User', 10); - if($form[0]['success'] == false) { - return $this->render('update', ['forms' => $form]); + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_id]); } else { - return $this->redirect(['view', 'id' => $id]); + return $this->render('update', [ + 'model' => $model, + ]); } } @@ -93,23 +98,7 @@ class OptionController extends Controller */ public function actionDelete($id) { - $model = $this->findModel($id); - $children = $model->hasMany(Option::className(), ['parent_id' => 'option_id'])->all(); - $langs = array(); - if(!empty($children)) { - foreach($children as $child) { - $langs = OptionLang::findAll(['id' => $child->option_id]); - foreach($langs as $lang) { - $lang->delete(); - } - $child->delete(); - } - } - $langs = OptionLang::findAll(['id' => $id]); - foreach($langs as $lang) { - $lang->delete(); - } - $model->delete(); + $this->findModel($id)->delete(); return $this->redirect(['index']); } diff --git a/frontend/controllers/OptionValuesController.php b/frontend/controllers/OptionValuesController.php deleted file mode 100755 index f552de1..0000000 --- a/frontend/controllers/OptionValuesController.php +++ /dev/null @@ -1,147 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - /** - * Lists all OptionValues models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new OptionValuesSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single OptionValues model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new OptionValues model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $post = \Yii::$app->request->post(); - if(is_array($post['OptionValues']['option_value_text'])) { - $ok = 0; - $first = 0; - $id = 0; - $models = array(); - foreach($post['OptionValues']['option_value_text'] as $lang => $value) { - $models[$lang] = new OptionValues(); - $models[$lang]->load(Yii::$app->request->post()); - $models[$lang]->option_language_id = $lang; - $models[$lang]->option_value_text = $value; - if($first && $id) { - $models[$lang]->option_value_parent = $id; - } - if($models[$lang]->save()) { - $ok = 1; - if(!$first) { - $first = 1; - $id = $models[$lang]->option_value_id; - } - } else { - unset($models[$lang]); - } - } - if($ok) { - return $this->redirect(['view', 'id' => $id]); - } - } - $model = new OptionValues(); - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->option_value_id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing OptionValues model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->option_value_id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing OptionValues model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the OptionValues model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return OptionValues the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = OptionValues::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/frontend/controllers/OptionsController.php b/frontend/controllers/OptionsController.php deleted file mode 100755 index 2abe3cd..0000000 --- a/frontend/controllers/OptionsController.php +++ /dev/null @@ -1,121 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['post'], - ], - ], - ]; - } - - /** - * Lists all Options models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new OptionsSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Options model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Options model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Options(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->option_id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing Options model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->option_id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing Options model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Options model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Options the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Options::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} diff --git a/frontend/models/Option.php b/frontend/models/Option.php deleted file mode 100755 index cfa62bb..0000000 --- a/frontend/models/Option.php +++ /dev/null @@ -1,278 +0,0 @@ - 200] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'option_id' => Yii::t('app', 'Option ID'), - 'model' => Yii::t('app', 'Model'), - 'model_id' => Yii::t('app', 'Model ID'), - 'name' => Yii::t('app', 'Name'), - 'template' => Yii::t('app', 'Template'), - 'option_pid' => Yii::t('app', 'Parent ID'), - 'date_add' => Yii::t('app', 'Date created'), - 'translate' => Yii::t('app', 'Translatable'), - ]; - } - - public function getLangs() { - return (new Language())->find()->where(['>', 'language_id', 0])->andWhere(['status' => 1])->asArray()->all(); - } - - public static function change($id, $post, $modeldb, $model_id) { - $models[$id] = Option::findOne($id); - $modellang[$id] = array(); - $langs = OptionLang::findAll(['option_language_id' => $id]); - foreach($langs as $lang) { - $modellang[$id][$lang->language_id] = $lang; - } - $children = (new Option())->find()->where(['option_pid' => $id])->all(); - foreach($children as $child) { - $models[$child->option_id] = $child; - $modellang[$child->option_id] = array(); - $langs = OptionLang::findAll(['option_id' =>$child->option_id]); - foreach($langs as $lang) { - $modellang[$child->option_id][$lang->language_id] = $lang; - } - } - $ok = 1; - if(!empty($post)) { - foreach($post['Option'] as $key => $option) { - if(in_array($key, array('model', 'model_id'))) { continue; } - if(empty($option['value'][$models[$key]->name]) && !empty($option['lang'])) { - foreach($option['lang'] as $language_id => $lang) { - if(!empty($lang)) { - $option['value'][$models[$key]->name] = $lang; - break; - } - } - } - $modellang[$key][0]->value = $option['value'][$models[$key]->name]; - if(empty($modellang[$key][0]->value) || !$modellang[$key][0]->save()) { - $ok = 0; - $models[$key]->addError('value', 'Value must be set'); - $modellang[$key][0]->addError('value', 'Value must be set'); - } - if(!empty($option['lang'])) { - foreach($option['lang'] as $language_id => $lang) { - if(empty($modellang[$key][$language_id])) { - $modellang[$key][$language_id] = new OptionLang(); - $modellang[$key][$language_id]->option_id = $models[$key]->option_id; - $modellang[$key][$language_id]->language_id = $language_id; - $modellang[$key][$language_id]->value = $lang; - } else { - $modellang[$key][$language_id]->value = $lang; - } - if(!$modellang[$key][$language_id]->save()) { - $ok = 0; - } - } - } - } - if($ok) { - return array('id' => $id, 'models' => $models, 'modelslang' => $modelslang, 'success' => true); - } else { - return array( - 'models' => $models, - 'modellang' => $modellang, - 'modeldb' => $modeldb, - 'model_id' => $model_id, - 'success' => false - ); - } - } - return array( - 'models' => $models, - 'modellang' => $modellang, - 'modeldb' => $modeldb, - 'model_id' => $model_id, - 'success' => false - ); - } - - public static function create($post, $modeldb, $model_id, $fields, $multiple) { - $multiple = boolval($multiple); - $model = new Option(); - $modellang = new OptionLang(); - if(!empty($post['Option'])) { - $ok = 1; - $parentid = null; - $models = array(); - foreach($post['Option'] as $index => $option) { - if(in_array($index, array('model', 'model_id')) && $index !== 0) { continue; } - $first = 1; - foreach($option['value'] as $key => $value) { - $models[$index][$key] = new Option(); - $models[$index][$key]->model = $post['Option']['model']; - $models[$index][$key]->model_id = $post['Option']['model_id']; - $models[$index][$key]->template = $option[$key]['template']; - $models[$index][$key]->translate = $option[$key]['translate']?1:0; - $models[$index][$key]->name = $key; - if(!$first) { - $models[$index][$key]->option_pid = $parentid; - } - $modelslang[$index][$key][0] = new OptionLang(); - if(!empty($option['lang'][$key])) { - foreach($option['lang'][$key] as $code => $lang) { - if(!empty($lang)) { - $value = $lang; - break; - } - } - } - if(!empty($value) && $models[$index][$key]->save()) { - if($first) { - $parentid = $models[$index][$key]->option_id; - } - $modelslang[$index][$key][0]->option_id = $models[$index][$key]->option_id; - $modelslang[$index][$key][0]->language_id = 0; - $modelslang[$index][$key][0]->value = $value; - if($modelslang[$index][$key][0]->save()) { - if(!empty($option['lang'][$key])) { - foreach($option['lang'][$key] as $code => $lang) { - if(!empty($lang)) { - $modelslang[$index][$key][$code] = new OptionLang(); - $modelslang[$index][$key][$code]->option_id = $models[$index][$key]->option_id; - $modelslang[$index][$key][$code]->language_id = $code; - $modelslang[$index][$key][$code]->value = $lang; - if(!$modelslang[$index][$key][$code]->save()) { - $ok = 0; - } - } - } - } - } - } else { - $models[$index][$key]->validate(); - $modelslang[$index][$key][0]->validate(); - $modelslang[$index][$key][0]->addError('value', 'Value must be set'); - if(!empty($option['lang'][$key])) { - foreach($option['lang'][$key] as $code => $lang) { - if(!empty($lang)) { - $modelslang[$index][$key][$code] = new OptionLang(); - $modelslang[$index][$key][$code]->option_id = $models[$index][$key]->option_id; - $modelslang[$index][$key][$code]->language_id = $code; - $modelslang[$index][$key][$code]->value = $lang; - } - } - } - $ok = 0; - } - $first = 0; - } - } - if($ok) { - if($modeldb == 'Feedback') { - $newflag = new Option(); - $newflag->model = $modeldb; - $newflag->model_id = $model_id; - $newflag->name = 'is_new'; - $newflag->template = 'checkbox'; - $newflag->option_pid = $parentid; - $newflag->translate = 0; - if($newflag->save()) { - $newflaglang = new OptionLang(); - $newflaglang->option_id = $newflag->option_id; - $newflaglang->language_id = 0; - $newflaglang->value = '1'; - if(!$newflaglang->save()) { - $newflag->delete(); - } - } - } - return array('models' => $models, 'modelslang' => $modelslang, 'success' => true); - } else { - return array( - 'models' => $models, - 'modellang' => $modelslang, - 'modeldb' => $modeldb, - 'model_id' => $model_id, - 'fields' => $fields, - 'success' => false, - 'multiple' => $multiple - ); - } - } else { - return array( - 'model' => $model, - 'modeldb' => $modeldb, - 'model_id' => $model_id, - 'fields' => $fields, - 'success' => false, - 'multiple' => $multiple - ); - } - } - - public function getOptions() { - return $this->hasMany(Option::className(), ['option_pid' => 'option_id'])->indexBy('name'); - } - - public function getOption() { - return $this->hasOne(Option::className(), ['option_id' => 'option_pid']); - } - - public function getOptionLangs() { - return $this->hasMany(OptionLang::className(), ['option_id' => 'option_id']); - } - - public function getOptionDefaultLang($array = false) { - $query = $this->getOptionLangs()->where(['language_id' => 0]); - if($array) { - $query->asArray(); - } - return $query->one(); - } - - public static function markOld($id) { - $model = Option::findOne($id); - $is_new = $model->getOptions()->where(['name' => 'is_new'])->one(); - if(empty($is_new)) return false; - $is_newlang = $is_new->getOptionDefaultLang(); - $is_newlang->value = '0'; - if($is_newlang->save()) { - return true; - } else { - return false; - } - } - -} diff --git a/frontend/models/OptionLang.php b/frontend/models/OptionLang.php deleted file mode 100755 index 5b98585..0000000 --- a/frontend/models/OptionLang.php +++ /dev/null @@ -1,47 +0,0 @@ - Yii::t('app', 'ID'), - 'language_id' => Yii::t('app', 'Lang ID'), - 'value' => Yii::t('app', 'Value'), - ]; - } -} diff --git a/frontend/models/OptionLangSearch.php b/frontend/models/OptionLangSearch.php deleted file mode 100755 index 4ba6e1c..0000000 --- a/frontend/models/OptionLangSearch.php +++ /dev/null @@ -1,68 +0,0 @@ - $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([ - 'option_language_id' => $this->option_language_id, - 'option_id' => $this->option_id, - 'language_id' => $this->language_id, - ]); - - $query->andFilterWhere(['like', 'value', $this->value]); - - return $dataProvider; - } -} diff --git a/frontend/models/OptionSearch.php b/frontend/models/OptionSearch.php deleted file mode 100755 index 984970c..0000000 --- a/frontend/models/OptionSearch.php +++ /dev/null @@ -1,78 +0,0 @@ - $query, - ]); - $data = [ - 'OptionSearch' => [ - 'model' => 'Main' - ] - ]; - - $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->andWhere(['option_pid' => null]); - - $query->andFilterWhere([ - 'option_id' => $this->option_id, - 'model_id' => $this->model_id, - 'option_pid' => $this->option_pid, - ]); - - $query->andFilterWhere(['like', 'model', $this->model]) - ->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'template', $this->template]); - - - return $dataProvider; - } -} diff --git a/frontend/models/OptionValues.php b/frontend/models/OptionValues.php deleted file mode 100755 index 7ab4e2b..0000000 --- a/frontend/models/OptionValues.php +++ /dev/null @@ -1,97 +0,0 @@ - 200] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'option_value_id' => Yii::t('app', 'Option Value ID'), - 'option_key' => Yii::t('app', 'Option Key'), - 'option_value_text' => Yii::t('app', 'Option Value Text'), - 'option_language_id' => Yii::t('app', 'Option Lang ID'), - 'option_value_parent' => Yii::t('app', 'Option Value Parent'), - 'option_user' => Yii::t('app', 'Option User'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOptionLang() - { - return $this->hasOne(Language::className(), ['language_id' => 'option_language_id']); - } - public function getLanguages() { - return (new LanguageLang())->find()->orderBy('language_id ASC')->asArray()->all(); - } - public function getLanguagesCodes() { - return (new Language())->find()->orderBy('language_id ASC')->asArray()->all(); - } - public function getDropDownArray() { - $langs = array(); - foreach($this->getLanguages() as $lang) { - $langs[$lang['language_id']] = $lang['lang_title']; - } - return $langs; - } - public function beforeSave($insert) { - if (parent::beforeSave($insert)) { - $this->option_user = \Yii::$app->user->getId(); - if($this->option_value_parent == 0) { - unset($this->option_value_parent); - } - return true; - } else { - return false; - } - } - public function getUserOptions() { - return (new OptionValues())->find()->where('option_user=:user')->addParams([':user' => \Yii::$app->user->getID()])->andWhere(['not', ['option_user' => null]])->asArray()->all(); - } - public function getUserOptionsArray() { - $options = array('0' => Yii::t('app', 'Default Parent')); - foreach($this->getUserOptions() as $option) { - $options[$option['option_value_id']] = $option['option_key'].' - '.$option['option_value_text']; - } - return $options; - } -} diff --git a/frontend/models/OptionValuesSearch.php b/frontend/models/OptionValuesSearch.php deleted file mode 100755 index e8dafed..0000000 --- a/frontend/models/OptionValuesSearch.php +++ /dev/null @@ -1,70 +0,0 @@ - $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([ - 'option_value_id' => $this->option_value_id, - 'option_language_id' => $this->option_language_id, - 'option_value_parent' => $this->option_value_parent, - 'option_user' => $this->option_user, - ]); - - $query->andFilterWhere(['like', 'option_key', $this->option_key]) - ->andFilterWhere(['like', 'option_value_text', $this->option_value_text]); - - return $dataProvider; - } -} diff --git a/frontend/models/Options.php b/frontend/models/Options.php deleted file mode 100755 index 8efac0c..0000000 --- a/frontend/models/Options.php +++ /dev/null @@ -1,78 +0,0 @@ - 200] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels () - { - return [ - 'option_id' => Yii::t ('app', 'Option ID'), 'option_key' => Yii::t ('app', 'Option Key'), 'option_parent' => Yii::t ('app', 'Option Parent'), 'option_translatable' => Yii::t ('app', 'Option Translatable'), 'option_format' => Yii::t ('app', 'Option Format'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOptionLang () - { - return $this->hasMany (OptionLang::className (), ['option_id' => 'option_id']); - } - - public function getValue () - { - return $this->hasOne(OptionLang::className(), ['option_id' => 'option_id'])->where(['option_lang.language_id' => '0']); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOptionParent() - { - return $this->hasOne(Options::className(), ['option_id' => 'option_parent']); - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOptions() - { - return $this->hasMany(Options::className(), ['option_parent' => 'option_id']); - } -} diff --git a/frontend/models/OptionsSearch.php b/frontend/models/OptionsSearch.php deleted file mode 100755 index 0fbac03..0000000 --- a/frontend/models/OptionsSearch.php +++ /dev/null @@ -1,69 +0,0 @@ - $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([ - 'option_id' => $this->option_id, - 'option_parent' => $this->option_parent, - 'option_translatable' => $this->option_translatable, - ]); - - $query->andFilterWhere(['like', 'option_key', $this->option_key]) - ->andFilterWhere(['like', 'option_format', $this->option_format]); - - return $dataProvider; - } -} diff --git a/frontend/views/option-values/_form.php b/frontend/views/option-values/_form.php deleted file mode 100755 index 3d9f0d6..0000000 --- a/frontend/views/option-values/_form.php +++ /dev/null @@ -1,60 +0,0 @@ - - -
- = Html::a(Yii::t('app', 'Create Option Values'), ['create'], ['class' => 'btn btn-success']) ?> -
- - = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'option_value_id', - 'option_key', - 'option_value_text:ntext', - 'option_language_id', - 'option_value_parent', - // 'option_user', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> - -- = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->option_value_id], ['class' => 'btn btn-primary']) ?> - = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->option_value_id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'option_value_id', - 'option_key', - 'option_value_text:ntext', - 'option_language_id', - 'option_value_parent', - 'option_user', - ], - ]) ?> - -- -
- - - - - - -