Commit 84296a63183ad97ae74a1e5fcdf3e5469925fd70
1 parent
5cfbf2a2
add variantSku
Showing
11 changed files
with
402 additions
and
766 deletions
Show diff stats
controllers/SeoController.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - namespace artweb\artbox\seo\controllers; | |
| 4 | - | |
| 5 | - use Yii; | |
| 6 | - use artweb\artbox\seo\models\Seo; | |
| 7 | - use artweb\artbox\seo\models\SeoSearch; | |
| 8 | - use yii\web\Controller; | |
| 9 | - use yii\web\NotFoundHttpException; | |
| 10 | - use yii\filters\VerbFilter; | |
| 11 | - use developeruz\db_rbac\behaviors\AccessBehavior; | |
| 12 | - | |
| 2 | + | |
| 3 | +namespace artweb\artbox\seo\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use artweb\artbox\seo\models\Seo; | |
| 7 | +use artweb\artbox\seo\models\SeoSearch; | |
| 8 | +use yii\web\Controller; | |
| 9 | +use yii\web\NotFoundHttpException; | |
| 10 | +use yii\filters\VerbFilter; | |
| 11 | +use developeruz\db_rbac\behaviors\AccessBehavior; | |
| 12 | +/** | |
| 13 | + * SeoController implements the CRUD actions for Seo model. | |
| 14 | + */ | |
| 15 | +class SeoController extends Controller | |
| 16 | +{ | |
| 13 | 17 | /** |
| 14 | - * SeoController implements the CRUD actions for Seo model. | |
| 18 | + * @inheritdoc | |
| 15 | 19 | */ |
| 16 | - class SeoController extends Controller | |
| 20 | + public function behaviors() | |
| 17 | 21 | { |
| 18 | - | |
| 19 | - /** | |
| 20 | - * @inheritdoc | |
| 21 | - */ | |
| 22 | - public function behaviors() | |
| 23 | - { | |
| 24 | - return [ | |
| 25 | - 'access' => [ | |
| 26 | - 'class' => AccessBehavior::className(), | |
| 27 | - 'rules' => [ | |
| 28 | - 'site' => [ | |
| 29 | - [ | |
| 30 | - 'actions' => [ | |
| 31 | - 'login', | |
| 32 | - 'error', | |
| 33 | - ], | |
| 34 | - 'allow' => true, | |
| 35 | - ], | |
| 36 | - ], | |
| 37 | - ], | |
| 38 | - ], | |
| 39 | - 'verbs' => [ | |
| 40 | - 'class' => VerbFilter::className(), | |
| 41 | - | |
| 42 | - ], | |
| 43 | - ]; | |
| 44 | - } | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * Lists all Seo models. | |
| 48 | - * | |
| 49 | - * @return mixed | |
| 50 | - */ | |
| 51 | - public function actionIndex() | |
| 52 | - { | |
| 53 | - $searchModel = new SeoSearch(); | |
| 54 | - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 55 | - | |
| 56 | - return $this->render( | |
| 57 | - 'index', | |
| 58 | - [ | |
| 59 | - 'searchModel' => $searchModel, | |
| 60 | - 'dataProvider' => $dataProvider, | |
| 61 | - ] | |
| 62 | - ); | |
| 63 | - } | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * Displays a single Seo model. | |
| 67 | - * | |
| 68 | - * @param integer $id | |
| 69 | - * | |
| 70 | - * @return mixed | |
| 71 | - */ | |
| 72 | - public function actionView($id) | |
| 73 | - { | |
| 74 | - return $this->render( | |
| 75 | - 'view', | |
| 76 | - [ | |
| 77 | - 'model' => $this->findModel($id), | |
| 78 | - ] | |
| 79 | - ); | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * Creates a new Seo model. | |
| 84 | - * If creation is successful, the browser will be redirected to the 'view' page. | |
| 85 | - * | |
| 86 | - * @return mixed | |
| 87 | - */ | |
| 88 | - public function actionCreate() | |
| 89 | - { | |
| 90 | - $model = new Seo(); | |
| 91 | - $model->generateLangs(); | |
| 92 | - | |
| 93 | - if ($model->load(Yii::$app->request->post())) { | |
| 94 | - $model->loadLangs(\Yii::$app->request); | |
| 95 | - if ($model->save() && $model->transactionStatus) { | |
| 96 | - return $this->redirect( | |
| 22 | + return [ | |
| 23 | + 'access'=>[ | |
| 24 | + 'class' => AccessBehavior::className(), | |
| 25 | + 'rules' => | |
| 26 | + ['site' => | |
| 97 | 27 | [ |
| 98 | - 'view', | |
| 99 | - 'id' => $model->id, | |
| 100 | - ] | |
| 101 | - ); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - return $this->render( | |
| 105 | - 'create', | |
| 106 | - [ | |
| 107 | - 'model' => $model, | |
| 108 | - 'modelLangs' => $model->modelLangs, | |
| 109 | - ] | |
| 110 | - ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Updates an existing Seo model. | |
| 115 | - * If update is successful, the browser will be redirected to the 'view' page. | |
| 116 | - * | |
| 117 | - * @param integer $id | |
| 118 | - * | |
| 119 | - * @return mixed | |
| 120 | - */ | |
| 121 | - public function actionUpdate($id) | |
| 122 | - { | |
| 123 | - $model = $this->findModel($id); | |
| 124 | - $model->generateLangs(); | |
| 125 | - if ($model->load(Yii::$app->request->post())) { | |
| 126 | - $model->loadLangs(\Yii::$app->request); | |
| 127 | - if ($model->save() && $model->transactionStatus) { | |
| 128 | - return $this->redirect( | |
| 129 | - [ | |
| 130 | - 'view', | |
| 131 | - 'id' => $model->id, | |
| 28 | + [ | |
| 29 | + 'actions' => ['login', 'error'], | |
| 30 | + 'allow' => true, | |
| 31 | + ] | |
| 132 | 32 | ] |
| 133 | - ); | |
| 134 | - } | |
| 135 | - } | |
| 136 | - return $this->render( | |
| 137 | - 'update', | |
| 138 | - [ | |
| 139 | - 'model' => $model, | |
| 140 | - 'modelLangs' => $model->modelLangs, | |
| 141 | - ] | |
| 142 | - ); | |
| 33 | + ] | |
| 34 | + ], | |
| 35 | + 'verbs' => [ | |
| 36 | + 'class' => VerbFilter::className(), | |
| 37 | + | |
| 38 | + ], | |
| 39 | + ]; | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Lists all Seo models. | |
| 44 | + * @return mixed | |
| 45 | + */ | |
| 46 | + public function actionIndex() | |
| 47 | + { | |
| 48 | + $searchModel = new SeoSearch(); | |
| 49 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 50 | + | |
| 51 | + return $this->render('index', [ | |
| 52 | + 'searchModel' => $searchModel, | |
| 53 | + 'dataProvider' => $dataProvider, | |
| 54 | + ]); | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * Displays a single Seo model. | |
| 59 | + * @param integer $id | |
| 60 | + * @return mixed | |
| 61 | + */ | |
| 62 | + public function actionView($id) | |
| 63 | + { | |
| 64 | + return $this->render('view', [ | |
| 65 | + 'model' => $this->findModel($id), | |
| 66 | + ]); | |
| 67 | + } | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Creates a new Seo model. | |
| 71 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 72 | + * @return mixed | |
| 73 | + */ | |
| 74 | + public function actionCreate() | |
| 75 | + { | |
| 76 | + $model = new Seo(); | |
| 77 | + | |
| 78 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 79 | + return $this->redirect(['view', 'id' => $model->seo_id]); | |
| 80 | + } else { | |
| 81 | + return $this->render('create', [ | |
| 82 | + 'model' => $model, | |
| 83 | + ]); | |
| 143 | 84 | } |
| 144 | - | |
| 145 | - /** | |
| 146 | - * Deletes an existing Seo model. | |
| 147 | - * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 148 | - * | |
| 149 | - * @param integer $id | |
| 150 | - * | |
| 151 | - * @return mixed | |
| 152 | - */ | |
| 153 | - public function actionDelete($id) | |
| 154 | - { | |
| 155 | - $this->findModel($id) | |
| 156 | - ->delete(); | |
| 157 | - | |
| 158 | - return $this->redirect([ 'index' ]); | |
| 85 | + } | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * Updates an existing Seo model. | |
| 89 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 90 | + * @param integer $id | |
| 91 | + * @return mixed | |
| 92 | + */ | |
| 93 | + public function actionUpdate($id) | |
| 94 | + { | |
| 95 | + $model = $this->findModel($id); | |
| 96 | + | |
| 97 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 98 | + return $this->redirect(['view', 'id' => $model->seo_id]); | |
| 99 | + } else { | |
| 100 | + return $this->render('update', [ | |
| 101 | + 'model' => $model, | |
| 102 | + ]); | |
| 159 | 103 | } |
| 160 | - | |
| 161 | - /** | |
| 162 | - * Finds the Seo model based on its primary key value. | |
| 163 | - * If the model is not found, a 404 HTTP exception will be thrown. | |
| 164 | - * | |
| 165 | - * @param integer $id | |
| 166 | - * | |
| 167 | - * @return Seo the loaded model | |
| 168 | - * @throws NotFoundHttpException if the model cannot be found | |
| 169 | - */ | |
| 170 | - protected function findModel($id) | |
| 171 | - { | |
| 172 | - if (( $model = Seo::find() | |
| 173 | - ->where([ 'id' => $id ]) | |
| 174 | - ->with('lang') | |
| 175 | - ->one() ) !== null | |
| 176 | - ) { | |
| 177 | - return $model; | |
| 178 | - } else { | |
| 179 | - throw new NotFoundHttpException('The requested page does not exist.'); | |
| 180 | - } | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Deletes an existing Seo model. | |
| 108 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 109 | + * @param integer $id | |
| 110 | + * @return mixed | |
| 111 | + */ | |
| 112 | + public function actionDelete($id) | |
| 113 | + { | |
| 114 | + $this->findModel($id)->delete(); | |
| 115 | + | |
| 116 | + return $this->redirect(['index']); | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Finds the Seo model based on its primary key value. | |
| 121 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 122 | + * @param integer $id | |
| 123 | + * @return Seo the loaded model | |
| 124 | + * @throws NotFoundHttpException if the model cannot be found | |
| 125 | + */ | |
| 126 | + protected function findModel($id) | |
| 127 | + { | |
| 128 | + if (($model = Seo::findOne($id)) !== null) { | |
| 129 | + return $model; | |
| 130 | + } else { | |
| 131 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 181 | 132 | } |
| 182 | 133 | } |
| 134 | +} | ... | ... |
models/Seo.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - namespace artweb\artbox\seo\models; | |
| 4 | - | |
| 5 | - use artweb\artbox\language\behaviors\LanguageBehavior; | |
| 6 | - use Yii; | |
| 7 | - use yii\db\ActiveQuery; | |
| 8 | - use yii\db\ActiveRecord; | |
| 9 | - use yii\web\Request; | |
| 10 | - | |
| 2 | + | |
| 3 | +namespace artweb\artbox\seo\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "seo". | |
| 9 | + * | |
| 10 | + * @property integer $seo_id | |
| 11 | + * @property string $url | |
| 12 | + * @property string $title | |
| 13 | + * @property string $meta | |
| 14 | + * @property string $description | |
| 15 | + * @property string $h1 | |
| 16 | + * @property string $seo_text | |
| 17 | + */ | |
| 18 | +class Seo extends \yii\db\ActiveRecord | |
| 19 | +{ | |
| 11 | 20 | /** |
| 12 | - * This is the model class for table "seo". | |
| 13 | - * | |
| 14 | - * @property integer $id | |
| 15 | - * @property string $url | |
| 16 | - * * From language behavior * | |
| 17 | - * @property SeoLang $lang | |
| 18 | - * @property SeoLang[] $langs | |
| 19 | - * @property SeoLang $objectLang | |
| 20 | - * @property string $ownerKey | |
| 21 | - * @property string $langKey | |
| 22 | - * @property SeoLang[] $modelLangs | |
| 23 | - * @property bool $transactionStatus | |
| 24 | - * @method string getOwnerKey() | |
| 25 | - * @method void setOwnerKey( string $value ) | |
| 26 | - * @method string getLangKey() | |
| 27 | - * @method void setLangKey( string $value ) | |
| 28 | - * @method ActiveQuery getLangs() | |
| 29 | - * @method ActiveQuery getLang( integer $language_id ) | |
| 30 | - * @method SeoLang[] generateLangs() | |
| 31 | - * @method void loadLangs( Request $request ) | |
| 32 | - * @method bool linkLangs() | |
| 33 | - * @method bool saveLangs() | |
| 34 | - * @method bool getTransactionStatus() | |
| 35 | - * * End language behavior * | |
| 21 | + * @inheritdoc | |
| 36 | 22 | */ |
| 37 | - class Seo extends ActiveRecord | |
| 23 | + public static function tableName() | |
| 38 | 24 | { |
| 39 | - | |
| 40 | - /** | |
| 41 | - * @inheritdoc | |
| 42 | - */ | |
| 43 | - public static function tableName() | |
| 44 | - { | |
| 45 | - return 'seo'; | |
| 46 | - } | |
| 47 | - | |
| 48 | - public function behaviors() | |
| 49 | - { | |
| 50 | - return [ | |
| 51 | - 'language' => [ | |
| 52 | - 'class' => LanguageBehavior::className(), | |
| 53 | - ], | |
| 54 | - ]; | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * @inheritdoc | |
| 59 | - */ | |
| 60 | - public function rules() | |
| 61 | - { | |
| 62 | - return [ | |
| 63 | - [ | |
| 64 | - [ 'url' ], | |
| 65 | - 'required', | |
| 66 | - ], | |
| 67 | - [ | |
| 68 | - [ 'url' ], | |
| 69 | - 'string', | |
| 70 | - 'max' => 255, | |
| 71 | - ], | |
| 72 | - ]; | |
| 73 | - } | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * @inheritdoc | |
| 77 | - */ | |
| 78 | - public function attributeLabels() | |
| 79 | - { | |
| 80 | - return [ | |
| 81 | - 'id' => Yii::t('app', 'seo_id'), | |
| 82 | - 'url' => Yii::t('app', 'url'), | |
| 83 | - ]; | |
| 84 | - } | |
| 25 | + return 'seo'; | |
| 85 | 26 | } |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @inheritdoc | |
| 30 | + */ | |
| 31 | + public function rules() | |
| 32 | + { | |
| 33 | + return [ | |
| 34 | + [['url'], 'required'], | |
| 35 | + [['seo_text'], 'string'], | |
| 36 | + [['url', 'title', 'meta', 'description', 'h1'], 'string', 'max' => 255], | |
| 37 | + ]; | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * @inheritdoc | |
| 42 | + */ | |
| 43 | + public function attributeLabels() | |
| 44 | + { | |
| 45 | + return [ | |
| 46 | + 'seo_id' => Yii::t('app', 'seo_id'), | |
| 47 | + 'url' => Yii::t('app', 'url'), | |
| 48 | + 'title' => Yii::t('app', 'title'), | |
| 49 | + 'meta' => Yii::t('app', 'meta_title'), | |
| 50 | + 'description' => Yii::t('app', 'description'), | |
| 51 | + 'h1' => Yii::t('app', 'h1'), | |
| 52 | + 'seo_text' => Yii::t('app', 'seo_text'), | |
| 53 | + ]; | |
| 54 | + } | |
| 55 | +} | ... | ... |
models/SeoLang.php deleted
| 1 | -<?php | |
| 2 | - | |
| 3 | - namespace artweb\artbox\seo\models; | |
| 4 | - | |
| 5 | - use artweb\artbox\language\models\Language; | |
| 6 | - use Yii; | |
| 7 | - use yii\db\ActiveRecord; | |
| 8 | - | |
| 9 | - /** | |
| 10 | - * This is the model class for table "seo_lang". | |
| 11 | - * | |
| 12 | - * @property integer $seo_id | |
| 13 | - * @property integer $language_id | |
| 14 | - * @property string $title | |
| 15 | - * @property string $meta_description | |
| 16 | - * @property string $h1 | |
| 17 | - * @property string $meta | |
| 18 | - * @property string $seo_text | |
| 19 | - * @property Language $language | |
| 20 | - * @property Seo $seo | |
| 21 | - */ | |
| 22 | - class SeoLang extends ActiveRecord | |
| 23 | - { | |
| 24 | - | |
| 25 | - public static function primaryKey() | |
| 26 | - { | |
| 27 | - return [ | |
| 28 | - 'seo_id', | |
| 29 | - 'language_id', | |
| 30 | - ]; | |
| 31 | - } | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * @inheritdoc | |
| 35 | - */ | |
| 36 | - public static function tableName() | |
| 37 | - { | |
| 38 | - return 'seo_lang'; | |
| 39 | - } | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * @inheritdoc | |
| 43 | - */ | |
| 44 | - public function rules() | |
| 45 | - { | |
| 46 | - return [ | |
| 47 | - [ | |
| 48 | - [ | |
| 49 | - 'meta_description', | |
| 50 | - 'seo_text', | |
| 51 | - ], | |
| 52 | - 'string', | |
| 53 | - ], | |
| 54 | - [ | |
| 55 | - [ | |
| 56 | - 'title', | |
| 57 | - 'h1', | |
| 58 | - 'meta', | |
| 59 | - ], | |
| 60 | - 'string', | |
| 61 | - 'max' => 255, | |
| 62 | - ], | |
| 63 | - [ | |
| 64 | - [ | |
| 65 | - 'seo_id', | |
| 66 | - 'language_id', | |
| 67 | - ], | |
| 68 | - 'unique', | |
| 69 | - 'targetAttribute' => [ | |
| 70 | - 'seo_id', | |
| 71 | - 'language_id', | |
| 72 | - ], | |
| 73 | - 'message' => 'The combination of Seo ID and Language ID has already been taken.', | |
| 74 | - ], | |
| 75 | - [ | |
| 76 | - [ 'language_id' ], | |
| 77 | - 'exist', | |
| 78 | - 'skipOnError' => true, | |
| 79 | - 'targetClass' => Language::className(), | |
| 80 | - 'targetAttribute' => [ 'language_id' => 'id' ], | |
| 81 | - ], | |
| 82 | - [ | |
| 83 | - [ 'seo_id' ], | |
| 84 | - 'exist', | |
| 85 | - 'skipOnError' => true, | |
| 86 | - 'targetClass' => Seo::className(), | |
| 87 | - 'targetAttribute' => [ 'seo_id' => 'id' ], | |
| 88 | - ], | |
| 89 | - ]; | |
| 90 | - } | |
| 91 | - | |
| 92 | - /** | |
| 93 | - * @inheritdoc | |
| 94 | - */ | |
| 95 | - public function attributeLabels() | |
| 96 | - { | |
| 97 | - return [ | |
| 98 | - 'seo_id' => Yii::t('app', 'seo_id'), | |
| 99 | - 'language_id' => Yii::t('app', 'language_id'), | |
| 100 | - 'title' => Yii::t('app', 'title'), | |
| 101 | - 'meta_description' => Yii::t('app', 'meta_description'), | |
| 102 | - 'h1' => Yii::t('app', 'h1'), | |
| 103 | - 'meta' => Yii::t('app', 'meta'), | |
| 104 | - 'seo_text' => Yii::t('app', 'seo_text'), | |
| 105 | - ]; | |
| 106 | - } | |
| 107 | - | |
| 108 | - /** | |
| 109 | - * @return \yii\db\ActiveQuery | |
| 110 | - */ | |
| 111 | - public function getLanguage() | |
| 112 | - { | |
| 113 | - return $this->hasOne(Language::className(), [ 'id' => 'language_id' ]); | |
| 114 | - } | |
| 115 | - | |
| 116 | - /** | |
| 117 | - * @return \yii\db\ActiveQuery | |
| 118 | - */ | |
| 119 | - public function getSeo() | |
| 120 | - { | |
| 121 | - return $this->hasOne(Seo::className(), [ 'id' => 'seo_id' ]); | |
| 122 | - } | |
| 123 | - } |
models/SeoSearch.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - namespace artweb\artbox\seo\models; | |
| 4 | - | |
| 5 | - use yii\base\Model; | |
| 6 | - use yii\data\ActiveDataProvider; | |
| 7 | - | |
| 2 | + | |
| 3 | +namespace artweb\artbox\seo\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\base\Model; | |
| 7 | +use yii\data\ActiveDataProvider; | |
| 8 | +use artweb\artbox\seo\models\Seo; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * SeoSearch represents the model behind the search form about `common\models\Seo`. | |
| 12 | + */ | |
| 13 | +class SeoSearch extends Seo | |
| 14 | +{ | |
| 8 | 15 | /** |
| 9 | - * SeoSearch represents the model behind the search form about `artweb\artbox\models\Seo`. | |
| 16 | + * @inheritdoc | |
| 10 | 17 | */ |
| 11 | - class SeoSearch extends Seo | |
| 18 | + public function rules() | |
| 12 | 19 | { |
| 13 | - | |
| 14 | - public $title; | |
| 15 | - | |
| 16 | - public $meta_description; | |
| 17 | - | |
| 18 | - public $h1; | |
| 19 | - | |
| 20 | - public $meta; | |
| 21 | - | |
| 22 | - public $seo_text; | |
| 23 | - | |
| 24 | - public function behaviors() | |
| 25 | - { | |
| 26 | - return []; | |
| 27 | - } | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * @inheritdoc | |
| 31 | - */ | |
| 32 | - public function rules() | |
| 33 | - { | |
| 34 | - return [ | |
| 35 | - [ | |
| 36 | - [ 'id' ], | |
| 37 | - 'integer', | |
| 38 | - ], | |
| 39 | - [ | |
| 40 | - [ | |
| 41 | - 'url', | |
| 42 | - 'title', | |
| 43 | - 'meta_description', | |
| 44 | - 'h1', | |
| 45 | - 'meta', | |
| 46 | - 'seo_text', | |
| 47 | - ], | |
| 48 | - 'safe', | |
| 49 | - ], | |
| 50 | - ]; | |
| 51 | - } | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * @inheritdoc | |
| 55 | - */ | |
| 56 | - public function scenarios() | |
| 57 | - { | |
| 58 | - // bypass scenarios() implementation in the parent class | |
| 59 | - return Model::scenarios(); | |
| 60 | - } | |
| 61 | - | |
| 62 | - /** | |
| 63 | - * Creates data provider instance with search query applied | |
| 64 | - * | |
| 65 | - * @param array $params | |
| 66 | - * | |
| 67 | - * @return ActiveDataProvider | |
| 68 | - */ | |
| 69 | - public function search($params) | |
| 70 | - { | |
| 71 | - $query = Seo::find() | |
| 72 | - ->joinWith('lang'); | |
| 73 | - | |
| 74 | - // add conditions that should always apply here | |
| 75 | - | |
| 76 | - $dataProvider = new ActiveDataProvider( | |
| 77 | - [ | |
| 78 | - 'query' => $query, | |
| 79 | - 'sort' => [ | |
| 80 | - 'attributes' => [ | |
| 81 | - 'id', | |
| 82 | - 'url', | |
| 83 | - 'title' => [ | |
| 84 | - 'asc' => [ 'seo_lang.title' => SORT_ASC ], | |
| 85 | - 'desc' => [ 'seo_lang.title' => SORT_DESC ], | |
| 86 | - ], | |
| 87 | - 'meta_description' => [ | |
| 88 | - 'asc' => [ 'seo_lang.meta_description' => SORT_ASC ], | |
| 89 | - 'desc' => [ 'seo_lang.meta_description' => SORT_DESC ], | |
| 90 | - ], | |
| 91 | - 'h1' => [ | |
| 92 | - 'asc' => [ 'seo_lang.h1' => SORT_ASC ], | |
| 93 | - 'desc' => [ 'seo_lang.h1' => SORT_DESC ], | |
| 94 | - ], | |
| 95 | - 'meta' => [ | |
| 96 | - 'asc' => [ 'seo_lang.meta' => SORT_ASC ], | |
| 97 | - 'desc' => [ 'seo_lang.meta' => SORT_DESC ], | |
| 98 | - ], | |
| 99 | - 'seo_text' => [ | |
| 100 | - 'asc' => [ 'seo_lang.seo_text' => SORT_ASC ], | |
| 101 | - 'desc' => [ 'seo_lang.seo_text' => SORT_DESC ], | |
| 102 | - ], | |
| 103 | - ], | |
| 104 | - ], | |
| 105 | - ] | |
| 106 | - ); | |
| 107 | - | |
| 108 | - $this->load($params); | |
| 109 | - | |
| 110 | - if (!$this->validate()) { | |
| 111 | - // uncomment the following line if you do not want to return any records when validation fails | |
| 112 | - // $query->where('0=1'); | |
| 113 | - return $dataProvider; | |
| 114 | - } | |
| 115 | - | |
| 116 | - // grid filtering conditions | |
| 117 | - $query->andFilterWhere( | |
| 118 | - [ | |
| 119 | - 'id' => $this->id, | |
| 120 | - ] | |
| 121 | - ); | |
| 122 | - | |
| 123 | - $query->andFilterWhere( | |
| 124 | - [ | |
| 125 | - 'like', | |
| 126 | - 'url', | |
| 127 | - $this->url, | |
| 128 | - ] | |
| 129 | - ) | |
| 130 | - ->andFilterWhere( | |
| 131 | - [ | |
| 132 | - 'ilike', | |
| 133 | - 'seo_lang.title', | |
| 134 | - $this->title, | |
| 135 | - ] | |
| 136 | - ) | |
| 137 | - ->andFilterWhere( | |
| 138 | - [ | |
| 139 | - 'ilike', | |
| 140 | - 'seo_lang.meta_description', | |
| 141 | - $this->meta_description, | |
| 142 | - ] | |
| 143 | - ) | |
| 144 | - ->andFilterWhere( | |
| 145 | - [ | |
| 146 | - 'ilike', | |
| 147 | - 'seo_lang.h1', | |
| 148 | - $this->h1, | |
| 149 | - ] | |
| 150 | - ) | |
| 151 | - ->andFilterWhere( | |
| 152 | - [ | |
| 153 | - 'ilike', | |
| 154 | - 'seo_lang.meta', | |
| 155 | - $this->meta, | |
| 156 | - ] | |
| 157 | - ) | |
| 158 | - ->andFilterWhere( | |
| 159 | - [ | |
| 160 | - 'ilike', | |
| 161 | - 'seo_lang.seo_text', | |
| 162 | - $this->seo_text, | |
| 163 | - ] | |
| 164 | - ); | |
| 165 | - | |
| 20 | + return [ | |
| 21 | + [['seo_id'], 'integer'], | |
| 22 | + [['url', 'title', 'meta', 'description', 'h1', 'seo_text'], 'safe'], | |
| 23 | + ]; | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @inheritdoc | |
| 28 | + */ | |
| 29 | + public function scenarios() | |
| 30 | + { | |
| 31 | + // bypass scenarios() implementation in the parent class | |
| 32 | + return Model::scenarios(); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Creates data provider instance with search query applied | |
| 37 | + * | |
| 38 | + * @param array $params | |
| 39 | + * | |
| 40 | + * @return ActiveDataProvider | |
| 41 | + */ | |
| 42 | + public function search($params) | |
| 43 | + { | |
| 44 | + $query = Seo::find(); | |
| 45 | + | |
| 46 | + // add conditions that should always apply here | |
| 47 | + | |
| 48 | + $dataProvider = new ActiveDataProvider([ | |
| 49 | + 'query' => $query, | |
| 50 | + ]); | |
| 51 | + | |
| 52 | + $this->load($params); | |
| 53 | + | |
| 54 | + if (!$this->validate()) { | |
| 55 | + // uncomment the following line if you do not want to return any records when validation fails | |
| 56 | + // $query->where('0=1'); | |
| 166 | 57 | return $dataProvider; |
| 167 | 58 | } |
| 59 | + | |
| 60 | + // grid filtering conditions | |
| 61 | + $query->andFilterWhere([ | |
| 62 | + 'seo_id' => $this->seo_id, | |
| 63 | + ]); | |
| 64 | + | |
| 65 | + $query->andFilterWhere(['like', 'url', $this->url]) | |
| 66 | + ->andFilterWhere(['like', 'title', $this->title]) | |
| 67 | + ->andFilterWhere(['like', 'meta', $this->meta]) | |
| 68 | + ->andFilterWhere(['like', 'description', $this->description]) | |
| 69 | + ->andFilterWhere(['like', 'h1', $this->h1]) | |
| 70 | + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | |
| 71 | + | |
| 72 | + return $dataProvider; | |
| 168 | 73 | } |
| 74 | +} | ... | ... |
views/seo/_form.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - use artweb\artbox\seo\models\Seo; | |
| 4 | - use artweb\artbox\seo\models\SeoLang; | |
| 5 | - use artweb\artbox\language\widgets\LanguageForm; | |
| 6 | - use yii\helpers\Html; | |
| 7 | - use yii\web\View; | |
| 8 | - use yii\widgets\ActiveForm; | |
| 9 | - | |
| 10 | - /** | |
| 11 | - * @var View $this | |
| 12 | - * @var Seo $model | |
| 13 | - * @var SeoLang[] $modelLangs | |
| 14 | - * @var ActiveForm $form | |
| 15 | - */ | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use mihaildev\ckeditor\CKEditor; | |
| 6 | +use mihaildev\elfinder\ElFinder; | |
| 7 | +/* @var $this yii\web\View */ | |
| 8 | +/* @var $model common\models\Seo */ | |
| 9 | +/* @var $form yii\widgets\ActiveForm */ | |
| 16 | 10 | ?> |
| 17 | 11 | |
| 18 | 12 | <div class="seo-form"> |
| 19 | - | |
| 13 | + | |
| 20 | 14 | <?php $form = ActiveForm::begin(); ?> |
| 21 | - | |
| 22 | - <?= $form->field($model, 'url') | |
| 23 | - ->textInput([ 'maxlength' => true ]) ?> | |
| 24 | - | |
| 25 | - <?= LanguageForm::widget([ | |
| 26 | - 'modelLangs' => $modelLangs, | |
| 27 | - 'formView' => '@artweb/artbox/seo/views/seo/_form_language', | |
| 28 | - 'form' => $form, | |
| 29 | - ]) ?> | |
| 30 | - | |
| 15 | + | |
| 16 | + <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'meta')->textInput(['maxlength' => true]) ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | |
| 25 | + <?= $form->field($model, 'seo_text')->widget(CKEditor::className(), | |
| 26 | + [ | |
| 27 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | |
| 28 | + 'preset' => 'full', //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | |
| 29 | + 'inline' => false, //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | |
| 30 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | |
| 31 | + ] | |
| 32 | + ) | |
| 33 | + ]) ?> | |
| 34 | + | |
| 31 | 35 | <div class="form-group"> |
| 32 | - <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
| 36 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 33 | 37 | </div> |
| 34 | - | |
| 38 | + | |
| 35 | 39 | <?php ActiveForm::end(); ?> |
| 36 | 40 | |
| 37 | 41 | </div> | ... | ... |
views/seo/_form_language.php deleted
| 1 | -<?php | |
| 2 | - use artweb\artbox\seo\models\SeoLang; | |
| 3 | - use artweb\artbox\language\models\Language; | |
| 4 | - use mihaildev\ckeditor\CKEditor; | |
| 5 | - use mihaildev\elfinder\ElFinder; | |
| 6 | - use yii\web\View; | |
| 7 | - use yii\widgets\ActiveForm; | |
| 8 | - | |
| 9 | - /** | |
| 10 | - * @var SeoLang $model_lang | |
| 11 | - * @var Language $language | |
| 12 | - * @var ActiveForm $form | |
| 13 | - * @var View $this | |
| 14 | - */ | |
| 15 | -?> | |
| 16 | -<?= $form->field($model_lang, '[' . $language->id . ']title') | |
| 17 | - ->textInput([ 'maxlength' => true ]); ?> | |
| 18 | - | |
| 19 | -<?= $form->field($model_lang, '[' . $language->id . ']meta_description') | |
| 20 | - ->widget(CKEditor::className(), [ | |
| 21 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
| 22 | - 'preset' => 'full', | |
| 23 | - 'inline' => false, | |
| 24 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
| 25 | - ->createUrl('file/uploader/images-upload'), | |
| 26 | - ]), | |
| 27 | - ]) ?> | |
| 28 | - | |
| 29 | -<?= $form->field($model_lang, '[' . $language->id . ']seo_text') | |
| 30 | - ->widget(CKEditor::className(), [ | |
| 31 | - 'editorOptions' => ElFinder::ckeditorOptions('elfinder', [ | |
| 32 | - 'preset' => 'full', | |
| 33 | - 'inline' => false, | |
| 34 | - 'filebrowserUploadUrl' => Yii::$app->getUrlManager() | |
| 35 | - ->createUrl('file/uploader/images-upload'), | |
| 36 | - ]), | |
| 37 | - ]) ?> | |
| 38 | - | |
| 39 | -<?= $form->field($model_lang, '[' . $language->id . ']h1') | |
| 40 | - ->textInput([ 'maxlength' => true ]) ?> | |
| 41 | - | |
| 42 | -<?= $form->field($model_lang, '[' . $language->id . ']meta') | |
| 43 | - ->textInput([ 'maxlength' => true ]) ?> | |
| 44 | 0 | \ No newline at end of file |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\SeoSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="seo-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'seo_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'url') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'meta') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'title') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'description') ?> | |
| 27 | + | |
| 28 | + <?= $form->field($model, 'h1') ?> | |
| 29 | + | |
| 30 | + <?php // echo $form->field($model, 'seo_text') ?> | |
| 31 | + | |
| 32 | + <div class="form-group"> | |
| 33 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 34 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 35 | + </div> | |
| 36 | + | |
| 37 | + <?php ActiveForm::end(); ?> | |
| 38 | + | |
| 39 | +</div> | ... | ... |
views/seo/create.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - use artweb\artbox\seo\models\Seo; | |
| 4 | - use artweb\artbox\seo\models\SeoLang; | |
| 5 | - use yii\helpers\Html; | |
| 6 | - use yii\web\View; | |
| 7 | - | |
| 8 | - /** | |
| 9 | - * @var View $this | |
| 10 | - * @var Seo $model | |
| 11 | - * @var SeoLang[] $modelLangs | |
| 12 | - */ | |
| 13 | - | |
| 14 | - $this->title = \Yii::t('app', 'create_item',['item'=>'Seo']); | |
| 15 | - $this->params[ 'breadcrumbs' ][] = [ | |
| 16 | - 'label' => Yii::t('app', 'Seos'), | |
| 17 | - 'url' => [ 'index' ], | |
| 18 | - ]; | |
| 19 | - $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\Seo */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Seo'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 20 | 12 | ?> |
| 21 | 13 | <div class="seo-create"> |
| 22 | - | |
| 14 | + | |
| 23 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
| 24 | - | |
| 16 | + | |
| 25 | 17 | <?= $this->render('_form', [ |
| 26 | - 'model' => $model, | |
| 27 | - 'modelLangs' => $modelLangs, | |
| 18 | + 'model' => $model, | |
| 28 | 19 | ]) ?> |
| 29 | 20 | |
| 30 | 21 | </div> | ... | ... |
views/seo/index.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - use yii\helpers\Html; | |
| 4 | - use yii\grid\GridView; | |
| 5 | - | |
| 6 | - /** | |
| 7 | - * @var yii\web\View $this | |
| 8 | - * @var artweb\artbox\seo\models\SeoSearch $searchModel | |
| 9 | - * @var yii\data\ActiveDataProvider $dataProvider | |
| 10 | - */ | |
| 11 | - $this->title = Yii::t('app', 'Seo'); | |
| 12 | - $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $searchModel common\models\SeoSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Seo'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | 12 | ?> |
| 14 | 13 | <div class="seo-index"> |
| 15 | - | |
| 14 | + | |
| 16 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
| 17 | - | |
| 16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 17 | + | |
| 18 | 18 | <p> |
| 19 | - <?= Html::a(\Yii::t('app', 'create_item',['item'=>'Seo']), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Create Seo'), ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | 20 | </p> |
| 21 | - <?= GridView::widget( | |
| 22 | - [ | |
| 23 | - 'dataProvider' => $dataProvider, | |
| 24 | - 'filterModel' => $searchModel, | |
| 25 | - 'columns' => [ | |
| 26 | - [ 'class' => 'yii\grid\SerialColumn' ], | |
| 27 | - 'id', | |
| 28 | - 'url', | |
| 29 | - [ | |
| 30 | - 'attribute' => 'title', | |
| 31 | - 'value' => 'lang.title', | |
| 32 | - ], | |
| 33 | - [ | |
| 34 | - 'attribute' => 'meta_description', | |
| 35 | - 'value' => 'lang.meta_description', | |
| 36 | - ], | |
| 37 | - [ | |
| 38 | - 'attribute' => 'h1', | |
| 39 | - 'value' => 'lang.h1', | |
| 40 | - ], | |
| 41 | - [ | |
| 42 | - 'attribute' => 'meta', | |
| 43 | - 'value' => 'lang.meta', | |
| 44 | - ], | |
| 45 | - [ | |
| 46 | - 'attribute' => 'seo_text', | |
| 47 | - 'value' => 'lang.seo_text', | |
| 48 | - ], | |
| 49 | - [ 'class' => 'yii\grid\ActionColumn' ], | |
| 50 | - ], | |
| 51 | - ] | |
| 52 | - ); ?> | |
| 21 | + <?= GridView::widget([ | |
| 22 | + 'dataProvider' => $dataProvider, | |
| 23 | + 'filterModel' => $searchModel, | |
| 24 | + 'columns' => [ | |
| 25 | + ['class' => 'yii\grid\SerialColumn'], | |
| 26 | + | |
| 27 | + 'seo_id', | |
| 28 | + 'url:url', | |
| 29 | + 'meta', | |
| 30 | + 'h1', | |
| 31 | + // 'seo_text:ntext', | |
| 32 | + | |
| 33 | + ['class' => 'yii\grid\ActionColumn'], | |
| 34 | + ], | |
| 35 | + ]); ?> | |
| 53 | 36 | </div> | ... | ... |
views/seo/update.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - use artweb\artbox\seo\models\Seo; | |
| 4 | - use artweb\artbox\seo\models\SeoLang; | |
| 5 | - use yii\helpers\Html; | |
| 6 | - use yii\web\View; | |
| 7 | - | |
| 8 | - /** | |
| 9 | - * @var View $this | |
| 10 | - * @var Seo $model | |
| 11 | - * @var SeoLang[] $modelLangs | |
| 12 | - */ | |
| 13 | - | |
| 14 | - $this->title = Yii::t( | |
| 15 | - 'app', | |
| 16 | - 'Update {modelClass}: ', | |
| 17 | - [ | |
| 18 | - 'modelClass' => 'Seo', | |
| 19 | - ] | |
| 20 | - ) . $model->url; | |
| 21 | - $this->params[ 'breadcrumbs' ][] = [ | |
| 22 | - 'label' => Yii::t('app', 'Seos'), | |
| 23 | - 'url' => [ 'index' ], | |
| 24 | - ]; | |
| 25 | - $this->params[ 'breadcrumbs' ][] = [ | |
| 26 | - 'label' => $model->url, | |
| 27 | - 'url' => [ | |
| 28 | - 'view', | |
| 29 | - 'id' => $model->id, | |
| 30 | - ], | |
| 31 | - ]; | |
| 32 | - $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\Seo */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Seo', | |
| 10 | +]) . $model->title; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->seo_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 33 | 14 | ?> |
| 34 | 15 | <div class="seo-update"> |
| 35 | - | |
| 16 | + | |
| 36 | 17 | <h1><?= Html::encode($this->title) ?></h1> |
| 37 | - | |
| 38 | - <?= $this->render( | |
| 39 | - '_form', | |
| 40 | - [ | |
| 41 | - 'model' => $model, | |
| 42 | - 'modelLangs' => $modelLangs, | |
| 43 | - ] | |
| 44 | - ) ?> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 45 | 22 | |
| 46 | 23 | </div> | ... | ... |
views/seo/view.php
| 1 | 1 | <?php |
| 2 | - | |
| 3 | - use yii\helpers\Html; | |
| 4 | - use yii\widgets\DetailView; | |
| 5 | - | |
| 6 | - /** | |
| 7 | - * @var yii\web\View $this | |
| 8 | - * @var artweb\artbox\seo\models\Seo $model | |
| 9 | - */ | |
| 10 | - $this->title = $model->url; | |
| 11 | - $this->params[ 'breadcrumbs' ][] = [ | |
| 12 | - 'label' => Yii::t('app', 'Seos'), | |
| 13 | - 'url' => [ 'index' ], | |
| 14 | - ]; | |
| 15 | - $this->params[ 'breadcrumbs' ][] = $this->title; | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\DetailView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\Seo */ | |
| 8 | + | |
| 9 | +$this->title = $model->title; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Seos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 16 | 12 | ?> |
| 17 | 13 | <div class="seo-view"> |
| 18 | - | |
| 14 | + | |
| 19 | 15 | <h1><?= Html::encode($this->title) ?></h1> |
| 20 | - | |
| 16 | + | |
| 21 | 17 | <p> |
| 22 | - <?= Html::a( | |
| 23 | - Yii::t('app', 'Update'), | |
| 24 | - [ | |
| 25 | - 'update', | |
| 26 | - 'id' => $model->id, | |
| 27 | - ], | |
| 28 | - [ 'class' => 'btn btn-primary' ] | |
| 29 | - ) ?> | |
| 30 | - <?= Html::a( | |
| 31 | - Yii::t('app', 'Delete'), | |
| 32 | - [ | |
| 33 | - 'delete', | |
| 34 | - 'id' => $model->id, | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->seo_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->seo_id], [ | |
| 20 | + 'class' => 'btn btn-danger', | |
| 21 | + 'data' => [ | |
| 22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 23 | + 'method' => 'post', | |
| 35 | 24 | ], |
| 36 | - [ | |
| 37 | - 'class' => 'btn btn-danger', | |
| 38 | - 'data' => [ | |
| 39 | - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 40 | - 'method' => 'post', | |
| 41 | - ], | |
| 42 | - ] | |
| 43 | - ) ?> | |
| 25 | + ]) ?> | |
| 44 | 26 | </p> |
| 45 | - | |
| 46 | - <?= DetailView::widget( | |
| 47 | - [ | |
| 48 | - 'model' => $model, | |
| 49 | - 'attributes' => [ | |
| 50 | - 'id', | |
| 51 | - 'url', | |
| 52 | - 'lang.title', | |
| 53 | - 'lang.meta_description', | |
| 54 | - 'lang.h1', | |
| 55 | - 'lang.meta', | |
| 56 | - 'lang.seo_text', | |
| 57 | - ], | |
| 58 | - ] | |
| 59 | - ) ?> | |
| 27 | + | |
| 28 | + <?= DetailView::widget([ | |
| 29 | + 'model' => $model, | |
| 30 | + 'attributes' => [ | |
| 31 | + 'seo_id', | |
| 32 | + 'url:url', | |
| 33 | + 'title', | |
| 34 | + 'meta', | |
| 35 | + 'description', | |
| 36 | + 'h1', | |
| 37 | + 'seo_text:ntext', | |
| 38 | + ], | |
| 39 | + ]) ?> | |
| 60 | 40 | |
| 61 | 41 | </div> | ... | ... |