Commit f1a1680e12cac265fa384eb5e2005a327b9aa780

Authored by Eugeny Galkovskiy
1 parent 2840ba29

Форма сообщений

common/config/settings.php
... ... @@ -2,10 +2,10 @@
2 2  
3 3 return [
4 4 1 => [
5   - 'phone' => '+38 (044) 593-73-76',
6   - 'phone2' => '+38 (098) 468-07-64',
7   - 'skype' => 'artwebstudio',
8   - 'email' => 'artweb.ua@gmail.com',
  5 + 'phone' => '+38 (068) 380-39-82',
  6 + 'phone2' => '',
  7 + 'skype' => '',
  8 + 'email' => 'zhegal@gmail.com',
9 9 'house' => '1-М',
10 10 'street' => 'пр. М. Бажана',
11 11 'office' => '25',
... ... @@ -20,7 +20,7 @@ return [
20 20 'twitter' => '',
21 21 'name' => 'KB Energy',
22 22 'logo' => '1',
23   - 'about' => '',
  23 + 'about' => 'Комплексний підхід до енергозбереження та енергонезалежності',
24 24 'analytics_key' => '119240817',
25 25 'robots' => 'User-agent: Google
26 26 Disallow:
... ...
common/messages/ua/app.php
1 1 <?php
2   - return [];
3 2 \ No newline at end of file
  3 + return [
  4 + 'id' => 'ID',
  5 + 'name' => 'Ім\'я',
  6 + 'phone' => 'Телефон',
  7 + 'created_at' => 'Створено',
  8 + 'ip' => 'IP',
  9 + 'url' => 'URL',
  10 + 'status' => 'Статус',
  11 + 'message' => 'Повідомлення',
  12 + 'email' => 'Email',
  13 + ];
4 14 \ No newline at end of file
... ...
common/models/Feedback.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\behaviors\AttributeBehavior;
  7 +use yii\behaviors\TimestampBehavior;
  8 +use yii\db\ActiveRecord;
  9 +
  10 +/**
  11 + * This is the model class for table "feedback".
  12 + *
  13 + * @property integer $id
  14 + * @property string $name
  15 + * @property string $email
  16 + * @property string $phone
  17 + * @property string $message
  18 + * @property integer $created_at
  19 + * @property string $ip
  20 + * @property string $url
  21 + * @property bool $status
  22 + */
  23 +class Feedback extends ActiveRecord
  24 +{
  25 +
  26 + const SCENARIO_FEEDBACK = 'feedback';
  27 + const SCENARIO_CALLBACK = 'callback';
  28 +
  29 + public $returnUrl;
  30 +
  31 + /**
  32 + * @inheritdoc
  33 + */
  34 + public static function tableName()
  35 + {
  36 + return 'feedback';
  37 + }
  38 +
  39 + /**
  40 + * @inheritdoc
  41 + */
  42 + public function scenarios()
  43 + {
  44 + $scenarios = parent::scenarios();
  45 + $scenarios = array_merge(
  46 + $scenarios,
  47 + [
  48 + self::SCENARIO_FEEDBACK => [
  49 + 'title',
  50 + 'name',
  51 + 'email',
  52 + 'message',
  53 + ],
  54 + self::SCENARIO_CALLBACK => [
  55 + 'title',
  56 + 'name',
  57 + 'phone',
  58 + 'message',
  59 + ],
  60 + ]
  61 + );
  62 + return $scenarios;
  63 + }
  64 +
  65 + /**
  66 + * @inheritdoc
  67 + */
  68 + public function behaviors()
  69 + {
  70 + return [
  71 + [
  72 + 'class' => TimestampBehavior::className(),
  73 + 'updatedAtAttribute' => false,
  74 + ],
  75 + [
  76 + 'class' => AttributeBehavior::className(),
  77 + 'attributes' => [
  78 + ActiveRecord::EVENT_BEFORE_INSERT => 'ip',
  79 + ],
  80 + 'value' => function ($event) {
  81 + return \Yii::$app->request->userIP;
  82 + },
  83 + ],
  84 + [
  85 + 'class' => AttributeBehavior::className(),
  86 + 'attributes' => [
  87 + ActiveRecord::EVENT_BEFORE_INSERT => 'url',
  88 + ],
  89 + 'value' => function ($event) {
  90 + return \Yii::$app->request->referrer;
  91 + },
  92 + ],
  93 + ];
  94 + }
  95 +
  96 + /**
  97 + * @inheritdoc
  98 + */
  99 + public function rules()
  100 + {
  101 + return [
  102 + [
  103 + [
  104 + 'title',
  105 + 'phone',
  106 + 'name',
  107 + 'email',
  108 + ],
  109 + 'required',
  110 + ],
  111 + [
  112 + [ 'email' ],
  113 + 'email',
  114 + ],
  115 + // [
  116 + // [ 'phone' ],
  117 + // 'match',
  118 + // 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
  119 + // ],
  120 + [
  121 + [
  122 + 'title',
  123 + 'name',
  124 + 'phone',
  125 + 'email',
  126 + ],
  127 + 'string',
  128 + 'max' => 255,
  129 + ],
  130 + [
  131 + [
  132 + 'message',
  133 + ],
  134 + 'string',
  135 + ],
  136 + [
  137 + [
  138 + 'status',
  139 + ],
  140 + 'boolean',
  141 + ],
  142 + ];
  143 + }
  144 +
  145 + /**
  146 + * @inheritdoc
  147 + */
  148 + public function attributeLabels()
  149 + {
  150 + return [
  151 + 'id' => Yii::t('app', 'id'),
  152 + 'name' => Yii::t('app', 'name'),
  153 + 'phone' => Yii::t('app', 'phone'),
  154 + 'created_at' => Yii::t('app', 'created_at'),
  155 + 'ip' => Yii::t('app', 'ip'),
  156 + 'url' => Yii::t('app', 'url'),
  157 + 'status' => Yii::t('app', 'status'),
  158 + 'message' => Yii::t('app', 'message'),
  159 + 'email' => Yii::t('app', 'email'),
  160 + 'title' => Yii::t('app', 'title'),
  161 + ];
  162 + }
  163 +}
... ...
frontend/views/layouts/main.php
... ... @@ -7,7 +7,7 @@
7 7 */
8 8 use artbox\core\components\SeoComponent;
9 9 use artbox\core\helpers\ImageHelper;
10   - use artbox\core\models\Feedback;
  10 + use common\models\Feedback;
11 11 use artbox\core\models\Page;
12 12 use artbox\core\models\User;
13 13 use common\models\Settings;
... ... @@ -305,24 +305,20 @@ _________________________________________________________ --&gt;
305 305 [
306 306 'items' => [
307 307 [
308   - 'label' => \Yii::t('app', 'Наші проекти'),
309   - 'url' => [ '#' ],
  308 + 'label' => \Yii::t('app', 'Чому ми'),
  309 + 'url' => [ '#section1' ],
310 310 ],
311 311 [
312   - 'label' => \Yii::t('app', '10 кроків до енергонезалежності'),
313   - 'url' => [ '#' ],
314   - ],
315   - [
316   - 'label' => \Yii::t('app', 'Чому обирають нас'),
317   - 'url' => [ '#' ],
  312 + 'label' => \Yii::t('app', 'Наші проекти'),
  313 + 'url' => [ '#section2' ],
318 314 ],
319 315 [
320   - 'label' => \Yii::t('app', 'ЗМІ про нас'),
321   - 'url' => [ '#' ],
  316 + 'label' => \Yii::t('app', '10 кроків до енергонезалежності'),
  317 + 'url' => [ '#section3' ],
322 318 ],
323 319 [
324 320 'label' => \Yii::t('app', 'Контакти'),
325   - 'url' => [ '#' ],
  321 + 'url' => [ '#section4' ],
326 322 ],
327 323 ],
328 324 'options' => [
... ... @@ -371,7 +367,7 @@ _________________________________________________________ --&gt;
371 367 <div class="modal-content">
372 368 <div class="modal-header">
373 369 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times</button>
374   - <h3 class="modal-title" id="Login">Feedback</h3>
  370 + <h3 class="modal-title" id="Login">Зворотній зв'язок</h3>
375 371 </div>
376 372 <div class="modal-body">
377 373  
... ... @@ -382,7 +378,7 @@ _________________________________________________________ --&gt;
382 378 'action' => '/site/feedback',
383 379 ]
384 380 ); ?>
385   -
  381 +
386 382 <?= $form->field($feedback, 'name')
387 383 ->textInput(); ?>
388 384  
... ... @@ -401,7 +397,7 @@ _________________________________________________________ --&gt;
401 397  
402 398 <p class="text-center">
403 399 <?= Html::submitButton(
404   - 'Send',
  400 + 'Надіслати',
405 401 [
406 402 'class' => 'send-form btn btn-lg btn-template-primary',
407 403 ]
... ... @@ -495,7 +491,7 @@ _________________________________________________________ --&gt;
495 491 if (!empty($settings->office)) {
496 492 echo \Yii::t(
497 493 'app',
498   - 'Office {office}',
  494 + 'Офіс {office}',
499 495 [
500 496 'office' => $settings->office,
501 497 ]
... ... @@ -517,14 +513,6 @@ _________________________________________________________ --&gt;
517 513 }
518 514 ?>
519 515 </p>
520   -
521   - <?= Html::a(
522   - 'На сторінку контактів',
523   - [ 'site/contact' ],
524   - [
525   - 'class' => 'btn btn-small btn-template-transparent-primary',
526   - ]
527   - ) ?>
528 516  
529 517 <hr class="hidden-md hidden-lg hidden-sm">
530 518  
... ...
frontend/views/site/index.php
... ... @@ -285,6 +285,7 @@ $this-&gt;registerJs($js, View::POS_END);
285 285  
286 286 - Робота 89 комп'ютерів за 365 днів
287 287 </p>
  288 + <a href="http://fb.com/KBEnergy.UA/" class="button1" target="_blank" style="padding: 18px;width: 300px;font-size: 18px;">Більше наших проектів</a>
288 289 </div>
289 290 <div class="col-md-4">
290 291 <div class="col-md-12 row project-right">
... ...