From 2f4c561975e9304f315a273f33ce043cd70a86f1 Mon Sep 17 00:00:00 2001 From: dozer111 Date: Mon, 25 Jun 2018 11:22:18 +0300 Subject: [PATCH] Добавил кологку для заявки для доктора "Страница перехода", --- backend/controllers/VisitController.php | 11 ++++++++++- common/messages/ru/app.php | 4 +--- common/models/Visit.php | 4 +++- console/migrations/m180623_131646_add_request_webpage_column_to_visit_table.php | 25 +++++++++++++++++++++++++ frontend/config/main.php | 25 ++++++++++++++++++++----- 5 files changed, 59 insertions(+), 10 deletions(-) create mode 100644 console/migrations/m180623_131646_add_request_webpage_column_to_visit_table.php diff --git a/backend/controllers/VisitController.php b/backend/controllers/VisitController.php index 21a24fe..04ee4af 100644 --- a/backend/controllers/VisitController.php +++ b/backend/controllers/VisitController.php @@ -59,7 +59,11 @@ ], 'created_at' => [ 'type' => Index::DATETIME_COL, - ] + ], + 'request_webpage' => + [ + 'type' => Index::STRING_COL + ] ], 'model' => Visit::className(), 'hasLanguage' => false, @@ -99,6 +103,10 @@ 'name' => 'created_at', 'type' => Form::STRING, ], + [ + 'name' => 'request_webpage', + 'type' => Form::STRING, + ], ], ], @@ -183,6 +191,7 @@ 'name' => 'updated_at', 'type' => Form::STRING, ], + ]; } diff --git a/common/messages/ru/app.php b/common/messages/ru/app.php index 1156ed9..d6e34b9 100644 --- a/common/messages/ru/app.php +++ b/common/messages/ru/app.php @@ -102,9 +102,7 @@ return [ 'Price list description' =>'Цены на услуги медицинской клиники ABClinik', - - - + 'Request_webpage' => 'Страница перехода', 'FIO' =>'ФИО', 'Email' =>'Email', 'Office address' =>'Украина, Киев, ул. Кудрявская, 31/33', diff --git a/common/models/Visit.php b/common/models/Visit.php index 123bda0..1f4ec44 100644 --- a/common/models/Visit.php +++ b/common/models/Visit.php @@ -79,7 +79,8 @@ 'name', 'phone', 'entity', - 'email' + 'email', + 'request_webpage' ], 'string', 'max' => 255, @@ -100,6 +101,7 @@ 'entity' => Yii::t('app', 'Entity'), 'entity_id' => Yii::t('app', 'Entity ID'), 'email' => Yii::t('app', 'Email'), + 'request_webpage' => Yii::t('app', 'Request_webpage'), ]; } diff --git a/console/migrations/m180623_131646_add_request_webpage_column_to_visit_table.php b/console/migrations/m180623_131646_add_request_webpage_column_to_visit_table.php new file mode 100644 index 0000000..e6814c9 --- /dev/null +++ b/console/migrations/m180623_131646_add_request_webpage_column_to_visit_table.php @@ -0,0 +1,25 @@ +addColumn('visit', 'request_webpage', $this->string(255)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('visit', 'request_webpage'); + } +} diff --git a/frontend/config/main.php b/frontend/config/main.php index 1b1b86f..0ef510a 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -11,7 +11,6 @@ use yii\helpers\Url; return [ 'on beforeRequest' => function () { - $pathInfo = Yii::$app->request->pathInfo; $query = Yii::$app->request->queryString; if (!empty($pathInfo) && substr($pathInfo, -1) === '/' && substr($pathInfo, 0, 1) !== "/") { @@ -43,6 +42,7 @@ use yii\helpers\Url; 'name', 'phone', 'message', + ], 'rules' => [ [ @@ -153,7 +153,8 @@ use yii\helpers\Url; 'email', 'comment', 'entity_id', - 'entity' + 'entity', + ], 'rules' => [ [ @@ -169,7 +170,9 @@ use yii\helpers\Url; 'email' => 'Email', 'comment' => 'Ваш отзыв', 'entity_id' => false, - 'entity' => false + 'entity' => false, + + ], 'inputOptions' => [ @@ -266,7 +269,8 @@ use yii\helpers\Url; 'message', 'entity', - 'entity_id' + 'entity_id', + 'request_webpage', ], 'rules' => [ [ @@ -282,7 +286,8 @@ use yii\helpers\Url; 'phone' => \Yii::t('app','Phone'), 'message' => \Yii::t('app','Message'), 'entity_id' => false, - 'entity' => false + 'entity' => false, + 'request_webpage' => false ], 'inputOptions' => [ @@ -292,6 +297,16 @@ use yii\helpers\Url; 'entity_id' => [ 'type' => 'hiddenInput' ], + 'request_webpage' => [ + 'type' => 'hiddenInput', + 'options' => + [ + #'value' => \Yii::$app->homeUrl, + # 'value' => 'test 123', + 'value' => $_SERVER['REQUEST_URI'], + ], + + ], 'name' => [ 'template' => '
{input}
' ], -- libgit2 0.21.4