From f8222eb89c89d91981676e6418025527b1720e70 Mon Sep 17 00:00:00 2001 From: Glambertessa Date: Thu, 14 Nov 2019 17:21:34 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 2 +- .../card/controllers/UserCardController.php | 18 +++ backend/modules/card/models/UserCard.php | 97 ++++++++++--- .../modules/card/views/user-card/_form.php | 137 ++++++++++-------- .../modules/card/views/user-card/create.php | 2 +- .../modules/card/views/user-card/generate.php | 3 + .../modules/card/views/user-card/index.php | 36 ++--- backend/modules/card/views/user-card/view.php | 16 +- backend/web/.gitignore | 1 + common/models/User.php | 2 +- common/models/UserCard.php | 6 +- ..._add_id_user_column_to_user_card_table.php | 57 ++++++++ frontend/config/main.php | 10 +- frontend/modules/access/Access.php | 24 +++ .../access/controllers/AccessController.php | 31 ++++ .../access/controllers/DefaultController.php | 20 +++ .../modules/access/views/access/index.php | 13 ++ .../modules/access/views/default/index.php | 12 ++ frontend/views/layouts/main.php | 102 ++++++------- 19 files changed, 426 insertions(+), 163 deletions(-) create mode 100644 backend/modules/card/views/user-card/generate.php create mode 100644 console/migrations/m191114_124130_add_id_user_column_to_user_card_table.php create mode 100644 frontend/modules/access/Access.php create mode 100644 frontend/modules/access/controllers/AccessController.php create mode 100644 frontend/modules/access/controllers/DefaultController.php create mode 100644 frontend/modules/access/views/access/index.php create mode 100644 frontend/modules/access/views/default/index.php diff --git a/backend/config/main.php b/backend/config/main.php index 21f33c1..c8dd07a 100755 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -42,7 +42,7 @@ return [ 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', - 'baseUrl' => '/secure', + 'baseUrl' => '', ], 'user' => [ 'identityClass' => 'common\models\User', diff --git a/backend/modules/card/controllers/UserCardController.php b/backend/modules/card/controllers/UserCardController.php index 6ea86c5..039f933 100755 --- a/backend/modules/card/controllers/UserCardController.php +++ b/backend/modules/card/controllers/UserCardController.php @@ -5,6 +5,7 @@ namespace backend\modules\card\controllers; use common\classes\Debug; use common\models\AdditionalFields; use common\models\CardSkill; +use common\models\User; use common\models\FieldsValue; use common\models\FieldsValueNew; use common\models\Status; @@ -71,10 +72,14 @@ class UserCardController extends Controller $skills = CardSkill::find()->where(['card_id' => $id])->with('skill')->all(); + $id_current_user = $this->findModel($id)->id_user; + return $this->render('view', [ 'model' => $this->findModel($id), 'modelFildValue' => $dataProvider, 'skills' => $skills, + // 'userData' => $userData, + 'userData' => User::findOne($id_current_user), ]); } @@ -88,6 +93,8 @@ class UserCardController extends Controller $model = new UserCard(); if ($model->load(Yii::$app->request->post()) && $model->save()) { + UserCard::generateUserForUserCard($model->id); + return $this->redirect(['view', 'id' => $model->id]); } @@ -134,6 +141,17 @@ class UserCardController extends Controller return $this->redirect(['index']); } + /** + * Lists all UserCard models. + * @return mixed + */ + public function actionGenerate() + { + $massage = UserCard::generateUserForUserCard(); + return $this->render('generate', ['massage' => $massage]); + } + + /** * Finds the UserCard model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. diff --git a/backend/modules/card/models/UserCard.php b/backend/modules/card/models/UserCard.php index 72f0b29..5b7654e 100755 --- a/backend/modules/card/models/UserCard.php +++ b/backend/modules/card/models/UserCard.php @@ -2,9 +2,11 @@ namespace backend\modules\card\models; +use Yii; use backend\modules\settings\models\Skill; use common\classes\Debug; use common\models\CardSkill; +use common\models\User; use common\models\FieldsValue; use common\models\FieldsValueNew; use yii\helpers\ArrayHelper; @@ -22,21 +24,25 @@ class UserCard extends \common\models\UserCard [ 'item_id' => \Yii::$app->request->get('id'), 'item_type' => FieldsValueNew::TYPE_PROFILE, - ]) + ] + ) ->all(); $array = []; - if(!empty($fieldValue)){ - foreach ($fieldValue as $item){ - array_push($array, - ['field_id' => $item->field_id, + if (!empty($fieldValue)) { + foreach ($fieldValue as $item) { + array_push( + $array, + [ + 'field_id' => $item->field_id, 'value' => $item->value, 'order' => $item->order, 'type_file' => $item->type_file, - 'field_name' => $item->field->name]); + 'field_name' => $item->field->name + ] + ); } $this->fields = $array; - } - else{ + } else { $this->fields = [ [ 'field_id' => null, @@ -48,28 +54,28 @@ class UserCard extends \common\models\UserCard ]; } - $skill = ArrayHelper::getColumn(CardSkill::find()->where(['card_id' => \Yii::$app->request->get('id')])->all(), - 'skill_id'); + $skill = ArrayHelper::getColumn( + CardSkill::find()->where(['card_id' => \Yii::$app->request->get('id')])->all(), + 'skill_id' + ); if (!empty($skill)) { $this->skill = $skill; - } - } public function afterSave($insert, $changedAttributes) { $post = \Yii::$app->request->post('UserCard'); - if($post['fields']){ + if ($post['fields']) { FieldsValueNew::deleteAll(['item_id' => $this->id, 'item_type' => FieldsValueNew::TYPE_PROFILE]); - foreach ( $post['fields'] as $item) { + foreach ($post['fields'] as $item) { $fildsValue = new FieldsValueNew(); $fildsValue->field_id = $item['field_id']; $fildsValue->value = $item['value']; $fildsValue->type_file = 'text'; - if(substr($item['value'],0,1) == '/'){ + if (substr($item['value'], 0, 1) == '/') { $fildsValue->type_file = 'file'; } $fildsValue->order = $item['order']; @@ -80,10 +86,10 @@ class UserCard extends \common\models\UserCard } } - if($post['skill']){ + if ($post['skill']) { CardSkill::deleteAll(['card_id' => $this->id]); - foreach ( $post['skill'] as $item) { + foreach ($post['skill'] as $item) { $skill = new CardSkill(); $skill->skill_id = $item; $skill->card_id = $this->id; @@ -95,4 +101,59 @@ class UserCard extends \common\models\UserCard parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub } -} \ No newline at end of file + + public function generateUser($email, $status) + { + $user = new User(); + $auth_key = Yii::$app->security->generateRandomString(); + $password = Yii::$app->security->generateRandomString(12); + $password_hash = Yii::$app->security->generatePasswordHash($password); + + $user->username = $email; + $user->auth_key = $auth_key; + $user->password_hash = $password_hash; + $user->email = $email; + if ($status == 1) $user->status = 10; + + $user->save(); + + $log = "Логин: " . $email . " Пароль: " . $password . " | "; + file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX); + + return $user->id; + } + + public function genereateLinlkOnUser($user_card, $user_id) + { + $user_card->id_user = $user_id; + $user_card->save(); + } + + public function generateUserForUserCard($card_id = null) + { + $userCardQuery = UserCard::find(); + $card_id ? $userCardQuery->where(['id' => $card_id]) : $userCardQuery->where(['id_user' => NULL]); + $user_card_array = $userCardQuery->all(); + $user_array = User::find()->select(['id', 'email'])->all(); + + foreach ($user_card_array as $user_card_value) { + + foreach ($user_array as $user_value) + if ($user_card_value->email == $user_value->email) { + $user_id = $user_value->id; + break; + } else $user_id = NULL; + + if ($user_id) { + UserCard::genereateLinlkOnUser($user_card_value, $user_id); + } else { + + $user_id = UserCard::generateUser($user_card_value->email, $user_card_value->status); + UserCard::genereateLinlkOnUser($user_card_value, $user_id); + } + } + + if ($user_card_array) return "Данные успешно сгенерированы"; + else return "Нет данных для генерации"; + } +} diff --git a/backend/modules/card/views/user-card/_form.php b/backend/modules/card/views/user-card/_form.php index 6ded48a..0f24963 100755 --- a/backend/modules/card/views/user-card/_form.php +++ b/backend/modules/card/views/user-card/_form.php @@ -28,7 +28,7 @@ use yii\widgets\ActiveForm;
-
+
'ru', @@ -47,13 +47,13 @@ use yii\widgets\ActiveForm; ?>
- + 'ru', 'controller' => 'elfinder', // вставляем название контроллера, по умолчанию равен elfinder - 'filter' => ['image','application/zip','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document'], + 'filter' => ['image', 'application/zip', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], // фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con.. 'name' => 'UserCard[resume]', 'id' => 'usercard-resume', @@ -73,31 +73,36 @@ use yii\widgets\ActiveForm;
- field($model, 'gender')->dropDownList($model->genders, - [ - 'prompt' => 'Выберите' - ]) ?> + field($model, 'gender')->dropDownList( + $model->genders, + [ + 'prompt' => 'Выберите' + ] + ) ?>
- field($model, 'dob')->input('date', - [ - 'placeholder' => 'Zadejte svůj Datum narození', - 'language' => 'en', - "data-format" => "DD MMMM YYYY", - - ]) ?> -
-
- field($model, 'status') - ->dropDownList(\common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE), + field($model, 'dob')->input( + 'date', [ - 'prompt' => 'Выберите' + 'placeholder' => 'Zadejte svůj Datum narození', + 'language' => 'en', + "data-format" => "DD MMMM YYYY", + ] ) ?>
+
+ field($model, 'status') + ->dropDownList( + \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE), + [ + 'prompt' => 'Выберите' + ] + ) ?> +
@@ -116,10 +121,11 @@ use yii\widgets\ActiveForm;
- field($model, 'skill')->widget(Select2::class, + field($model, 'skill')->widget( + Select2::class, [ - 'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(),'id', 'name'), - 'options' => ['placeholder' => '...','class' => 'form-control', 'multiple' => true], + 'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(), 'id', 'name'), + 'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true], 'pluginOptions' => [ 'allowClear' => true ], @@ -130,49 +136,52 @@ use yii\widgets\ActiveForm;
- field($model, 'fields')->widget(MultipleInput::class, [ - 'cloneButton' => true, - 'columns' => [ - [ - 'name' => 'field_id', - 'type' => 'dropDownList', - 'title' => 'Поле', - 'defaultValue' => null, - 'items' => \yii\helpers\ArrayHelper::map(\backend\modules\settings\models\AdditionalFields::find() - ->joinWith('useFields') - ->where(['`use_field`.`use`' => \common\models\UseStatus::USE_PROFILE]) - ->all(), - 'id', 'name'), - 'options' => ['prompt' => 'Выберите'] - ], - [ - 'name' => 'value', - 'title' => 'Значение', - 'type' => InputFile::className(), - 'options' => [ - 'language' => 'ru', - 'controller' => 'elfinder', - // вставляем название контроллера, по умолчанию равен elfinder - // фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con.. - 'name' => 'fields[value]', - 'id' => 'fields-value', - 'options' => ['class' => 'form-control itemImg', 'maxlength' => '255'], - 'buttonOptions' => ['class' => 'btn btn-primary'], - 'value' => $model->fields[0]['value'], - 'buttonName' => 'Выбрать файл', + field($model, 'fields')->widget(MultipleInput::class, [ + 'cloneButton' => true, + 'columns' => [ + [ + 'name' => 'field_id', + 'type' => 'dropDownList', + 'title' => 'Поле', + 'defaultValue' => null, + 'items' => \yii\helpers\ArrayHelper::map( + \backend\modules\settings\models\AdditionalFields::find() + ->joinWith('useFields') + ->where(['`use_field`.`use`' => \common\models\UseStatus::USE_PROFILE]) + ->all(), + 'id', + 'name' + ), + 'options' => ['prompt' => 'Выберите'] + ], + [ + 'name' => 'value', + 'title' => 'Значение', + 'type' => InputFile::className(), + 'options' => [ + 'language' => 'ru', + 'controller' => 'elfinder', + // вставляем название контроллера, по умолчанию равен elfinder + // фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con.. + 'name' => 'fields[value]', + 'id' => 'fields-value', + 'options' => ['class' => 'form-control itemImg', 'maxlength' => '255'], + 'buttonOptions' => ['class' => 'btn btn-primary'], + 'value' => $model->fields[0]['value'], + 'buttonName' => 'Выбрать файл', + ], + ], + [ + 'name' => 'order', + 'title' => 'Приоритет', + 'enableError' => true, + 'options' => [ + 'class' => 'input-priority' + ] ], ], - [ - 'name' => 'order', - 'title' => 'Приоритет', - 'enableError' => true, - 'options' => [ - 'class' => 'input-priority' - ] - ], - ], - ])->label('Дополнительно'); - ?> + ])->label('Дополнительно'); + ?>
@@ -182,4 +191,4 @@ use yii\widgets\ActiveForm; -
+
\ No newline at end of file diff --git a/backend/modules/card/views/user-card/create.php b/backend/modules/card/views/user-card/create.php index f3bb8da..19008e6 100755 --- a/backend/modules/card/views/user-card/create.php +++ b/backend/modules/card/views/user-card/create.php @@ -13,4 +13,4 @@ $this->params['breadcrumbs'][] = $this->title; 'model' => $model, ]) ?> -
+ \ No newline at end of file diff --git a/backend/modules/card/views/user-card/generate.php b/backend/modules/card/views/user-card/generate.php new file mode 100644 index 0000000..bbb4133 --- /dev/null +++ b/backend/modules/card/views/user-card/generate.php @@ -0,0 +1,3 @@ +params['breadcrumbs'][] = $this->title;

'btn btn-success']) ?> + 'btn btn-success']) ?>

params['breadcrumbs'][] = $this->title; [ 'label' => 'photo', 'format' => 'raw', - 'value' => function($model){ - return Html::img(Url::to($model->photo),[ + 'value' => function ($model) { + return Html::img(Url::to($model->photo), [ 'style' => 'width:100px;' ]); }, @@ -42,14 +43,14 @@ $this->params['breadcrumbs'][] = $this->title; //'dob', [ 'attribute' => 'status', - 'value' => function($model){ + 'value' => function ($model) { return $model->status0->name; }, 'filter' => kartik\select2\Select2::widget([ 'model' => $searchModel, 'attribute' => 'status', 'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_PROFILE), - 'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'], + 'options' => ['placeholder' => 'Начните вводить...', 'class' => 'form-control'], 'pluginOptions' => [ 'allowClear' => true ], @@ -58,22 +59,21 @@ $this->params['breadcrumbs'][] = $this->title; //'created_at', //'updated_at', [ - 'label' => 'Навыки', - 'format' => 'raw', - 'value' => function($model){ - $str = ''; - foreach ($model->skillValues as $item) - { - $str .= $item->skill->name . ', '; - } - $str = substr( $str, 0, -2); - return $str; - }, + 'label' => 'Навыки', + 'format' => 'raw', + 'value' => function ($model) { + $str = ''; + foreach ($model->skillValues as $item) { + $str .= $item->skill->name . ', '; + } + $str = substr($str, 0, -2); + return $str; + }, 'filter' => kartik\select2\Select2::widget([ - 'attribute' => 'skills', + 'attribute' => 'skills', 'model' => $searchModel, 'data' => \common\models\UserCard::getNameSkills(), - 'options' => ['multiple' => true,'placeholder' => 'Выбрать параметр','class' => 'form-control'], + 'options' => ['multiple' => true, 'placeholder' => 'Выбрать параметр', 'class' => 'form-control'], 'pluginOptions' => [ 'allowClear' => true ], @@ -83,4 +83,4 @@ $this->params['breadcrumbs'][] = $this->title; ['class' => 'yii\grid\ActionColumn'], ], ]); ?> - + \ No newline at end of file diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index 639c63e..be457ab 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -6,6 +6,7 @@ use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model backend\modules\card\models\UserCard */ +/* @var $userData common\models\User */ /* @var $skills \common\models\CardSkill */ /* @var $skill \common\models\Skill */ @@ -27,14 +28,14 @@ $this->params['breadcrumbs'][] = $this->title; [ 'attribute' => 'Photo', 'format' => 'raw', - 'value' => function($model){ + 'value' => function ($model) { return Html::tag('img', null, ['src' => $model->photo, 'width' => '100px']); } ], [ 'attribute' => 'Resume', 'format' => 'raw', - 'value' => function($model){ + 'value' => function ($model) { return Html::a('Скачать', $model->resume, ['target' => '_blank']); } ], @@ -62,21 +63,21 @@ $this->params['breadcrumbs'][] = $this->title;

Навыки

- + name; ?>

Дополнительные сведения

$modelFildValue, - 'layout'=>"{items}", + 'layout' => "{items}", 'columns' => [ 'field.name:text:Поле', [ 'attribute' => 'value', 'format' => 'raw', - 'value' => function($model){ - if ($model->type_file == 'file'){ + 'value' => function ($model) { + if ($model->type_file == 'file') { return $model->value . ' (' . Html::a('Скачать', $model->value, ['target' => '_blank', 'download' => 'download']) . ')'; } return $model->value; @@ -84,4 +85,5 @@ $this->params['breadcrumbs'][] = $this->title; ], ], ]); ?> - + + \ No newline at end of file diff --git a/backend/web/.gitignore b/backend/web/.gitignore index d94a089..7df2d87 100755 --- a/backend/web/.gitignore +++ b/backend/web/.gitignore @@ -1,3 +1,4 @@ /index.php /index-test.php /robots.txt +/log.txt \ No newline at end of file diff --git a/common/models/User.php b/common/models/User.php index e1f39cb..d706022 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -1,4 +1,5 @@ 255], [['salary'], 'string', 'max' => 100], @@ -79,6 +80,7 @@ class UserCard extends \yii\db\ActiveRecord { return [ 'id' => 'ID', + 'id_user' => 'ID пользователя', 'fio' => 'ФИО', 'passport' => 'Паспорт', 'photo' => 'Фото', @@ -150,7 +152,7 @@ class UserCard extends \yii\db\ActiveRecord public static function getNameSkills() { - return ArrayHelper::map(Skill::find()->all(),'id', 'name'); + return ArrayHelper::map(Skill::find()->all(), 'id', 'name'); } public static function getUserList() diff --git a/console/migrations/m191114_124130_add_id_user_column_to_user_card_table.php b/console/migrations/m191114_124130_add_id_user_column_to_user_card_table.php new file mode 100644 index 0000000..a712775 --- /dev/null +++ b/console/migrations/m191114_124130_add_id_user_column_to_user_card_table.php @@ -0,0 +1,57 @@ +addColumn('{{%user_card}}', 'id_user', $this->integer()); + + // creates index for column `id_user` + $this->createIndex( + '{{%idx-user_card-id_user}}', + '{{%user_card}}', + 'id_user' + ); + + // add foreign key for table `{{%user}}` + $this->addForeignKey( + '{{%fk-user_card-id_user}}', + '{{%user_card}}', + 'id_user', + '{{%user}}', + 'id', + 'CASCADE' + ); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + // drops foreign key for table `{{%user}}` + $this->dropForeignKey( + '{{%fk-user_card-id_user}}', + '{{%user_card}}' + ); + + // drops index for column `id_user` + $this->dropIndex( + '{{%idx-user_card-id_user}}', + '{{%user_card}}' + ); + + $this->dropColumn('{{%user_card}}', 'id_user'); + } +} diff --git a/frontend/config/main.php b/frontend/config/main.php index d539bf9..767b94d 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -11,6 +11,13 @@ return [ 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'frontend\controllers', + + 'modules' => [ + 'access' => [ + 'class' => 'frontend\modules\access\Access', + ], + ], + 'components' => [ 'request' => [ 'csrfParam' => '_csrf-frontend', @@ -41,8 +48,7 @@ return [ 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, - 'rules' => [ - ], + 'rules' => [], ], ], diff --git a/frontend/modules/access/Access.php b/frontend/modules/access/Access.php new file mode 100644 index 0000000..a0296c9 --- /dev/null +++ b/frontend/modules/access/Access.php @@ -0,0 +1,24 @@ +user->id; + $query = "SELECT accesses.name, accesses.access FROM `accesses`, `user_card`, `user_card_accesses` WHERE user_card.id_user =" . $id_user . " AND user_card_accesses.user_card_id = user_card.id AND accesses.id = user_card_accesses.accesses_id "; + $access = Accesses::findBySql($query); + + $dataProvider = new ActiveDataProvider([ + 'query' => $access, + 'pagination' => [ + 'pageSize' => 200, + ], + ]); + + return $this->render('index', compact('dataProvider', $dataProvider)); + } +} diff --git a/frontend/modules/access/controllers/DefaultController.php b/frontend/modules/access/controllers/DefaultController.php new file mode 100644 index 0000000..4dc8700 --- /dev/null +++ b/frontend/modules/access/controllers/DefaultController.php @@ -0,0 +1,20 @@ +render('index'); + } +} diff --git a/frontend/modules/access/views/access/index.php b/frontend/modules/access/views/access/index.php new file mode 100644 index 0000000..9570c63 --- /dev/null +++ b/frontend/modules/access/views/access/index.php @@ -0,0 +1,13 @@ + $dataProvider, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'name', + 'access', + ], +]); diff --git a/frontend/modules/access/views/default/index.php b/frontend/modules/access/views/default/index.php new file mode 100644 index 0000000..462171f --- /dev/null +++ b/frontend/modules/access/views/default/index.php @@ -0,0 +1,12 @@ +
+

context->action->uniqueId ?>

+

+ This is the view content for action "context->action->id ?>". + The action belongs to the controller "context) ?>" + in the "context->module->id ?>" module. +

+

+ You may customize this page by editing the following file:
+ +

+
\ No newline at end of file diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index f4beaf5..d4110ba 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -15,6 +15,7 @@ AppAsset::register($this); beginPage() ?> + @@ -23,61 +24,64 @@ AppAsset::register($this); <?= Html::encode($this->title) ?> head() ?> + -beginBody() ?> + beginBody() ?> -
- Yii::$app->name, - 'brandUrl' => Yii::$app->homeUrl, - 'options' => [ - 'class' => 'navbar-inverse navbar-fixed-top', - ], - ]); - $menuItems = [ - ['label' => 'Home', 'url' => ['/site/index']], - ['label' => 'About', 'url' => ['/site/about']], - ['label' => 'Contact', 'url' => ['/site/contact']], - ]; - if (Yii::$app->user->isGuest) { - $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; - $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; - } else { - $menuItems[] = '
  • ' - . Html::beginForm(['/site/logout'], 'post') - . Html::submitButton( - 'Logout (' . Yii::$app->user->identity->username . ')', - ['class' => 'btn btn-link logout'] - ) - . Html::endForm() - . '
  • '; - } - echo Nav::widget([ - 'options' => ['class' => 'navbar-nav navbar-right'], - 'items' => $menuItems, - ]); - NavBar::end(); - ?> +
    + Yii::$app->name, + 'brandUrl' => Yii::$app->homeUrl, + 'options' => [ + 'class' => 'navbar-inverse navbar-fixed-top', + ], + ]); + $menuItems = [ + ['label' => 'Home', 'url' => ['/site/index']], + ['label' => 'About', 'url' => ['/site/about']], + ['label' => 'Contact', 'url' => ['/site/contact']], + ['label' => 'Access', 'url' => ['/access/access/index']], + ]; + if (Yii::$app->user->isGuest) { + $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; + } else { + $menuItems[] = '
  • ' + . Html::beginForm(['/site/logout'], 'post') + . Html::submitButton( + 'Logout (' . Yii::$app->user->identity->username . ')', + ['class' => 'btn btn-link logout'] + ) + . Html::endForm() + . '
  • '; + } + echo Nav::widget([ + 'options' => ['class' => 'navbar-nav navbar-right'], + 'items' => $menuItems, + ]); + NavBar::end(); + ?> -
    - isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], - ]) ?> - - +
    + isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], + ]) ?> + + +
    -
    -
    -
    -

    © name) ?>

    +
    +
    +

    © name) ?>

    -

    -
    -
    +

    +
    +
    -endBody() ?> + endBody() ?> + -endPage() ?> +endPage() ?> \ No newline at end of file From 18ce2ce5fcaf89978ef598fcecfec73e43ffd6c0 Mon Sep 17 00:00:00 2001 From: Glambertessa Date: Thu, 14 Nov 2019 17:36:26 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9=20=D1=81=20secure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/config/main.php b/backend/config/main.php index c8dd07a..bd49308 100755 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -42,7 +42,7 @@ return [ 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', - 'baseUrl' => '', + 'baseUrl' => 'secure', ], 'user' => [ 'identityClass' => 'common\models\User', From 4cf54e2ba6dd5ba15cb9fc0b87e97e64316e97f3 Mon Sep 17 00:00:00 2001 From: Glambertessa Date: Fri, 15 Nov 2019 13:25:48 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/main.php | 4 +- backend/views/layouts/header.php | 147 ++++++++++++++++--------------- backend/views/layouts/left.php | 32 ++++--- backend/web/css/site.css | 2 +- frontend/views/layouts/main.php | 2 +- 5 files changed, 98 insertions(+), 89 deletions(-) diff --git a/backend/config/main.php b/backend/config/main.php index bd49308..9af44d9 100755 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -42,7 +42,7 @@ return [ 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', - 'baseUrl' => 'secure', + 'baseUrl' => '/secure', ], 'user' => [ 'identityClass' => 'common\models\User', @@ -69,7 +69,7 @@ return [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ - '' => '/card/user-card' + '' => '/card/user-card', ], ], diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php index 8d22b6a..63a6791 100755 --- a/backend/views/layouts/header.php +++ b/backend/views/layouts/header.php @@ -1,5 +1,8 @@ -
    - + \ No newline at end of file diff --git a/backend/views/layouts/left.php b/backend/views/layouts/left.php index 5a9f7b1..d9e9721 100755 --- a/backend/views/layouts/left.php +++ b/backend/views/layouts/left.php @@ -1,14 +1,17 @@ + \ No newline at end of file diff --git a/backend/web/css/site.css b/backend/web/css/site.css index 6425487..b319bb6 100755 --- a/backend/web/css/site.css +++ b/backend/web/css/site.css @@ -10,7 +10,7 @@ } .itemImg, .itemImgs{ - float: left!important; + float: left !important; display: inline-block; width: 30%!important; } diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index d4110ba..6eb5faf 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -41,12 +41,12 @@ AppAsset::register($this); ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], ['label' => 'Contact', 'url' => ['/site/contact']], - ['label' => 'Access', 'url' => ['/access/access/index']], ]; if (Yii::$app->user->isGuest) { $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; } else { + $menuItems[] = ['label' => 'Access', 'url' => ['/access/access/index']]; $menuItems[] = '
  • ' . Html::beginForm(['/site/logout'], 'post') . Html::submitButton( From d134757c971cd9173da023c2aed7bdc2519ca773 Mon Sep 17 00:00:00 2001 From: Glambertessa Date: Fri, 15 Nov 2019 13:46:13 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/views/layouts/header.php | 2 -- backend/views/layouts/left.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php index 63a6791..c464151 100755 --- a/backend/views/layouts/header.php +++ b/backend/views/layouts/header.php @@ -1,8 +1,6 @@ 'Все', 'icon' => 'user', 'url' => ['/card/user-card']]]; foreach ($userStatuses as $key => $status) {