Commit b15a9aec1ba6d11d08fd3f46908f0aab7aa20475
1 parent
1fd2bdb4
Добавил языки, адреса, заявки.
Showing
46 changed files
with
2058 additions
and
94 deletions
Show diff stats
backend/assets/AppAsset.php
backend/config/main.php
| ... | ... | @@ -27,13 +27,6 @@ return [ |
| 27 | 27 | 'identityClass' => 'common\models\User', |
| 28 | 28 | 'enableAutoLogin' => true, |
| 29 | 29 | ], |
| 30 | - 'view' => [ | |
| 31 | - 'theme' => [ | |
| 32 | - 'pathMap' => [ | |
| 33 | - '@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app' | |
| 34 | - ], | |
| 35 | - ], | |
| 36 | - ], | |
| 37 | 30 | 'urlManager' => [ |
| 38 | 31 | 'enablePrettyUrl' => false, |
| 39 | 32 | 'showScriptName' => false, | ... | ... |
backend/controllers/LanguageController.php
| ... | ... | @@ -8,6 +8,9 @@ use backend\models\LanguageSearch; |
| 8 | 8 | use yii\web\Controller; |
| 9 | 9 | use yii\web\NotFoundHttpException; |
| 10 | 10 | use yii\filters\VerbFilter; |
| 11 | +use frontend\models\Option; | |
| 12 | +use frontend\models\OptionSearch; | |
| 13 | +use frontend\models\OptionLang; | |
| 11 | 14 | |
| 12 | 15 | /** |
| 13 | 16 | * LanguageController implements the CRUD actions for Language model. |
| ... | ... | @@ -107,4 +110,81 @@ class LanguageController extends Controller |
| 107 | 110 | throw new NotFoundHttpException('The requested page does not exist.'); |
| 108 | 111 | } |
| 109 | 112 | } |
| 113 | + | |
| 114 | + public function actionCreateAdress() | |
| 115 | + { | |
| 116 | + $form[0] = Option::create(\Yii::$app->request->post(), 'Main', 1, [['name' => 'adres', 'template' => 'text', 'translate' => true], ['name' => 'x', 'template' => 'number', 'translate' => false], ['name' => 'y', 'template' => 'number', 'translate' => false], ['name' => 'phone', 'template' => 'text', 'translate' => false], ['name' => 'name', 'template' => 'text', 'translate' => true]], true); | |
| 117 | + if($form[0]['success'] == false) { | |
| 118 | + return $this->render('create_adress', ['forms' => $form]); | |
| 119 | + } else { | |
| 120 | + return $this->redirect(['view-adress']); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + public function actionUpdateAdress($id) | |
| 125 | + { | |
| 126 | + $form[0] = Option::change($id, \Yii::$app->request->post(), 'Main', 1); | |
| 127 | + if($form[0]['success'] == false) { | |
| 128 | + return $this->render('update_adress', ['forms' => $form]); | |
| 129 | + } else { | |
| 130 | + return $this->redirect(['view-adress']); | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 134 | + public function actionViewAdress() | |
| 135 | + { | |
| 136 | + $searchModel = new OptionSearch(); | |
| 137 | + | |
| 138 | + $dataProvider = $searchModel->search(array_merge(Yii::$app->request->queryParams, ['OptionSearch' => ['model' => 'Main', 'name' => 'adres']])); | |
| 139 | + | |
| 140 | + return $this->render('view_adress', [ | |
| 141 | + 'searchModel' => $searchModel, | |
| 142 | + 'dataProvider' => $dataProvider, | |
| 143 | + ]); | |
| 144 | + } | |
| 145 | + | |
| 146 | + /** | |
| 147 | + * Deletes an existing Option model. | |
| 148 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 149 | + * @param integer $id | |
| 150 | + * @return mixed | |
| 151 | + */ | |
| 152 | + public function actionDeleteAdress($id) | |
| 153 | + { | |
| 154 | + $model = $this->findModelAdress($id); | |
| 155 | + $children = $model->hasMany(Option::className(), ['parent_id' => 'option_id'])->all(); | |
| 156 | + $langs = array(); | |
| 157 | + if(!empty($children)) { | |
| 158 | + foreach($children as $child) { | |
| 159 | + $langs = OptionLang::findAll(['id' => $child->option_id]); | |
| 160 | + foreach($langs as $lang) { | |
| 161 | + $lang->delete(); | |
| 162 | + } | |
| 163 | + $child->delete(); | |
| 164 | + } | |
| 165 | + } | |
| 166 | + $langs = OptionLang::findAll(['id' => $id]); | |
| 167 | + foreach($langs as $lang) { | |
| 168 | + $lang->delete(); | |
| 169 | + } | |
| 170 | + $model->delete(); | |
| 171 | + | |
| 172 | + return $this->redirect(['view-adress']); | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 176 | + * Finds the Option model based on its primary key value. | |
| 177 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 178 | + * @param integer $id | |
| 179 | + * @return Option the loaded model | |
| 180 | + * @throws NotFoundHttpException if the model cannot be found | |
| 181 | + */ | |
| 182 | + protected function findModelAdress($id) | |
| 183 | + { | |
| 184 | + if (($model = Option::findOne($id)) !== null) { | |
| 185 | + return $model; | |
| 186 | + } else { | |
| 187 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 188 | + } | |
| 189 | + } | |
| 110 | 190 | } | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use backend\models\NewOptionsLang; | |
| 7 | +use backend\models\NewOptionsLangSearch; | |
| 8 | +use yii\web\Controller; | |
| 9 | +use yii\web\NotFoundHttpException; | |
| 10 | +use yii\filters\VerbFilter; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * NewOptionsLangController implements the CRUD actions for NewOptionsLang model. | |
| 14 | + */ | |
| 15 | +class NewOptionsLangController extends Controller | |
| 16 | +{ | |
| 17 | + public function behaviors() | |
| 18 | + { | |
| 19 | + return [ | |
| 20 | + 'verbs' => [ | |
| 21 | + 'class' => VerbFilter::className(), | |
| 22 | + 'actions' => [ | |
| 23 | + 'delete' => ['post'], | |
| 24 | + ], | |
| 25 | + ], | |
| 26 | + ]; | |
| 27 | + } | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Lists all NewOptionsLang models. | |
| 31 | + * @return mixed | |
| 32 | + */ | |
| 33 | + public function actionIndex() | |
| 34 | + { | |
| 35 | + $searchModel = new NewOptionsLangSearch(); | |
| 36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 37 | + | |
| 38 | + return $this->render('index', [ | |
| 39 | + 'searchModel' => $searchModel, | |
| 40 | + 'dataProvider' => $dataProvider, | |
| 41 | + ]); | |
| 42 | + } | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * Displays a single NewOptionsLang model. | |
| 46 | + * @param integer $id | |
| 47 | + * @return mixed | |
| 48 | + */ | |
| 49 | + public function actionView($id) | |
| 50 | + { | |
| 51 | + return $this->render('view', [ | |
| 52 | + 'model' => $this->findModel($id), | |
| 53 | + ]); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Creates a new NewOptionsLang model. | |
| 58 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 59 | + * @return mixed | |
| 60 | + */ | |
| 61 | + public function actionCreate() | |
| 62 | + { | |
| 63 | + $model = new NewOptionsLang(); | |
| 64 | + | |
| 65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 66 | + return $this->redirect(['view', 'id' => $model->primary]); | |
| 67 | + } else { | |
| 68 | + return $this->render('create', [ | |
| 69 | + 'model' => $model, | |
| 70 | + ]); | |
| 71 | + } | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Updates an existing NewOptionsLang model. | |
| 76 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 77 | + * @param integer $id | |
| 78 | + * @return mixed | |
| 79 | + */ | |
| 80 | + public function actionUpdate($id) | |
| 81 | + { | |
| 82 | + $model = $this->findModel($id); | |
| 83 | + | |
| 84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 85 | + return $this->redirect(['view', 'id' => $model->primary]); | |
| 86 | + } else { | |
| 87 | + return $this->render('update', [ | |
| 88 | + 'model' => $model, | |
| 89 | + ]); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Deletes an existing NewOptionsLang model. | |
| 95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 96 | + * @param integer $id | |
| 97 | + * @return mixed | |
| 98 | + */ | |
| 99 | + public function actionDelete($id) | |
| 100 | + { | |
| 101 | + $this->findModel($id)->delete(); | |
| 102 | + | |
| 103 | + return $this->redirect(['index']); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Finds the NewOptionsLang model based on its primary key value. | |
| 108 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 109 | + * @param integer $id | |
| 110 | + * @return NewOptionsLang the loaded model | |
| 111 | + * @throws NotFoundHttpException if the model cannot be found | |
| 112 | + */ | |
| 113 | + protected function findModel($id) | |
| 114 | + { | |
| 115 | + if (($model = NewOptionsLang::findOne($id)) !== null) { | |
| 116 | + return $model; | |
| 117 | + } else { | |
| 118 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 119 | + } | |
| 120 | + } | |
| 121 | +} | ... | ... |
backend/controllers/SiteController.php
| ... | ... | @@ -8,6 +8,10 @@ use common\models\LoginForm; |
| 8 | 8 | use yii\filters\VerbFilter; |
| 9 | 9 | use backend\models\Profile; |
| 10 | 10 | use common\models\User; |
| 11 | +use frontend\models\Option; | |
| 12 | +use yii\data\ActiveDataProvider; | |
| 13 | +use yii\validators\BooleanValidator; | |
| 14 | +use yii\validators\StringValidator; | |
| 11 | 15 | /** |
| 12 | 16 | * Site controller |
| 13 | 17 | */ |
| ... | ... | @@ -21,32 +25,19 @@ class SiteController extends Controller |
| 21 | 25 | return [ |
| 22 | 26 | 'access' => [ |
| 23 | 27 | 'class' => AccessControl::className(), |
| 28 | + 'except' => ['login', 'error'], | |
| 24 | 29 | 'rules' => [ |
| 25 | 30 | [ |
| 26 | - 'actions' => ['login', 'error'], | |
| 27 | 31 | 'allow' => true, |
| 32 | + 'roles' => ['@'] | |
| 28 | 33 | ], |
| 29 | - [ | |
| 30 | - 'actions' => ['logout', 'index'], | |
| 31 | - 'allow' => true, | |
| 32 | - 'roles' => ['@'], | |
| 33 | - ], | |
| 34 | - [ | |
| 35 | - 'actions' => ['profile', 'profile'], | |
| 36 | - 'allow' => true, | |
| 37 | - 'roles' => ['@'], | |
| 38 | - ], | |
| 39 | - [ | |
| 40 | - 'actions' => ['profileSave', 'profile'], | |
| 41 | - 'allow' => true, | |
| 42 | - 'roles' => ['@'], | |
| 43 | - ], | |
| 44 | 34 | ], |
| 45 | 35 | ], |
| 46 | 36 | 'verbs' => [ |
| 47 | 37 | 'class' => VerbFilter::className(), |
| 48 | 38 | 'actions' => [ |
| 49 | 39 | 'logout' => ['post'], |
| 40 | + 'delete-req' => ['post'] | |
| 50 | 41 | ], |
| 51 | 42 | ], |
| 52 | 43 | ]; |
| ... | ... | @@ -66,7 +57,7 @@ class SiteController extends Controller |
| 66 | 57 | |
| 67 | 58 | public function actionIndex() |
| 68 | 59 | { |
| 69 | - return $this->render('index'); | |
| 60 | + return $this->render('index'); | |
| 70 | 61 | } |
| 71 | 62 | |
| 72 | 63 | public function actionLogin() |
| ... | ... | @@ -109,4 +100,37 @@ class SiteController extends Controller |
| 109 | 100 | ]); |
| 110 | 101 | } |
| 111 | 102 | |
| 103 | + public function actionRequests($id = 0) { | |
| 104 | + if($id != 0) { | |
| 105 | + Option::markOld($id); | |
| 106 | + $this->redirect(['site/requests']); | |
| 107 | + } | |
| 108 | + $query = Option::find()->where(['model' => 'Feedback', 'model_id' => 1, 'parent_id' => null]); | |
| 109 | + $provider = new ActiveDataProvider([ | |
| 110 | + 'query' => $query, | |
| 111 | + 'pagination' => [ | |
| 112 | + 'pageSize' => 2, | |
| 113 | + ], | |
| 114 | + 'sort' => [ | |
| 115 | + 'defaultOrder' => [ | |
| 116 | + 'created_at' => SORT_DESC | |
| 117 | + ] | |
| 118 | + ] | |
| 119 | + ]); | |
| 120 | + $data = $provider->getModels(); | |
| 121 | + return $this->render('requests', [ | |
| 122 | + 'dataProvider' => $provider | |
| 123 | + ]); | |
| 124 | + } | |
| 125 | + | |
| 126 | + public function actionDeleteReq($id) { | |
| 127 | + $model = Option::findOne($id); | |
| 128 | + if(!is_null($model) && $model->delete()) { | |
| 129 | + return $this->redirect(['site/requests']); | |
| 130 | + } else{ | |
| 131 | + Yii::$app->session->setFlash('post_error', $model->getFirstErrors()); | |
| 132 | + return $this->redirect('[site/requests]'); | |
| 133 | + } | |
| 134 | + } | |
| 135 | + | |
| 112 | 136 | } | ... | ... |
backend/models/LanguageSearch.php
| ... | ... | @@ -64,7 +64,8 @@ class LanguageSearch extends Language |
| 64 | 64 | |
| 65 | 65 | $query->andFilterWhere(['like', 'lang_code', $this->lang_code]) |
| 66 | 66 | ->andFilterWhere(['like', 'language_name', $this->language_name]) |
| 67 | - ->andWhere(['active' => '1']); | |
| 67 | + ->andWhere(['active' => '1']) | |
| 68 | + ->andWhere(['>', 'language_id', '0']); | |
| 68 | 69 | |
| 69 | 70 | return $dataProvider; |
| 70 | 71 | } | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "new_options". | |
| 9 | + * | |
| 10 | + * @property integer $id | |
| 11 | + * @property string $model | |
| 12 | + * @property integer $model_id | |
| 13 | + * @property string $name | |
| 14 | + * @property string $template | |
| 15 | + * @property integer $parent_id | |
| 16 | + */ | |
| 17 | +class NewOptions extends \yii\db\ActiveRecord | |
| 18 | +{ | |
| 19 | + /** | |
| 20 | + * @inheritdoc | |
| 21 | + */ | |
| 22 | + public static function tableName() | |
| 23 | + { | |
| 24 | + return 'new_options'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @inheritdoc | |
| 29 | + */ | |
| 30 | + public function rules() | |
| 31 | + { | |
| 32 | + return [ | |
| 33 | + [['model_id', 'parent_id'], 'integer'], | |
| 34 | + [['name', 'template'], 'required'], | |
| 35 | + [['model', 'name', 'template'], 'string', 'max' => 255] | |
| 36 | + ]; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @inheritdoc | |
| 41 | + */ | |
| 42 | + public function attributeLabels() | |
| 43 | + { | |
| 44 | + return [ | |
| 45 | + 'id' => Yii::t('app', 'ID'), | |
| 46 | + 'model' => Yii::t('app', 'Model'), | |
| 47 | + 'model_id' => Yii::t('app', 'Model ID'), | |
| 48 | + 'name' => Yii::t('app', 'Name'), | |
| 49 | + 'template' => Yii::t('app', 'Template'), | |
| 50 | + 'parent_id' => Yii::t('app', 'Parent ID'), | |
| 51 | + ]; | |
| 52 | + } | |
| 53 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "new_options_lang". | |
| 9 | + * | |
| 10 | + * @property integer $primary | |
| 11 | + * @property integer $id | |
| 12 | + * @property integer $lang_id | |
| 13 | + * @property string $value | |
| 14 | + */ | |
| 15 | +class NewOptionsLang extends \yii\db\ActiveRecord | |
| 16 | +{ | |
| 17 | + const SCENARIO_ADD = 'add'; | |
| 18 | + const SCENARIO_UPDATE = 'update'; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * @inheritdoc | |
| 22 | + */ | |
| 23 | + public static function tableName() | |
| 24 | + { | |
| 25 | + return 'new_options_lang'; | |
| 26 | + } | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @inheritdoc | |
| 30 | + */ | |
| 31 | + public function rules() | |
| 32 | + { | |
| 33 | + return [ | |
| 34 | + [['id', 'value'], 'required'], | |
| 35 | + [['id', 'lang_id'], 'integer'], | |
| 36 | + [['value'], 'string'] | |
| 37 | + ]; | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * @inheritdoc | |
| 42 | + */ | |
| 43 | + public function attributeLabels() | |
| 44 | + { | |
| 45 | + return [ | |
| 46 | + 'primary' => Yii::t('app', 'Primary'), | |
| 47 | + 'id' => Yii::t('app', 'ID'), | |
| 48 | + 'lang_id' => Yii::t('app', 'Lang ID'), | |
| 49 | + 'value' => Yii::t('app', 'Value'), | |
| 50 | + ]; | |
| 51 | + } | |
| 52 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace backend\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\base\Model; | |
| 7 | +use yii\data\ActiveDataProvider; | |
| 8 | +use backend\models\NewOptionsLang; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * NewOptionsLangSearch represents the model behind the search form about `backend\models\NewOptionsLang`. | |
| 12 | + */ | |
| 13 | +class NewOptionsLangSearch extends NewOptionsLang | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @inheritdoc | |
| 17 | + */ | |
| 18 | + public function rules() | |
| 19 | + { | |
| 20 | + return [ | |
| 21 | + [['primary', 'id', 'lang_id'], 'integer'], | |
| 22 | + [['value'], '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 = NewOptionsLang::find(); | |
| 45 | + | |
| 46 | + $dataProvider = new ActiveDataProvider([ | |
| 47 | + 'query' => $query, | |
| 48 | + ]); | |
| 49 | + | |
| 50 | + $this->load($params); | |
| 51 | + | |
| 52 | + if (!$this->validate()) { | |
| 53 | + // uncomment the following line if you do not want to return any records when validation fails | |
| 54 | + // $query->where('0=1'); | |
| 55 | + return $dataProvider; | |
| 56 | + } | |
| 57 | + | |
| 58 | + $query->andFilterWhere([ | |
| 59 | + 'primary' => $this->primary, | |
| 60 | + 'id' => $this->id, | |
| 61 | + 'lang_id' => $this->lang_id, | |
| 62 | + ]); | |
| 63 | + | |
| 64 | + $query->andFilterWhere(['like', 'value', $this->value]); | |
| 65 | + | |
| 66 | + return $dataProvider; | |
| 67 | + } | |
| 68 | +} | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\Language */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="language-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + <?php /*?> | |
| 15 | + <?= $form->field($model[0], 'lang_code')->textInput(['maxlength' => true]) ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model[0], 'is_default')->checkBox() ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model[1], 'lang_title')->textInput(['maxlength' => true])?> | |
| 20 | + | |
| 21 | + <div class="form-group"> | |
| 22 | + <?= Html::submitButton($model[0]->isNewRecord ? Yii::t('app', 'Create', array('name' => 'Имя')) : Yii::t('app', 'Update'), ['class' => $model[0]->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | + </div> | |
| 24 | + */ ?> | |
| 25 | + <?php ActiveForm::end(); ?> | |
| 26 | + | |
| 27 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\LanguageSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="language-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'language_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'lang_code') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'is_default') ?> | |
| 23 | + | |
| 24 | + <div class="form-group"> | |
| 25 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 26 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 27 | + </div> | |
| 28 | + | |
| 29 | + <?php ActiveForm::end(); ?> | |
| 30 | + | |
| 31 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\Language */ | |
| 8 | + | |
| 9 | +/*$this->title = Yii::t('app', 'Create Language'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title;*/ | |
| 12 | +echo $this->render('index', $layoutdata); | |
| 13 | +?> | |
| 14 | +<div class="lang-column-2"> | |
| 15 | + | |
| 16 | + <?= $this->render('_form', [ | |
| 17 | + 'model' => $model | |
| 18 | + ]) ?> | |
| 19 | +</div> | |
| 0 | 20 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $searchModel backend\models\LanguageSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | +$this->registerCssFile('/backend/web/css/language.css'); | |
| 10 | +$this->registerJsFile('/backend/web/js/language.js', ['depends' => ['yii\web\JqueryAsset'], 'position' => $this::POS_END]); | |
| 11 | +$this->title = Yii::t('app', 'Settings'); | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 15 | + <div class="lang-column-1"> | |
| 16 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 17 | + <ul class="settings_menu sidebar-menu"> | |
| 18 | + <li> | |
| 19 | + <a href="#collapseLanguages" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguages"><?php echo \Yii::t('app', 'languages');?></a> | |
| 20 | + <ul class="collapse settings_menu_inner" id="collapseLanguages"> | |
| 21 | + <li> | |
| 22 | + <a href="#collapseLanguagesList" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesList"><?php echo \Yii::t('app', 'languages_list');?></a> | |
| 23 | + <?= Html::a('', ['create'], ['class' => 'glyphicon glyphicon-plus']) ?> | |
| 24 | + <div class="collapse" id="collapseLanguagesList"> | |
| 25 | + <?= GridView::widget([ | |
| 26 | + 'dataProvider' => $dataProvider, | |
| 27 | + 'filterModel' => $searchModel, | |
| 28 | + 'columns' => [ | |
| 29 | + ['class' => 'yii\grid\SerialColumn'], | |
| 30 | + | |
| 31 | + 'language_id', | |
| 32 | + 'lang_code', | |
| 33 | + 'is_default', | |
| 34 | + | |
| 35 | + ['class' => 'yii\grid\ActionColumn'], | |
| 36 | + ], | |
| 37 | + ]); ?> | |
| 38 | + </div> | |
| 39 | + </li> | |
| 40 | + <li> | |
| 41 | + <a href="#collapseLanguagesStaticFront" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticFront"><?php echo \Yii::t('app', 'languages_static_front');?></a> | |
| 42 | + <div class="collapse" id="collapseLanguagesStaticFront"> | |
| 43 | + <?= GridView::widget([ | |
| 44 | + 'dataProvider' => $dataProvider, | |
| 45 | + 'filterModel' => $searchModel, | |
| 46 | + 'columns' => [ | |
| 47 | + ['class' => 'yii\grid\SerialColumn'], | |
| 48 | + | |
| 49 | + 'language_id', | |
| 50 | + 'lang_code', | |
| 51 | + 'is_default', | |
| 52 | + | |
| 53 | + ['class' => 'yii\grid\ActionColumn'], | |
| 54 | + ], | |
| 55 | + ]); ?> | |
| 56 | + </div> | |
| 57 | + </li> | |
| 58 | + <li> | |
| 59 | + <a href="#collapseLanguagesStaticAdmin" data-toggle="collapse" aria-expanded="false" aria-controls="collapseLanguagesStaticAdmin"><?php echo \Yii::t('app', 'languages_static_admin');?></a> | |
| 60 | + <div class="collapse" id="collapseLanguagesStaticAdmin"> | |
| 61 | + <?= GridView::widget([ | |
| 62 | + 'dataProvider' => $dataProvider, | |
| 63 | + 'filterModel' => $searchModel, | |
| 64 | + 'columns' => [ | |
| 65 | + ['class' => 'yii\grid\SerialColumn'], | |
| 66 | + | |
| 67 | + 'language_id', | |
| 68 | + 'lang_code', | |
| 69 | + 'is_default', | |
| 70 | + | |
| 71 | + ['class' => 'yii\grid\ActionColumn'], | |
| 72 | + ], | |
| 73 | + ]); ?> | |
| 74 | + </div> | |
| 75 | + </li> | |
| 76 | + </ul> | |
| 77 | + </li> | |
| 78 | + <li> | |
| 79 | + <a href="#collapseRoles" data-toggle="collapse" aria-expanded="false" aria-controls="collapseRoles"><?php echo \Yii::t('app', 'roles');?></a> | |
| 80 | + <ul class="collapse settings_menu_inner" id="collapseRoles"> | |
| 81 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | |
| 82 | + <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> | |
| 83 | + </ul> | |
| 84 | + </li> | |
| 85 | + </ul> | |
| 86 | + </div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model backend\models\Language */ | |
| 7 | + | |
| 8 | +/*$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Language', | |
| 10 | +]) . ' ' . $model->language_id; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->language_id, 'url' => ['view', 'id' => $model->language_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update');*/ | |
| 14 | +echo $this->render('index', $layoutdata); | |
| 15 | +?> | |
| 16 | +<div class="lang-column-2"> | |
| 17 | + | |
| 18 | + <?= $this->render('_form', [ | |
| 19 | + 'model' => $model, | |
| 20 | + ]) ?> | |
| 21 | + | |
| 22 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\DetailView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\Language */ | |
| 8 | + | |
| 9 | +/*$this->title = $model->language_id; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Languages'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title;*/ | |
| 12 | +echo $this->render('index', $layoutdata); | |
| 13 | +?> | |
| 14 | +<div class="lang-column-2"> | |
| 15 | + <?= DetailView::widget([ | |
| 16 | + 'model' => $model, | |
| 17 | + 'attributes' => [ | |
| 18 | + 'language_id', | |
| 19 | + 'lang_code', | |
| 20 | + 'is_default', | |
| 21 | + ], | |
| 22 | + ]) ?> | |
| 23 | + <p> | |
| 24 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->language_id], ['class' => 'btn btn-primary']) ?> | |
| 25 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->language_id], [ | |
| 26 | + 'class' => 'btn btn-danger', | |
| 27 | + 'data' => [ | |
| 28 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 29 | + 'method' => 'post', | |
| 30 | + ], | |
| 31 | + ]) ?> | |
| 32 | + </p> | |
| 33 | +</div> | |
| 0 | 34 | \ 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 frontend\models\Option */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="option-form"> | |
| 12 | + <?php $form = ActiveForm::begin(); ?> | |
| 13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | |
| 14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | |
| 15 | + <?php if($multiple) {?><p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p><?php }?> | |
| 16 | + <?php if(empty($models)) { | |
| 17 | + ?> | |
| 18 | + <div class="form-group" id="main_row"> | |
| 19 | + <div class="form-wrapper"> | |
| 20 | + <?php foreach($fields as $index => $field) { | |
| 21 | + ?> | |
| 22 | + <div class="fields_block"> | |
| 23 | + <label for="Option[0][value][<?=$field['name']?>]" class="pull-left"><?php echo Yii::t('app', $field['name']); ?></label> | |
| 24 | + <?php | |
| 25 | + if($field['translate']) { ?><p class="text-right"><span class="glyphicon glyphicon-globe add_lang pull-right"></span></p><?php } | |
| 26 | + ?> | |
| 27 | + <div class="clearfix"></div> | |
| 28 | + <input type="hidden" name="Option[0][<?=$field['name']?>][template]" value="<?=$field['template']?>"/> | |
| 29 | + <input type="hidden" name="Option[0][<?=$field['name']?>][translate]" value="<?=$field['translate']?>"/> | |
| 30 | + <input type="<?=$field['template']?>" name="Option[0][value][<?=$field['name']?>]" class="form-control required main_input" required/> | |
| 31 | + <?php | |
| 32 | + if($field['translate']) { | |
| 33 | + ?> | |
| 34 | + <div class="lang_inputs" style="display: none"> | |
| 35 | + <?php | |
| 36 | + foreach($model->getLangs() as $lang) { | |
| 37 | + ?> | |
| 38 | + <div class="form-group"> | |
| 39 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | |
| 40 | + <div class="col-xs-11"><input type="<?=$field['template']?>" name="Option[0][lang][<?=$field['name']?>][<?=$lang['language_id']?>]" class="form-control" /></div> | |
| 41 | + <div class="clearfix"></div> | |
| 42 | + </div> | |
| 43 | + <?php | |
| 44 | + } | |
| 45 | + ?> | |
| 46 | + </div> | |
| 47 | + <?php | |
| 48 | + } | |
| 49 | + ?> | |
| 50 | + </div> | |
| 51 | + <?php | |
| 52 | + }?> | |
| 53 | + <p class="text-right"><span class="glyphicon glyphicon-minus remove_lang pull-right"></span></p> | |
| 54 | + <hr /> | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | + <?php | |
| 58 | + } else { | |
| 59 | + $first = 1; | |
| 60 | + foreach($models as $index => $row) { | |
| 61 | + foreach($row as $key => $value) { | |
| 62 | + if(!$modellang[$index][$key][0]->hasErrors('value')) { | |
| 63 | + continue; | |
| 64 | + } | |
| 65 | + if($first) { | |
| 66 | + ?> | |
| 67 | + <div class="form-group" id="main_row"> | |
| 68 | + <?php | |
| 69 | + } | |
| 70 | + ?> | |
| 71 | + <div class="form-wrapper"> | |
| 72 | + <div class="fields_block"> | |
| 73 | + <label for="Option[0][<?=$key?>]"><?php echo Yii::t('app', $key); ?></label> | |
| 74 | + <input type="hidden" name="Option[0][template]" value="<?=$value->template?>"/> | |
| 75 | + <input type="<?=$value->template?>" name="Option[0][value][<?=$key?>]" class="form-control required main_input" required value="<?=$modellang[$index][$key][0]->value?>"/> | |
| 76 | + <div class="help-block"><?=$modellang[$index][$key][0]->getFirstError('value')?></div> | |
| 77 | + <?php | |
| 78 | + if($field['translate']) { | |
| 79 | + ?> | |
| 80 | + <div class="lang_inputs"> | |
| 81 | + <?php | |
| 82 | + foreach($value->getLangs() as $lang) { | |
| 83 | + ?> | |
| 84 | + <div class="form-group"> | |
| 85 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | |
| 86 | + <div class="col-xs-11"><input type="<?=$value->template?>" name="Option[0][lang][<?=$key?>][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$index][$key][$lang['language_id']]->value?>"/></div> | |
| 87 | + </div> | |
| 88 | + <?php | |
| 89 | + } | |
| 90 | + ?> | |
| 91 | + </div> | |
| 92 | + <?php | |
| 93 | + } ?> | |
| 94 | + </div> | |
| 95 | + <?php | |
| 96 | + if($first) { | |
| 97 | + ?> | |
| 98 | + <p class="text-right"><span class="glyphicon glyphicon-minus remove_lang pull-right"></span></p> | |
| 99 | + <hr /> | |
| 100 | + </div> | |
| 101 | + </div> | |
| 102 | + <?php | |
| 103 | + $first = 0; | |
| 104 | + } | |
| 105 | + ?> | |
| 106 | + <?php | |
| 107 | + } | |
| 108 | + } | |
| 109 | + }?> | |
| 110 | + | |
| 111 | + <div class="form-group"> | |
| 112 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 113 | + </div> | |
| 114 | + | |
| 115 | + <?php ActiveForm::end(); ?> | |
| 116 | + <script> | |
| 117 | + var form = '<?= $form->getId()?>'; | |
| 118 | + </script> | |
| 119 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model frontend\models\Option */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="option-form"> | |
| 12 | + <?php $form = ActiveForm::begin(); ?> | |
| 13 | + <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> | |
| 14 | + <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> | |
| 15 | + <?php foreach($models as $id => $row) { | |
| 16 | + ?> | |
| 17 | + <label for="Option[<?=$id?>][<?=$key?>]"><?php echo Yii::t('app', $row->name); ?></label> | |
| 18 | + <input type="hidden" name="Option[<?=$id?>][id]" value="<?=$id?>" /> | |
| 19 | + <input type="hidden" name="Option[<?=$id?>][template]" value="<?=$row->template?>"/> | |
| 20 | + <input type="<?=$row->template?>" name="Option[<?=$id?>][value][<?=$row->name?>]" class="form-control required" required value="<?=$modellang[$id][0]->value?>"/> | |
| 21 | + <?php if($row->hasErrors()) { ?><div class="help-block"><?php echo $modellang[$id][0]->getFirstError('value');?></div> <?php } ?> | |
| 22 | + <?php | |
| 23 | + if($row->translate) { | |
| 24 | + foreach($row->getLangs() as $lang_id => $lang) { | |
| 25 | + ?> | |
| 26 | + <div class="form-group"> | |
| 27 | + <div class="col-xs-1"><?=$lang['lang_code']?></div> | |
| 28 | + <div class="col-xs-11"><input type="<?=$row->template?>" name="Option[<?=$id?>][lang][<?=$lang['language_id']?>]" class="form-control" value="<?=$modellang[$id][$lang['language_id']]->value?>"/></div> | |
| 29 | + </div> | |
| 30 | + <?php | |
| 31 | + } | |
| 32 | + } | |
| 33 | + | |
| 34 | + }?> | |
| 35 | + | |
| 36 | + <div class="form-group"> | |
| 37 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 38 | + </div> | |
| 39 | + | |
| 40 | + <?php ActiveForm::end(); ?> | |
| 41 | +</div> | ... | ... |
backend/views/language/create.php
| ... | ... | @@ -24,7 +24,11 @@ echo $this->render('layout'); |
| 24 | 24 | [ |
| 25 | 25 | 'class' => Column::className(), |
| 26 | 26 | 'content' => function($model, $key, $index, $column) { |
| 27 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 27 | 28 | return '<span class="f32"><span class="flag '.$model->lang_code.'"></span></span>'; |
| 29 | +======= | |
| 30 | + return '<span class="f32"><span class="flag '.$model->country_code.'"></span></span>'; | |
| 31 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | |
| 28 | 32 | } |
| 29 | 33 | ], |
| 30 | 34 | 'language_name', | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model frontend\models\Option */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Option'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +echo $this->render('layout'); | |
| 13 | +?> | |
| 14 | +<div class="lang-column-2"> | |
| 15 | + <?php foreach($forms as $oneform) { | |
| 16 | + echo $this->render('_form_adress', $oneform); | |
| 17 | + }?> | |
| 18 | + | |
| 19 | +</div> | ... | ... |
backend/views/language/index.php
| ... | ... | @@ -24,7 +24,11 @@ echo $this->render('layout'); |
| 24 | 24 | [ |
| 25 | 25 | 'class' => Column::className(), |
| 26 | 26 | 'content' => function($model, $key, $index, $column) { |
| 27 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 27 | 28 | return '<span class="f32"><span class="flag '.$model->lang_code.'"></span></span>'; |
| 29 | +======= | |
| 30 | + return '<span class="f32"><span class="flag '.$model->country_code.'"></span></span>'; | |
| 31 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | |
| 28 | 32 | } |
| 29 | 33 | ], |
| 30 | 34 | 'language_name', | ... | ... |
backend/views/language/layout.php
| ... | ... | @@ -36,5 +36,8 @@ $this->params['breadcrumbs'][] = $this->title; |
| 36 | 36 | <li>Ipsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum IpsumIpsum Ipsum</li> |
| 37 | 37 | </ul> |
| 38 | 38 | </li> |
| 39 | + <li> | |
| 40 | + <?= Html::a(Yii::t('app', 'adress'), ['view-adress'])?> | |
| 41 | + </li> | |
| 39 | 42 | </ul> |
| 40 | 43 | </div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model frontend\models\Option */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Option', | |
| 10 | +]) . ' ' . $forms[0]['models'][\Yii::$app->request->get('id')]->name; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Options'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $forms[0]['models'][\Yii::$app->request->get('id')]->name, 'url' => ['view', 'id' => $forms[0]['models'][\Yii::$app->request->get('id')]->option_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +echo $this->render('layout'); | |
| 15 | +?> | |
| 16 | +<div class="lang-column-2"> | |
| 17 | + <?php foreach($forms as $oneform) { | |
| 18 | + echo $this->render('_form_adress_edit', $oneform); | |
| 19 | + }?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | +use yii\grid\Column; | |
| 6 | +use frontend\models\OptionLang; | |
| 7 | + | |
| 8 | +/* @var $this yii\web\View */ | |
| 9 | +/* @var $searchModel backend\models\LanguageSearch */ | |
| 10 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 11 | + | |
| 12 | +$this->title = Yii::t('app', 'Languages'); | |
| 13 | +$this->params['breadcrumbs'][] = $this->title; | |
| 14 | +echo $this->render('layout'); | |
| 15 | +?> | |
| 16 | +<div class="lang-column-2"> | |
| 17 | + | |
| 18 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 19 | + | |
| 20 | + <?= GridView::widget([ | |
| 21 | + 'dataProvider' => $dataProvider, | |
| 22 | + 'layout' => "{items}", | |
| 23 | + 'columns' => [ | |
| 24 | + [ | |
| 25 | + 'class' => 'yii\grid\Column', | |
| 26 | + 'content' => function($model, $key, $index, $column) { | |
| 27 | + return OptionLang::find()->select('value')->where(['lang_id' => 0, 'id' => $model->option_id])->scalar(); | |
| 28 | + }, | |
| 29 | + 'header' => Yii::t('app', 'adress_name') | |
| 30 | + ], | |
| 31 | + [ | |
| 32 | + 'class' => 'yii\grid\ActionColumn', | |
| 33 | + 'template' => '{update-adress} {delete-adress}', | |
| 34 | + 'buttons' => [ | |
| 35 | + 'update-adress' => function ($url, $model, $key) { | |
| 36 | + return Html::a('', $url, ['class' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('app', 'Change')]); | |
| 37 | + }, | |
| 38 | + 'delete-adress' => function ($url, $model, $key) { | |
| 39 | + return Html::a('', $url, ['class' => 'glyphicon glyphicon-trash', 'title' => Yii::t('app', 'Delete')]); | |
| 40 | + }, | |
| 41 | + ], | |
| 42 | + ] | |
| 43 | + ] | |
| 44 | + ]); ?> | |
| 45 | + | |
| 46 | + <p class="text-right"> | |
| 47 | + <?= Html::a(Yii::t('app', 'Create adress'), ['create-adress'], ['class' => 'btn btn-success']) ?> | |
| 48 | + </p> | |
| 49 | + | |
| 50 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | +use yii\widgets\Breadcrumbs; | |
| 3 | +use dmstr\widgets\Alert; | |
| 4 | +use yii\helpers\Html; | |
| 5 | + | |
| 6 | +?> | |
| 7 | +<div class="content-wrapper"> | |
| 8 | + <section class="content-header"> | |
| 9 | + <?php if (isset($this->blocks['content-header'])) { ?> | |
| 10 | + <h1><?= $this->blocks['content-header'] ?></h1> | |
| 11 | + <?php } else { ?> | |
| 12 | + <h1> | |
| 13 | + <?php | |
| 14 | + if ($this->title !== null) { | |
| 15 | + echo \yii\helpers\Html::encode($this->title); | |
| 16 | + } else { | |
| 17 | + echo \yii\helpers\Inflector::camel2words( | |
| 18 | + \yii\helpers\Inflector::id2camel($this->context->module->id) | |
| 19 | + ); | |
| 20 | + echo ($this->context->module->id !== \Yii::$app->id) ? '<small>Module</small>' : ''; | |
| 21 | + } ?> | |
| 22 | + </h1> | |
| 23 | + <?php } ?> | |
| 24 | + | |
| 25 | + <?= | |
| 26 | + Breadcrumbs::widget( | |
| 27 | + [ | |
| 28 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | |
| 29 | + ] | |
| 30 | + ) ?> | |
| 31 | + </section> | |
| 32 | + | |
| 33 | + <section class="content"> | |
| 34 | + <?= Alert::widget() ?> | |
| 35 | + <?= $content ?> | |
| 36 | + </section> | |
| 37 | +</div> | |
| 38 | + | |
| 39 | +<footer class="main-footer"> | |
| 40 | + <div class="pull-right hidden-xs"> | |
| 41 | + <b>Version</b> 2.0 | |
| 42 | + </div> | |
| 43 | + <strong>Copyright © 2014-2015 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights | |
| 44 | + reserved. | |
| 45 | +</footer> | |
| 46 | + | |
| 47 | +<!-- Control Sidebar --> | |
| 48 | +<aside class="control-sidebar control-sidebar-dark"> | |
| 49 | + <!-- Create the tabs --> | |
| 50 | + <ul class="nav nav-tabs nav-justified control-sidebar-tabs"> | |
| 51 | + <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li> | |
| 52 | + <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li> | |
| 53 | + </ul> | |
| 54 | + <!-- Tab panes --> | |
| 55 | + <div class="tab-content"> | |
| 56 | + <!-- Home tab content --> | |
| 57 | + <div class="tab-pane" id="control-sidebar-home-tab"> | |
| 58 | + <h3 class="control-sidebar-heading">Recent Activity</h3> | |
| 59 | + <ul class='control-sidebar-menu'> | |
| 60 | + <li> | |
| 61 | + <a href='javascript::;'> | |
| 62 | + <i class="menu-icon fa fa-birthday-cake bg-red"></i> | |
| 63 | + | |
| 64 | + <div class="menu-info"> | |
| 65 | + <h4 class="control-sidebar-subheading">Langdon's Birthday</h4> | |
| 66 | + | |
| 67 | + <p>Will be 23 on April 24th</p> | |
| 68 | + </div> | |
| 69 | + </a> | |
| 70 | + </li> | |
| 71 | + <li> | |
| 72 | + <a href='javascript::;'> | |
| 73 | + <i class="menu-icon fa fa-user bg-yellow"></i> | |
| 74 | + | |
| 75 | + <div class="menu-info"> | |
| 76 | + <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4> | |
| 77 | + | |
| 78 | + <p>New phone +1(800)555-1234</p> | |
| 79 | + </div> | |
| 80 | + </a> | |
| 81 | + </li> | |
| 82 | + <li> | |
| 83 | + <a href='javascript::;'> | |
| 84 | + <i class="menu-icon fa fa-envelope-o bg-light-blue"></i> | |
| 85 | + | |
| 86 | + <div class="menu-info"> | |
| 87 | + <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4> | |
| 88 | + | |
| 89 | + <p>nora@example.com</p> | |
| 90 | + </div> | |
| 91 | + </a> | |
| 92 | + </li> | |
| 93 | + <li> | |
| 94 | + <a href='javascript::;'> | |
| 95 | + <i class="menu-icon fa fa-file-code-o bg-green"></i> | |
| 96 | + | |
| 97 | + <div class="menu-info"> | |
| 98 | + <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4> | |
| 99 | + | |
| 100 | + <p>Execution time 5 seconds</p> | |
| 101 | + </div> | |
| 102 | + </a> | |
| 103 | + </li> | |
| 104 | + </ul> | |
| 105 | + <!-- /.control-sidebar-menu --> | |
| 106 | + | |
| 107 | + <h3 class="control-sidebar-heading">Tasks Progress</h3> | |
| 108 | + <ul class='control-sidebar-menu'> | |
| 109 | + <li> | |
| 110 | + <a href='javascript::;'> | |
| 111 | + <h4 class="control-sidebar-subheading"> | |
| 112 | + Custom Template Design | |
| 113 | + <span class="label label-danger pull-right">70%</span> | |
| 114 | + </h4> | |
| 115 | + | |
| 116 | + <div class="progress progress-xxs"> | |
| 117 | + <div class="progress-bar progress-bar-danger" style="width: 70%"></div> | |
| 118 | + </div> | |
| 119 | + </a> | |
| 120 | + </li> | |
| 121 | + <li> | |
| 122 | + <a href='javascript::;'> | |
| 123 | + <h4 class="control-sidebar-subheading"> | |
| 124 | + Update Resume | |
| 125 | + <span class="label label-success pull-right">95%</span> | |
| 126 | + </h4> | |
| 127 | + | |
| 128 | + <div class="progress progress-xxs"> | |
| 129 | + <div class="progress-bar progress-bar-success" style="width: 95%"></div> | |
| 130 | + </div> | |
| 131 | + </a> | |
| 132 | + </li> | |
| 133 | + <li> | |
| 134 | + <a href='javascript::;'> | |
| 135 | + <h4 class="control-sidebar-subheading"> | |
| 136 | + Laravel Integration | |
| 137 | + <span class="label label-waring pull-right">50%</span> | |
| 138 | + </h4> | |
| 139 | + | |
| 140 | + <div class="progress progress-xxs"> | |
| 141 | + <div class="progress-bar progress-bar-warning" style="width: 50%"></div> | |
| 142 | + </div> | |
| 143 | + </a> | |
| 144 | + </li> | |
| 145 | + <li> | |
| 146 | + <a href='javascript::;'> | |
| 147 | + <h4 class="control-sidebar-subheading"> | |
| 148 | + Back End Framework | |
| 149 | + <span class="label label-primary pull-right">68%</span> | |
| 150 | + </h4> | |
| 151 | + | |
| 152 | + <div class="progress progress-xxs"> | |
| 153 | + <div class="progress-bar progress-bar-primary" style="width: 68%"></div> | |
| 154 | + </div> | |
| 155 | + </a> | |
| 156 | + </li> | |
| 157 | + </ul> | |
| 158 | + <!-- /.control-sidebar-menu --> | |
| 159 | + | |
| 160 | + </div> | |
| 161 | + <!-- /.tab-pane --> | |
| 162 | + | |
| 163 | + <!-- Settings tab content --> | |
| 164 | + <div class="tab-pane" id="control-sidebar-settings-tab"> | |
| 165 | + <form method="post"> | |
| 166 | + <h3 class="control-sidebar-heading">General Settings</h3> | |
| 167 | + | |
| 168 | + <div class="form-group"> | |
| 169 | + <label class="control-sidebar-subheading"> | |
| 170 | + Report panel usage | |
| 171 | + <input type="checkbox" class="pull-right" checked/> | |
| 172 | + </label> | |
| 173 | + | |
| 174 | + <p> | |
| 175 | + Some information about this general settings option | |
| 176 | + </p> | |
| 177 | + </div> | |
| 178 | + <!-- /.form-group --> | |
| 179 | + | |
| 180 | + <div class="form-group"> | |
| 181 | + <label class="control-sidebar-subheading"> | |
| 182 | + Allow mail redirect | |
| 183 | + <input type="checkbox" class="pull-right" checked/> | |
| 184 | + </label> | |
| 185 | + | |
| 186 | + <p> | |
| 187 | + Other sets of options are available | |
| 188 | + </p> | |
| 189 | + </div> | |
| 190 | + <!-- /.form-group --> | |
| 191 | + | |
| 192 | + <div class="form-group"> | |
| 193 | + <label class="control-sidebar-subheading"> | |
| 194 | + Expose author name in posts | |
| 195 | + <input type="checkbox" class="pull-right" checked/> | |
| 196 | + </label> | |
| 197 | + | |
| 198 | + <p> | |
| 199 | + Allow the user to show his name in blog posts | |
| 200 | + </p> | |
| 201 | + </div> | |
| 202 | + <!-- /.form-group --> | |
| 203 | + | |
| 204 | + <h3 class="control-sidebar-heading">Chat Settings</h3> | |
| 205 | + | |
| 206 | + <div class="form-group"> | |
| 207 | + <label class="control-sidebar-subheading"> | |
| 208 | + Show me as online | |
| 209 | + <input type="checkbox" class="pull-right" checked/> | |
| 210 | + </label> | |
| 211 | + </div> | |
| 212 | + <!-- /.form-group --> | |
| 213 | + | |
| 214 | + <div class="form-group"> | |
| 215 | + <label class="control-sidebar-subheading"> | |
| 216 | + Turn off notifications | |
| 217 | + <input type="checkbox" class="pull-right"/> | |
| 218 | + </label> | |
| 219 | + </div> | |
| 220 | + <!-- /.form-group --> | |
| 221 | + | |
| 222 | + <div class="form-group"> | |
| 223 | + <label class="control-sidebar-subheading"> | |
| 224 | + Delete chat history | |
| 225 | + <a href="javascript::;" class="text-red pull-right"><i class="fa fa-trash-o"></i></a> | |
| 226 | + </label> | |
| 227 | + </div> | |
| 228 | + <!-- /.form-group --> | |
| 229 | + </form> | |
| 230 | + <?=Html::a( | |
| 231 | + \Yii::t('app', 'settings'), | |
| 232 | + ['/language'], | |
| 233 | + ['data-method' => 'post', 'class' => 'btn btn-default btn-flat'] | |
| 234 | + )?> | |
| 235 | + </div> | |
| 236 | + <!-- /.tab-pane --> | |
| 237 | + </div> | |
| 238 | +</aside><!-- /.control-sidebar --> | |
| 239 | +<!-- Add the sidebar's background. This div must be placed | |
| 240 | + immediately after the control sidebar --> | |
| 241 | +<div class='control-sidebar-bg'></div> | |
| 0 | 242 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\helpers\Url; | |
| 5 | + | |
| 6 | +$username = Yii::$app->user->identity->firstname.' '.Yii::$app->user->identity->lastname; | |
| 7 | + | |
| 8 | +/* @var $this \yii\web\View */ | |
| 9 | +/* @var $content string */ | |
| 10 | +?> | |
| 11 | + | |
| 12 | +<header class="main-header"> | |
| 13 | + | |
| 14 | + <?= Html::a('<span class="logo-mini">APP</span><span class="logo-lg">' . Yii::$app->name . '</span>', Yii::$app->homeUrl, ['class' => 'logo']) ?> | |
| 15 | + | |
| 16 | + <nav class="navbar navbar-static-top" role="navigation"> | |
| 17 | + | |
| 18 | + <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> | |
| 19 | + <span class="sr-only">Toggle navigation</span> | |
| 20 | + </a> | |
| 21 | + | |
| 22 | + <div class="navbar-custom-menu"> | |
| 23 | + | |
| 24 | + <ul class="nav navbar-nav"> | |
| 25 | + | |
| 26 | + <!-- Messages: style can be found in dropdown.less--> | |
| 27 | + <li class="dropdown messages-menu"> | |
| 28 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 29 | + <i class="fa fa-envelope-o"></i> | |
| 30 | + <span class="label label-success">4</span> | |
| 31 | + </a> | |
| 32 | + <ul class="dropdown-menu"> | |
| 33 | + <li class="header">You have 4 messages</li> | |
| 34 | + <li> | |
| 35 | + <!-- inner menu: contains the actual data --> | |
| 36 | + <ul class="menu"> | |
| 37 | + <li><!-- start message --> | |
| 38 | + <a href="#"> | |
| 39 | + <div class="pull-left"> | |
| 40 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" | |
| 41 | + alt="User Image"/> | |
| 42 | + </div> | |
| 43 | + <h4> | |
| 44 | + Support Team | |
| 45 | + <small><i class="fa fa-clock-o"></i> 5 mins</small> | |
| 46 | + </h4> | |
| 47 | + <p>Why not buy a new awesome theme?</p> | |
| 48 | + </a> | |
| 49 | + </li> | |
| 50 | + <!-- end message --> | |
| 51 | + <li> | |
| 52 | + <a href="#"> | |
| 53 | + <div class="pull-left"> | |
| 54 | + <img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle" | |
| 55 | + alt="user image"/> | |
| 56 | + </div> | |
| 57 | + <h4> | |
| 58 | + AdminLTE Design Team | |
| 59 | + <small><i class="fa fa-clock-o"></i> 2 hours</small> | |
| 60 | + </h4> | |
| 61 | + <p>Why not buy a new awesome theme?</p> | |
| 62 | + </a> | |
| 63 | + </li> | |
| 64 | + <li> | |
| 65 | + <a href="#"> | |
| 66 | + <div class="pull-left"> | |
| 67 | + <img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle" | |
| 68 | + alt="user image"/> | |
| 69 | + </div> | |
| 70 | + <h4> | |
| 71 | + Developers | |
| 72 | + <small><i class="fa fa-clock-o"></i> Today</small> | |
| 73 | + </h4> | |
| 74 | + <p>Why not buy a new awesome theme?</p> | |
| 75 | + </a> | |
| 76 | + </li> | |
| 77 | + <li> | |
| 78 | + <a href="#"> | |
| 79 | + <div class="pull-left"> | |
| 80 | + <img src="<?= $directoryAsset ?>/img/user3-128x128.jpg" class="img-circle" | |
| 81 | + alt="user image"/> | |
| 82 | + </div> | |
| 83 | + <h4> | |
| 84 | + Sales Department | |
| 85 | + <small><i class="fa fa-clock-o"></i> Yesterday</small> | |
| 86 | + </h4> | |
| 87 | + <p>Why not buy a new awesome theme?</p> | |
| 88 | + </a> | |
| 89 | + </li> | |
| 90 | + <li> | |
| 91 | + <a href="#"> | |
| 92 | + <div class="pull-left"> | |
| 93 | + <img src="<?= $directoryAsset ?>/img/user4-128x128.jpg" class="img-circle" | |
| 94 | + alt="user image"/> | |
| 95 | + </div> | |
| 96 | + <h4> | |
| 97 | + Reviewers | |
| 98 | + <small><i class="fa fa-clock-o"></i> 2 days</small> | |
| 99 | + </h4> | |
| 100 | + <p>Why not buy a new awesome theme?</p> | |
| 101 | + </a> | |
| 102 | + </li> | |
| 103 | + </ul> | |
| 104 | + </li> | |
| 105 | + <li class="footer"><a href="#">See All Messages</a></li> | |
| 106 | + </ul> | |
| 107 | + </li> | |
| 108 | + <li class="dropdown notifications-menu"> | |
| 109 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 110 | + <i class="fa fa-bell-o"></i> | |
| 111 | + <span class="label label-warning">10</span> | |
| 112 | + </a> | |
| 113 | + <ul class="dropdown-menu"> | |
| 114 | + <li class="header">You have 10 notifications</li> | |
| 115 | + <li> | |
| 116 | + <!-- inner menu: contains the actual data --> | |
| 117 | + <ul class="menu"> | |
| 118 | + <li> | |
| 119 | + <a href="#"> | |
| 120 | + <i class="fa fa-users text-aqua"></i> 5 new members joined today | |
| 121 | + </a> | |
| 122 | + </li> | |
| 123 | + <li> | |
| 124 | + <a href="#"> | |
| 125 | + <i class="fa fa-warning text-yellow"></i> Very long description here that may | |
| 126 | + not fit into the page and may cause design problems | |
| 127 | + </a> | |
| 128 | + </li> | |
| 129 | + <li> | |
| 130 | + <a href="#"> | |
| 131 | + <i class="fa fa-users text-red"></i> 5 new members joined | |
| 132 | + </a> | |
| 133 | + </li> | |
| 134 | + | |
| 135 | + <li> | |
| 136 | + <a href="#"> | |
| 137 | + <i class="fa fa-shopping-cart text-green"></i> 25 sales made | |
| 138 | + </a> | |
| 139 | + </li> | |
| 140 | + <li> | |
| 141 | + <a href="#"> | |
| 142 | + <i class="fa fa-user text-red"></i> You changed your username | |
| 143 | + </a> | |
| 144 | + </li> | |
| 145 | + </ul> | |
| 146 | + </li> | |
| 147 | + <li class="footer"><a href="#">View all</a></li> | |
| 148 | + </ul> | |
| 149 | + </li> | |
| 150 | + <!-- Tasks: style can be found in dropdown.less --> | |
| 151 | + <li class="dropdown tasks-menu"> | |
| 152 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 153 | + <i class="fa fa-flag-o"></i> | |
| 154 | + <span class="label label-danger">9</span> | |
| 155 | + </a> | |
| 156 | + <ul class="dropdown-menu"> | |
| 157 | + <li class="header">You have 9 tasks</li> | |
| 158 | + <li> | |
| 159 | + <!-- inner menu: contains the actual data --> | |
| 160 | + <ul class="menu"> | |
| 161 | + <li><!-- Task item --> | |
| 162 | + <a href="#"> | |
| 163 | + <h3> | |
| 164 | + Design some buttons | |
| 165 | + <small class="pull-right">20%</small> | |
| 166 | + </h3> | |
| 167 | + <div class="progress xs"> | |
| 168 | + <div class="progress-bar progress-bar-aqua" style="width: 20%" | |
| 169 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | |
| 170 | + aria-valuemax="100"> | |
| 171 | + <span class="sr-only">20% Complete</span> | |
| 172 | + </div> | |
| 173 | + </div> | |
| 174 | + </a> | |
| 175 | + </li> | |
| 176 | + <!-- end task item --> | |
| 177 | + <li><!-- Task item --> | |
| 178 | + <a href="#"> | |
| 179 | + <h3> | |
| 180 | + Create a nice theme | |
| 181 | + <small class="pull-right">40%</small> | |
| 182 | + </h3> | |
| 183 | + <div class="progress xs"> | |
| 184 | + <div class="progress-bar progress-bar-green" style="width: 40%" | |
| 185 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | |
| 186 | + aria-valuemax="100"> | |
| 187 | + <span class="sr-only">40% Complete</span> | |
| 188 | + </div> | |
| 189 | + </div> | |
| 190 | + </a> | |
| 191 | + </li> | |
| 192 | + <!-- end task item --> | |
| 193 | + <li><!-- Task item --> | |
| 194 | + <a href="#"> | |
| 195 | + <h3> | |
| 196 | + Some task I need to do | |
| 197 | + <small class="pull-right">60%</small> | |
| 198 | + </h3> | |
| 199 | + <div class="progress xs"> | |
| 200 | + <div class="progress-bar progress-bar-red" style="width: 60%" | |
| 201 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | |
| 202 | + aria-valuemax="100"> | |
| 203 | + <span class="sr-only">60% Complete</span> | |
| 204 | + </div> | |
| 205 | + </div> | |
| 206 | + </a> | |
| 207 | + </li> | |
| 208 | + <!-- end task item --> | |
| 209 | + <li><!-- Task item --> | |
| 210 | + <a href="#"> | |
| 211 | + <h3> | |
| 212 | + Make beautiful transitions | |
| 213 | + <small class="pull-right">80%</small> | |
| 214 | + </h3> | |
| 215 | + <div class="progress xs"> | |
| 216 | + <div class="progress-bar progress-bar-yellow" style="width: 80%" | |
| 217 | + role="progressbar" aria-valuenow="20" aria-valuemin="0" | |
| 218 | + aria-valuemax="100"> | |
| 219 | + <span class="sr-only">80% Complete</span> | |
| 220 | + </div> | |
| 221 | + </div> | |
| 222 | + </a> | |
| 223 | + </li> | |
| 224 | + <!-- end task item --> | |
| 225 | + </ul> | |
| 226 | + </li> | |
| 227 | + <li class="footer"> | |
| 228 | + <a href="#">View all tasks</a> | |
| 229 | + </li> | |
| 230 | + </ul> | |
| 231 | + </li> | |
| 232 | + <!-- User Account: style can be found in dropdown.less --> | |
| 233 | + | |
| 234 | + <li class="dropdown user user-menu"> | |
| 235 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
| 236 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="user-image" alt="User Image"/> | |
| 237 | + <span class="hidden-xs"><?=$username; ?></span> | |
| 238 | + </a> | |
| 239 | + <ul class="dropdown-menu"> | |
| 240 | + <!-- User image --> | |
| 241 | + <li class="user-header"> | |
| 242 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" | |
| 243 | + alt="User Image"/> | |
| 244 | + | |
| 245 | + <p> | |
| 246 | + <?=$username; ?> - Web Developer | |
| 247 | + <small>Member since Nov. 2012</small> | |
| 248 | + </p> | |
| 249 | + </li> | |
| 250 | + <!-- | |
| 251 | + Menu Body | |
| 252 | + <li class="user-body"> | |
| 253 | + <div class="col-xs-4 text-center"> | |
| 254 | + <a href="#">Followers</a> | |
| 255 | + </div> | |
| 256 | + <div class="col-xs-4 text-center"> | |
| 257 | + <a href="#">Sales</a> | |
| 258 | + </div> | |
| 259 | + <div class="col-xs-4 text-center"> | |
| 260 | + <a href="#">Friends</a> | |
| 261 | + </div> | |
| 262 | + </li> | |
| 263 | + --> | |
| 264 | + <!-- Menu Footer--> | |
| 265 | + <li class="user-footer"> | |
| 266 | + <div class="pull-left"> | |
| 267 | + <a href="<?=Url::toRoute('site/profile'); ?>" class="btn btn-default btn-flat">Profile</a> | |
| 268 | + </div> | |
| 269 | + <div class="pull-right"> | |
| 270 | + <?= Html::a( | |
| 271 | + 'Sign out', | |
| 272 | + ['/site/logout'], | |
| 273 | + ['data-method' => 'post', 'class' => 'btn btn-default btn-flat'] | |
| 274 | + ) ?> | |
| 275 | + </div> | |
| 276 | + </li> | |
| 277 | + </ul> | |
| 278 | + </li> | |
| 279 | + | |
| 280 | + <!-- User Account: style can be found in dropdown.less --> | |
| 281 | + <li> | |
| 282 | + <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> | |
| 283 | + </li> | |
| 284 | + </ul> | |
| 285 | + </div> | |
| 286 | + </nav> | |
| 287 | +</header> | ... | ... |
| 1 | +<aside class="main-sidebar"> | |
| 2 | + | |
| 3 | + <section class="sidebar"> | |
| 4 | + | |
| 5 | + <!-- Sidebar user panel --> | |
| 6 | + <div class="user-panel"> | |
| 7 | + <div class="pull-left image"> | |
| 8 | + <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="img-circle" alt="User Image"/> | |
| 9 | + </div> | |
| 10 | + <div class="pull-left info"> | |
| 11 | + <p>Alexander Pierce</p> | |
| 12 | + | |
| 13 | + <a href="#"><i class="fa fa-circle text-success"></i> Online</a> | |
| 14 | + </div> | |
| 15 | + </div> | |
| 16 | + | |
| 17 | + <!-- search form --> | |
| 18 | + <form action="#" method="get" class="sidebar-form"> | |
| 19 | + <div class="input-group"> | |
| 20 | + <input type="text" name="q" class="form-control" placeholder="Search..."/> | |
| 21 | + <span class="input-group-btn"> | |
| 22 | + <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i> | |
| 23 | + </button> | |
| 24 | + </span> | |
| 25 | + </div> | |
| 26 | + </form> | |
| 27 | + <!-- /.search form --> | |
| 28 | + | |
| 29 | + <?= dmstr\widgets\Menu::widget( | |
| 30 | + [ | |
| 31 | + 'options' => ['class' => 'sidebar-menu'], | |
| 32 | + 'items' => [ | |
| 33 | + ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']], | |
| 34 | + ['label' => 'Термин', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']], | |
| 35 | + ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']], | |
| 36 | + ['label' => 'Заявки', 'icon' => 'fa fa-file-code-o', 'url' => ['/site/requests/']], | |
| 37 | + ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']], | |
| 38 | + ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']], | |
| 39 | + ['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest], | |
| 40 | + ['label' => 'Пользователи', 'icon' => 'fa fa-file-code-o', 'url' => ['/user/']], | |
| 41 | + [ | |
| 42 | + 'label' => 'Роли', | |
| 43 | + 'icon' => 'fa fa-share', | |
| 44 | + 'url' => '#', | |
| 45 | + 'items' => [ | |
| 46 | + ['label' => 'Управление ролями', 'icon' => 'fa fa-file-code-o', 'url' => ['/permit/access/role'],], | |
| 47 | + ['label' => 'Управление правами доступа', 'icon' => 'fa fa-dashboard', 'url' => ['/permit/access/permission'],], | |
| 48 | + ], | |
| 49 | + ], | |
| 50 | + [ | |
| 51 | + 'label' => 'Same tools', | |
| 52 | + 'icon' => 'fa fa-share', | |
| 53 | + 'url' => '#', | |
| 54 | + 'items' => [ | |
| 55 | + ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii'],], | |
| 56 | + ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug'],], | |
| 57 | + [ | |
| 58 | + 'label' => 'Level One', | |
| 59 | + 'icon' => 'fa fa-circle-o', | |
| 60 | + 'url' => '#', | |
| 61 | + 'items' => [ | |
| 62 | + ['label' => 'Level Two', 'icon' => 'fa fa-circle-o', 'url' => '#',], | |
| 63 | + [ | |
| 64 | + 'label' => 'Level Two', | |
| 65 | + 'icon' => 'fa fa-circle-o', | |
| 66 | + 'url' => '#', | |
| 67 | + 'items' => [ | |
| 68 | + ['label' => 'Level Three', 'icon' => 'fa fa-circle-o', 'url' => '#',], | |
| 69 | + ['label' => 'Level Three', 'icon' => 'fa fa-circle-o', 'url' => '#',], | |
| 70 | + ], | |
| 71 | + ], | |
| 72 | + ], | |
| 73 | + ], | |
| 74 | + ], | |
| 75 | + ], | |
| 76 | + ], | |
| 77 | + ] | |
| 78 | + ) ?> | |
| 79 | + | |
| 80 | + </section> | |
| 81 | + | |
| 82 | +</aside> | ... | ... |
| 1 | +<?php | |
| 2 | +use backend\assets\AppAsset; | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this \yii\web\View */ | |
| 6 | +/* @var $content string */ | |
| 7 | + | |
| 8 | +dmstr\web\AdminLteAsset::register($this); | |
| 9 | +?> | |
| 10 | +<?php $this->beginPage() ?> | |
| 11 | +<!DOCTYPE html> | |
| 12 | +<html lang="<?= Yii::$app->language ?>"> | |
| 13 | +<head> | |
| 14 | + <meta charset="<?= Yii::$app->charset ?>"/> | |
| 15 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 16 | + <?= Html::csrfMetaTags() ?> | |
| 17 | + <title><?= Html::encode($this->title) ?></title> | |
| 18 | + <?php $this->head() ?> | |
| 19 | +</head> | |
| 20 | +<body class="login-page"> | |
| 21 | + | |
| 22 | +<?php $this->beginBody() ?> | |
| 23 | + | |
| 24 | + <?= $content ?> | |
| 25 | + | |
| 26 | +<?php $this->endBody() ?> | |
| 27 | +</body> | |
| 28 | +</html> | |
| 29 | +<?php $this->endPage() ?> | ... | ... |
backend/views/layouts/main.php
| 1 | 1 | <?php |
| 2 | +use yii\helpers\Html; | |
| 2 | 3 | |
| 3 | 4 | /* @var $this \yii\web\View */ |
| 4 | 5 | /* @var $content string */ |
| 5 | 6 | |
| 6 | -use backend\assets\AppAsset; | |
| 7 | -use yii\helpers\Html; | |
| 8 | -use yii\bootstrap\Nav; | |
| 9 | -use yii\bootstrap\NavBar; | |
| 10 | -use yii\widgets\Breadcrumbs; | |
| 11 | -use common\widgets\Alert; | |
| 12 | 7 | |
| 13 | -AppAsset::register($this); | |
| 14 | -?> | |
| 15 | -<?php $this->beginPage() ?> | |
| 16 | -<!DOCTYPE html> | |
| 17 | -<html lang="<?= Yii::$app->language ?>"> | |
| 18 | -<head> | |
| 19 | - <meta charset="<?= Yii::$app->charset ?>"> | |
| 20 | - <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 21 | - <?= Html::csrfMetaTags() ?> | |
| 22 | - <title><?= Html::encode($this->title) ?></title> | |
| 23 | - <?php $this->head() ?> | |
| 24 | -</head> | |
| 25 | -<body> | |
| 26 | -<?php $this->beginBody() ?> | |
| 8 | +if (Yii::$app->controller->action->id === 'login') { | |
| 9 | +/** | |
| 10 | + * Do not use this code in your template. Remove it. | |
| 11 | + * Instead, use the code $this->layout = '//main-login'; in your controller. | |
| 12 | + */ | |
| 13 | + echo $this->render( | |
| 14 | + 'main-login', | |
| 15 | + ['content' => $content] | |
| 16 | + ); | |
| 17 | +} else { | |
| 27 | 18 | |
| 28 | -<div class="wrap"> | |
| 29 | - <?php | |
| 30 | - NavBar::begin([ | |
| 31 | - 'brandLabel' => 'My Company', | |
| 32 | - 'brandUrl' => Yii::$app->homeUrl, | |
| 33 | - 'options' => [ | |
| 34 | - 'class' => 'navbar-inverse navbar-fixed-top', | |
| 35 | - ], | |
| 36 | - ]); | |
| 37 | - $menuItems = [ | |
| 38 | - ['label' => 'Home', 'url' => ['/site/index']], | |
| 39 | - ]; | |
| 40 | - if (Yii::$app->user->isGuest) { | |
| 41 | - $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | |
| 19 | + if (class_exists('backend\assets\AppAsset')) { | |
| 20 | + backend\assets\AppAsset::register($this); | |
| 42 | 21 | } else { |
| 43 | - $menuItems[] = [ | |
| 44 | - 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', | |
| 45 | - 'url' => ['/site/logout'], | |
| 46 | - 'linkOptions' => ['data-method' => 'post'] | |
| 47 | - ]; | |
| 22 | + app\assets\AppAsset::register($this); | |
| 48 | 23 | } |
| 49 | - echo Nav::widget([ | |
| 50 | - 'options' => ['class' => 'navbar-nav navbar-right'], | |
| 51 | - 'items' => $menuItems, | |
| 52 | - ]); | |
| 53 | - NavBar::end(); | |
| 24 | + | |
| 25 | + dmstr\web\AdminLteAsset::register($this); | |
| 26 | + | |
| 27 | + $directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist'); | |
| 54 | 28 | ?> |
| 29 | + <?php $this->beginPage() ?> | |
| 30 | + <!DOCTYPE html> | |
| 31 | + <html lang="<?= Yii::$app->language ?>"> | |
| 32 | + <head> | |
| 33 | + <meta charset="<?= Yii::$app->charset ?>"/> | |
| 34 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| 35 | + <?= Html::csrfMetaTags() ?> | |
| 36 | + <title><?= Html::encode($this->title) ?></title> | |
| 37 | + <?php $this->head() ?> | |
| 38 | + </head> | |
| 39 | + <body class="skin-blue sidebar-mini"> | |
| 40 | + <?php $this->beginBody() ?> | |
| 41 | + <div class="wrapper"> | |
| 55 | 42 | |
| 56 | - <div class="container"> | |
| 57 | - <?= Breadcrumbs::widget([ | |
| 58 | - 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | |
| 59 | - ]) ?> | |
| 60 | - <?= Alert::widget() ?> | |
| 61 | - <?= $content ?> | |
| 62 | - </div> | |
| 63 | -</div> | |
| 43 | + <?= $this->render( | |
| 44 | + 'header.php', | |
| 45 | + ['directoryAsset' => $directoryAsset] | |
| 46 | + ) ?> | |
| 47 | + | |
| 48 | + <?= $this->render( | |
| 49 | + 'left.php', | |
| 50 | + ['directoryAsset' => $directoryAsset] | |
| 51 | + ) | |
| 52 | + ?> | |
| 64 | 53 | |
| 65 | -<footer class="footer"> | |
| 66 | - <div class="container"> | |
| 67 | - <p class="pull-left">© My Company <?= date('Y') ?></p> | |
| 54 | + <?= $this->render( | |
| 55 | + 'content.php', | |
| 56 | + ['content' => $content, 'directoryAsset' => $directoryAsset] | |
| 57 | + ) ?> | |
| 68 | 58 | |
| 69 | - <p class="pull-right"><?= Yii::powered() ?></p> | |
| 70 | 59 | </div> |
| 71 | -</footer> | |
| 72 | 60 | |
| 73 | -<?php $this->endBody() ?> | |
| 74 | -</body> | |
| 75 | -</html> | |
| 76 | -<?php $this->endPage() ?> | |
| 61 | + <?php $this->endBody() ?> | |
| 62 | + </body> | |
| 63 | + </html> | |
| 64 | + <?php $this->endPage() ?> | |
| 65 | +<?php } ?> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\NewOptionsLang */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="new-options-lang-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + | |
| 15 | + <?= $form->field($model, 'id')->textInput() ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'lang_id')->textInput() ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'value')->textarea(['rows' => 6]) ?> | |
| 20 | + | |
| 21 | + <div class="form-group"> | |
| 22 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 23 | + </div> | |
| 24 | + | |
| 25 | + <?php ActiveForm::end(); ?> | |
| 26 | + | |
| 27 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\NewOptionsLangSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="new-options-lang-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'primary') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'id') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'lang_id') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'value') ?> | |
| 25 | + | |
| 26 | + <div class="form-group"> | |
| 27 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 28 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 29 | + </div> | |
| 30 | + | |
| 31 | + <?php ActiveForm::end(); ?> | |
| 32 | + | |
| 33 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\NewOptionsLang */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create New Options Lang'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="new-options-lang-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $searchModel backend\models\NewOptionsLangSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'New Options Langs'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="new-options-lang-index"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 17 | + | |
| 18 | + <p> | |
| 19 | + <?= Html::a(Yii::t('app', 'Create New Options Lang'), ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | + </p> | |
| 21 | + | |
| 22 | + <?= GridView::widget([ | |
| 23 | + 'dataProvider' => $dataProvider, | |
| 24 | + 'filterModel' => $searchModel, | |
| 25 | + 'columns' => [ | |
| 26 | + ['class' => 'yii\grid\SerialColumn'], | |
| 27 | + | |
| 28 | + 'primary', | |
| 29 | + 'id', | |
| 30 | + 'lang_id', | |
| 31 | + 'value:ntext', | |
| 32 | + | |
| 33 | + ['class' => 'yii\grid\ActionColumn'], | |
| 34 | + ], | |
| 35 | + ]); ?> | |
| 36 | + | |
| 37 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model backend\models\NewOptionsLang */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'New Options Lang', | |
| 10 | +]) . ' ' . $model->primary; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->primary, 'url' => ['view', 'id' => $model->primary]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="new-options-lang-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\DetailView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model backend\models\NewOptionsLang */ | |
| 8 | + | |
| 9 | +$this->title = $model->primary; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'New Options Langs'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="new-options-lang-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->primary], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->primary], [ | |
| 20 | + 'class' => 'btn btn-danger', | |
| 21 | + 'data' => [ | |
| 22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 23 | + 'method' => 'post', | |
| 24 | + ], | |
| 25 | + ]) ?> | |
| 26 | + </p> | |
| 27 | + | |
| 28 | + <?= DetailView::widget([ | |
| 29 | + 'model' => $model, | |
| 30 | + 'attributes' => [ | |
| 31 | + 'primary', | |
| 32 | + 'id', | |
| 33 | + 'lang_id', | |
| 34 | + 'value:ntext', | |
| 35 | + ], | |
| 36 | + ]) ?> | |
| 37 | + | |
| 38 | +</div> | ... | ... |
| 1 | +<?php | |
| 2 | +use yii\grid\GridView; | |
| 3 | +use yii\grid\SerialColumn; | |
| 4 | +use yii\helpers\VarDumper; | |
| 5 | +use yii\grid\ActionColumn; | |
| 6 | +use yii\helpers\Html; | |
| 7 | +use yii\widgets\Pjax; | |
| 8 | +$this->title = Yii::t('app', 'Requests'); | |
| 9 | +?> | |
| 10 | +<div class="site-requests"> | |
| 11 | + <?php | |
| 12 | + echo GridView::widget([ | |
| 13 | + 'dataProvider' => $dataProvider, | |
| 14 | + 'columns' => [ | |
| 15 | + [ | |
| 16 | + 'class' => 'yii\grid\SerialColumn' | |
| 17 | + ], | |
| 18 | + [ | |
| 19 | + 'attribute' => 'created_at', | |
| 20 | + ], | |
| 21 | + [ | |
| 22 | + 'header' => Yii::t('app', 'values'), | |
| 23 | + 'content' => function($model, $key, $index, $column) { | |
| 24 | + $value = ''; | |
| 25 | + $langs = $model->options; | |
| 26 | + $lang = $model->getOptionDefaultLang(true); | |
| 27 | + $value .= "<b>{$model->name}</b>:{$lang['value']}"; | |
| 28 | + foreach($langs as $onemodel) { | |
| 29 | + $lang = $onemodel->getOptionDefaultLang(true); | |
| 30 | + $value .= "<br><b>{$onemodel->name}</b>:{$lang['value']}"; | |
| 31 | + } | |
| 32 | + return $value; | |
| 33 | + } | |
| 34 | + ], | |
| 35 | + [ | |
| 36 | + 'class' => 'yii\grid\ActionColumn', | |
| 37 | + 'template' => '{requests} {delete-req}', | |
| 38 | + 'buttons' => [ | |
| 39 | + 'requests' => function($url, $model, $key) { | |
| 40 | + return Html::a( | |
| 41 | + '', | |
| 42 | + $model->options['is_new']->getOptionDefaultLang()->value?$url:'#', | |
| 43 | + [ | |
| 44 | + 'class' => $model->options['is_new']->getOptionDefaultLang()->value?'glyphicon glyphicon-eye-open':'glyphicon glyphicon-eye-close', | |
| 45 | + 'title' => Yii::t('app', 'Make already read') | |
| 46 | + ] | |
| 47 | + ); | |
| 48 | + }, | |
| 49 | + 'delete-req' => function($url, $model, $key) { | |
| 50 | + return Html::a( | |
| 51 | + '', | |
| 52 | + $url, | |
| 53 | + [ | |
| 54 | + 'class' => 'glyphicon glyphicon-trash', | |
| 55 | + 'title' => Yii::t('app', 'Delete'), | |
| 56 | + 'data' => [ | |
| 57 | + 'label' => Yii::t('app', 'Delete'), | |
| 58 | + 'confirm' => Yii::t('app', 'Are you sure you want delete this element?'), | |
| 59 | + 'method' => 'post', | |
| 60 | + 'pjax' => 0 | |
| 61 | + ] | |
| 62 | + ] | |
| 63 | + ); | |
| 64 | + } | |
| 65 | + ] | |
| 66 | + ] | |
| 67 | + ], | |
| 68 | + ]); | |
| 69 | + ?> | |
| 70 | +</div> | ... | ... |
backend/web/css/flags32.css
| ... | ... | @@ -246,4 +246,8 @@ |
| 246 | 246 | .f32 .sx{background-position:0 -7808px;} |
| 247 | 247 | .f32 .cw{background-position:0 -7840px;} |
| 248 | 248 | .f32 .ss{background-position:0 -7872px;} |
| 249 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 249 | 250 | .f32 .nu{background-position:0 -7904px;} |
| 251 | +======= | |
| 252 | +.f32 .nu{background-position:0 -7904px;} | |
| 253 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | ... | ... |
| 1 | +$(function() { | |
| 2 | + var counter = 0; | |
| 3 | + $(document).on('click', '.add_row', function() { | |
| 4 | + counter++; | |
| 5 | + var clone = $('#main_row').clone().html().replace(new RegExp("Option\\[0\\]", 'g'), "Option["+counter+"]"); | |
| 6 | + console.log(form); | |
| 7 | + $(clone).appendTo('#'+form); | |
| 8 | + $('#'+form+' button[type=submit]').parent().appendTo('#'+form); | |
| 9 | + }); | |
| 10 | + $(document).on('click', '.add_lang', function() { | |
| 11 | + var field_block = $(this).parent().parent(); | |
| 12 | + if($(this).hasClass('active')) { | |
| 13 | + $(field_block).find('.main_input').attr('required', '').show(); | |
| 14 | + $(field_block).find('.lang_inputs').hide(); | |
| 15 | + $(this).removeClass('active'); | |
| 16 | + } else { | |
| 17 | + $(field_block).find('.main_input').removeAttr('required').hide(); | |
| 18 | + $(field_block).find('.lang_inputs').show(); | |
| 19 | + $(this).addClass('active'); | |
| 20 | + } | |
| 21 | + }); | |
| 22 | + $(document).on('click', '.remove_lang', function() { | |
| 23 | + $(this).parents('.form-wrapper').remove(); | |
| 24 | + }); | |
| 25 | + }); | |
| 0 | 26 | \ No newline at end of file | ... | ... |
common/models/Language.php
| ... | ... | @@ -40,7 +40,7 @@ class Language extends \yii\db\ActiveRecord |
| 40 | 40 | //Получения объекта языка по умолчанию |
| 41 | 41 | static function getDefaultLang() |
| 42 | 42 | { |
| 43 | - return Language::find()->where('`is_default` = :default', [':default' => 1])->one(); | |
| 43 | + return Language::find()->where('is_default = :default', [':default' => 1])->one(); | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | //Получения объекта языка по буквенному идентификатору | ... | ... |
common/translation/ru/app.php
| ... | ... | @@ -11,5 +11,20 @@ return [ |
| 11 | 11 | 'Make default' => 'Установить по умолчанию', |
| 12 | 12 | 'Language Name' => 'Название языка', |
| 13 | 13 | 'Lang Code' => 'Код языка', |
| 14 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 14 | 15 | 'Is Default' => 'По умолчанию' |
| 16 | +======= | |
| 17 | + 'Is Default' => 'По умолчанию', | |
| 18 | + 'adress' => 'Адрес', | |
| 19 | + 'adress_name' => 'Адрес', | |
| 20 | + 'Create adress' => 'Добавить адрес', | |
| 21 | + 'adres' => 'Адрес', | |
| 22 | + 'x' => 'Координата x', | |
| 23 | + 'y' => 'Координата y', | |
| 24 | + 'phone' => 'Телефон', | |
| 25 | + 'name' => 'Название', | |
| 26 | + 'one_name' => 'Имя', | |
| 27 | + 'message' => 'Сообщение', | |
| 28 | + 'Feedback' => 'Обратная связь' | |
| 29 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | |
| 15 | 30 | ]; |
| 16 | 31 | \ No newline at end of file | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -19,6 +19,7 @@ use yii\validators\EmailValidator; |
| 19 | 19 | use common\models\User; |
| 20 | 20 | use yii\helpers\VarDumper; |
| 21 | 21 | use common\models\Page; |
| 22 | +use frontend\models\Option; | |
| 22 | 23 | |
| 23 | 24 | /** |
| 24 | 25 | * Site controller |
| ... | ... | @@ -260,6 +261,7 @@ class SiteController extends Controller |
| 260 | 261 | 'model' => $model, |
| 261 | 262 | ]); |
| 262 | 263 | } |
| 264 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 263 | 265 | public function actionOptions() { |
| 264 | 266 | $option_model = new Options(); |
| 265 | 267 | $option_list = $option_model->find()->where(1)->all(); |
| ... | ... | @@ -301,5 +303,15 @@ class SiteController extends Controller |
| 301 | 303 | $data['option_values'] = $option_values; |
| 302 | 304 | return $this->render('options', ['options' => $data, 'post' => $post]); |
| 303 | 305 | } |
| 306 | +======= | |
| 307 | + | |
| 308 | + public function actionFeedback() { | |
| 309 | + $form[0] = Option::create(\Yii::$app->request->post(), 'Feedback', 1, [['name' => 'one_name', 'template' => 'text', 'translate' => false], ['name' => 'phone', 'template' => 'text', 'translate' => false], ['name' => 'message', 'template' => 'text', 'translate' => false]], false); | |
| 310 | + if($form[0]['success'] == false) { | |
| 311 | + return $this->render('feedback', ['forms' => $form]); | |
| 312 | + } else { | |
| 313 | + return $this->render('index'); | |
| 314 | + } | |
| 315 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | |
| 304 | 316 | } |
| 305 | 317 | } | ... | ... |
frontend/models/Option.php
| ... | ... | @@ -48,11 +48,12 @@ class Option extends \yii\db\ActiveRecord |
| 48 | 48 | 'name' => Yii::t('app', 'Name'), |
| 49 | 49 | 'template' => Yii::t('app', 'Template'), |
| 50 | 50 | 'parent_id' => Yii::t('app', 'Parent ID'), |
| 51 | + 'created_at' => Yii::t('app', 'Date created'), | |
| 51 | 52 | ]; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | public function getLangs() { |
| 55 | - return (new Language())->find()->where(['>', 'language_id', 0])->asArray()->all(); | |
| 56 | + return (new Language())->find()->where(['>', 'language_id', 0])->andWhere(['active' => 1])->asArray()->all(); | |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | 59 | public static function change($id, $post, $modeldb, $model_id) { |
| ... | ... | @@ -126,7 +127,12 @@ class Option extends \yii\db\ActiveRecord |
| 126 | 127 | ); |
| 127 | 128 | } |
| 128 | 129 | |
| 130 | +<<<<<<< 1fd2bdb43fc5cfdcf100cac8b72e67fd81e7f0fa | |
| 129 | 131 | public static function create($post, $modeldb, $model_id, $fields) { |
| 132 | +======= | |
| 133 | + public static function create($post, $modeldb, $model_id, $fields, $multiple) { | |
| 134 | + $multiple = boolval($multiple); | |
| 135 | +>>>>>>> 0e0edb85a79343e4d020ff05378179e2323b21bd | |
| 130 | 136 | $model = new Option(); |
| 131 | 137 | $modellang = new OptionLang(); |
| 132 | 138 | if(!empty($post['Option'])) { |
| ... | ... | @@ -197,6 +203,24 @@ class Option extends \yii\db\ActiveRecord |
| 197 | 203 | } |
| 198 | 204 | } |
| 199 | 205 | if($ok) { |
| 206 | + if($modeldb == 'Feedback') { | |
| 207 | + $newflag = new Option(); | |
| 208 | + $newflag->model = $modeldb; | |
| 209 | + $newflag->model_id = $model_id; | |
| 210 | + $newflag->name = 'is_new'; | |
| 211 | + $newflag->template = 'checkbox'; | |
| 212 | + $newflag->parent_id = $parentid; | |
| 213 | + $newflag->translate = 0; | |
| 214 | + if($newflag->save()) { | |
| 215 | + $newflaglang = new OptionLang(); | |
| 216 | + $newflaglang->id = $newflag->option_id; | |
| 217 | + $newflaglang->lang_id = 0; | |
| 218 | + $newflaglang->value = '1'; | |
| 219 | + if(!$newflaglang->save()) { | |
| 220 | + $newflag->delete(); | |
| 221 | + } | |
| 222 | + } | |
| 223 | + } | |
| 200 | 224 | return array('models' => $models, 'modelslang' => $modelslang, 'success' => true); |
| 201 | 225 | } else { |
| 202 | 226 | return array( |
| ... | ... | @@ -205,7 +229,8 @@ class Option extends \yii\db\ActiveRecord |
| 205 | 229 | 'modeldb' => $modeldb, |
| 206 | 230 | 'model_id' => $model_id, |
| 207 | 231 | 'fields' => $fields, |
| 208 | - 'success' => false | |
| 232 | + 'success' => false, | |
| 233 | + 'multiple' => $multiple | |
| 209 | 234 | ); |
| 210 | 235 | } |
| 211 | 236 | } else { |
| ... | ... | @@ -214,8 +239,43 @@ class Option extends \yii\db\ActiveRecord |
| 214 | 239 | 'modeldb' => $modeldb, |
| 215 | 240 | 'model_id' => $model_id, |
| 216 | 241 | 'fields' => $fields, |
| 217 | - 'success' => false | |
| 242 | + 'success' => false, | |
| 243 | + 'multiple' => $multiple | |
| 218 | 244 | ); |
| 219 | 245 | } |
| 220 | 246 | } |
| 247 | + | |
| 248 | + public function getOptions() { | |
| 249 | + return $this->hasMany(Option::className(), ['parent_id' => 'option_id'])->indexBy('name'); | |
| 250 | + } | |
| 251 | + | |
| 252 | + public function getOption() { | |
| 253 | + return $this->hasOne(Option::className(), ['option_id' => 'parent_id']); | |
| 254 | + } | |
| 255 | + | |
| 256 | + public function getOptionLangs() { | |
| 257 | + return $this->hasMany(OptionLang::className(), ['id' => 'option_id']); | |
| 258 | + } | |
| 259 | + | |
| 260 | + public function getOptionDefaultLang($array = false) { | |
| 261 | + $query = $this->getOptionLangs()->where(['lang_id' => 0]); | |
| 262 | + if($array) { | |
| 263 | + $query->asArray(); | |
| 264 | + } | |
| 265 | + return $query->one(); | |
| 266 | + } | |
| 267 | + | |
| 268 | + public static function markOld($id) { | |
| 269 | + $model = Option::findOne($id); | |
| 270 | + $is_new = $model->getOptions()->where(['name' => 'is_new'])->one(); | |
| 271 | + if(empty($is_new)) return false; | |
| 272 | + $is_newlang = $is_new->getOptionDefaultLang(); | |
| 273 | + $is_newlang->value = '0'; | |
| 274 | + if($is_newlang->save()) { | |
| 275 | + return true; | |
| 276 | + } else { | |
| 277 | + return false; | |
| 278 | + } | |
| 279 | + } | |
| 280 | + | |
| 221 | 281 | } | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace frontend\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\base\Model; | |
| 7 | +use yii\data\ActiveDataProvider; | |
| 8 | +use frontend\models\OptionLang; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * OptionLangSearch represents the model behind the search form about `frontend\models\OptionLang`. | |
| 12 | + */ | |
| 13 | +class OptionLangSearch extends OptionLang | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @inheritdoc | |
| 17 | + */ | |
| 18 | + public function rules() | |
| 19 | + { | |
| 20 | + return [ | |
| 21 | + [['primary', 'id', 'lang_id'], 'integer'], | |
| 22 | + [['value'], '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 = OptionLang::find(); | |
| 45 | + | |
| 46 | + $dataProvider = new ActiveDataProvider([ | |
| 47 | + 'query' => $query, | |
| 48 | + ]); | |
| 49 | + | |
| 50 | + $this->load($params); | |
| 51 | + | |
| 52 | + if (!$this->validate()) { | |
| 53 | + // uncomment the following line if you do not want to return any records when validation fails | |
| 54 | + // $query->where('0=1'); | |
| 55 | + return $dataProvider; | |
| 56 | + } | |
| 57 | + | |
| 58 | + $query->andFilterWhere([ | |
| 59 | + 'primary' => $this->primary, | |
| 60 | + 'id' => $this->id, | |
| 61 | + 'lang_id' => $this->lang_id, | |
| 62 | + ]); | |
| 63 | + | |
| 64 | + $query->andFilterWhere(['like', 'value', $this->value]); | |
| 65 | + | |
| 66 | + return $dataProvider; | |
| 67 | + } | |
| 68 | +} | ... | ... |
frontend/models/OptionSearch.php
| ... | ... | @@ -46,7 +46,12 @@ class OptionSearch extends Option |
| 46 | 46 | $dataProvider = new ActiveDataProvider([ |
| 47 | 47 | 'query' => $query, |
| 48 | 48 | ]); |
| 49 | - | |
| 49 | + $data = [ | |
| 50 | + 'OptionSearch' => [ | |
| 51 | + 'model' => 'Main' | |
| 52 | + ] | |
| 53 | + ]; | |
| 54 | + | |
| 50 | 55 | $this->load($params); |
| 51 | 56 | |
| 52 | 57 | if (!$this->validate()) { |
| ... | ... | @@ -54,16 +59,19 @@ class OptionSearch extends Option |
| 54 | 59 | // $query->where('0=1'); |
| 55 | 60 | return $dataProvider; |
| 56 | 61 | } |
| 57 | - | |
| 62 | + | |
| 63 | + $query->andWhere(['parent_id' => null]); | |
| 64 | + | |
| 58 | 65 | $query->andFilterWhere([ |
| 59 | 66 | 'option_id' => $this->option_id, |
| 60 | 67 | 'model_id' => $this->model_id, |
| 61 | 68 | 'parent_id' => $this->parent_id, |
| 62 | 69 | ]); |
| 63 | - | |
| 70 | + | |
| 64 | 71 | $query->andFilterWhere(['like', 'model', $this->model]) |
| 65 | 72 | ->andFilterWhere(['like', 'name', $this->name]) |
| 66 | 73 | ->andFilterWhere(['like', 'template', $this->template]); |
| 74 | + | |
| 67 | 75 | |
| 68 | 76 | return $dataProvider; |
| 69 | 77 | } | ... | ... |
frontend/views/option/_form.php
| ... | ... | @@ -12,7 +12,7 @@ use yii\widgets\ActiveForm; |
| 12 | 12 | <?php $form = ActiveForm::begin(); ?> |
| 13 | 13 | <input type="hidden" name="Option[model]" value="<?=$modeldb?>"/> |
| 14 | 14 | <input type="hidden" name="Option[model_id]" value="<?=$model_id?>"/> |
| 15 | - <p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p> | |
| 15 | + <?php if($multiple) { ?><p class="text-right"><span class="glyphicon glyphicon-plus add_row"></span></p><?php }?> | |
| 16 | 16 | <?php if(empty($models)) { |
| 17 | 17 | ?> |
| 18 | 18 | <div class="form-group" id="main_row"> | ... | ... |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* @var $this yii\web\View */ | |
| 4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
| 5 | +/* @var $model \frontend\models\ContactForm */ | |
| 6 | + | |
| 7 | +use yii\helpers\Html; | |
| 8 | +use yii\bootstrap\ActiveForm; | |
| 9 | +use yii\captcha\Captcha; | |
| 10 | + | |
| 11 | +$this->title = Yii::t('app', 'Feedback'); | |
| 12 | +$this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | +<div class="site-contact"> | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + <?php foreach($forms as $oneform) { | |
| 17 | + echo $this->render('/option/_form', $oneform); | |
| 18 | + }?> | |
| 19 | +</div> | ... | ... |