Blame view

frontend/config/main.php 12.7 KB
c420c609   alex   first commit
1
2
3
4
5
6
7
8
9
10
  <?php
      use artbox\core\components\SeoComponent;
      use frontend\components\UrlManager;
      
      $params = array_merge(
          require( __DIR__ . '/../../common/config/params.php' ),
          require( __DIR__ . '/../../common/config/params-local.php' ),
          require( __DIR__ . '/params.php' ),
          require( __DIR__ . '/params-local.php' )
      );
aa6e6170   alex   Доделал мелкие пр...
11
12
  
      $send="Отправить";
e095876b   alex   правки по формам
13
      $request1='Ваша заявка';
d23c67c0   alex   правки по формам
14
  
aa6e6170   alex   Доделал мелкие пр...
15
16
      if(strpos($_SERVER['REQUEST_URI'],"/ua")!==false) {
  	    $send = "Вiдправити";
e095876b   alex   правки по формам
17
  
aa6e6170   alex   Доделал мелкие пр...
18
19
20
      }
  
  
c420c609   alex   first commit
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
      
      return [
          'id'                  => 'app-frontend',
          'homeUrl'             => '/',
          'basePath'            => dirname(__DIR__),
          'bootstrap'           => [ 'log' ],
          'controllerNamespace' => 'frontend\controllers',
          'container' => [
              'singletons' => [
                  'artbox\core\services\Languages' =>'artbox\core\services\Languages',
              ]
          ],
          'modules'             => [
              'feedback' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
                  'attributes' => [
                      'name',
                      'email',
                      'message',
                  ],
                  'rules'           => [
                      [
                          [ 'email' ],
                          'email',
                      ],
                      [
                          [
                              'email',
                              'name',
                              'message',
                          ],
                          'required',
                      ],
                  ],
                  'labels'          => [
                      'email'   => 'Email',
                      'name'    => 'Name',
                      'message' => 'You question',
                  ],
                  'inputOptions'    => [
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
                      ],
                  ],
                  'scenario'        => 'feedback',
                  'sendEmail'       => false,
                  'formId'          => 'feedback-form',
                  'ajax'            => true,
                  'successCallback' => 'function (data) {
                   document.getElementById("feedback-form").reset();
                                $(".close").click();
                                if (data.status == "success"){
                                document.getElementById("feedback-form").reset();
                                $(".success_").animate({opacity: 1, top: \'40\'}, 200).addClass("done_");
                                setTimeout(function(){$(".success_").animate({opacity: 0, top: \'0\'}, 200,function(){
                                    $(this).removeClass("done_");
                                })}, 4000);
                                 var data = $("#feedback-form").data(\'yiiActiveForm\');
                                data.validated = false;
                                }
                      }',
              ],
  
              'contact' => [
                  'class'      => 'artbox\core\forms\Module',
1a059019   alex   Доделал мелкие пр...
88
                  'activeRecord' => "common\models\Feedback",
c420c609   alex   first commit
89
90
91
                  'templateForm' => '<div class="row">{form}</div>',
                  'attributes' => [
                      'name',
c420c609   alex   first commit
92
                      'phone',
be2b3be7   alex   правки по формам
93
  	                'email',
e095876b   alex   правки по формам
94
                      'message',
c420c609   alex   first commit
95
  
be2b3be7   alex   правки по формам
96
  
c420c609   alex   first commit
97
98
                  ],
                  'rules'      => [
be2b3be7   alex   правки по формам
99
100
101
102
                  	[
                  		['email'],
  		                'email'
  	                ],
c420c609   alex   first commit
103
                      [
e095876b   alex   правки по формам
104
105
                          [ 'message' ],
                          'text',
c420c609   alex   first commit
106
107
108
                      ],
                      [
                          [
be2b3be7   alex   правки по формам
109
  							'email',
c420c609   alex   first commit
110
111
112
113
                              'name',
                              'phone',
                          ],
                          'required',
e095876b   alex   правки по формам
114
115
  
                      ],
df90a7cb   alex   правки по формам
116
117
118
119
  	                [
  	                	['name','phone'],
  		                'string'
  	                ],
e095876b   alex   правки по формам
120
  
c420c609   alex   first commit
121
122
                  ],
                  'labels'     => [
be2b3be7   alex   правки по формам
123
124
125
126
                      'message'           => 'Message',
                      'name'              => 'Name',
                      'phone'             => 'Phone',
  	                'email'             => 'Email'
c420c609   alex   first commit
127
128
129
130
131
132
                  ],
  
                  'inputOptions'    => [
                      'name'   => [
                        'template' => '<div class="col-sm-12">{input}</div>'
                      ],
be2b3be7   alex   правки по формам
133
134
135
136
137
  	                'email'   => [
  
  		                'template'          =>'<div class="col-sm-12">{input}</div>',
  
  		            ],
e095876b   alex   правки по формам
138
139
140
141
142
  	                'message' => [
  		                'type'    => 'textarea',
  		                'options' => [],
  		                'template' => '<div class="input-wr">{input}</div>'
  	                ],
c420c609   alex   first commit
143
144
145
146
147
                      'phone'   => [
                          'template' => '<div class="col-sm-12">{input}</div>'
                      ],
  
                  ],
1a059019   alex   Доделал мелкие пр...
148
149
                  'buttonTemplate'  => '<div class="button-wr">{button}</div>',
  
be2b3be7   alex   правки по формам
150
                  'buttonContent'   => $send,
c420c609   alex   first commit
151
                  'sendEmail'       => true,
69768df7   alex   правки по формам
152
  	            'email'           => 'buh.artplast@gmail.com',
4ab98ba2   alex   правки по формам
153
  	            'subject'         => 'Новая заявка',
c420c609   alex   first commit
154
155
                  'ajax'            => true,
                  'formId'          => 'contact-form',
be2b3be7   alex   правки по формам
156
                  'scenario'        => 'default',
c420c609   alex   first commit
157
158
159
160
161
162
163
164
165
166
                  'successCallback' => 'function (data) {
                               document.getElementById("contact-form").reset();
                               
                                  var pos = ($(window).scrollTop()) + 30;
                                  
                                 $(".forms_").animate({opacity: 0, top: "0"}, 200,function(){
              $(this).css("display", "none");
          });
          setTimeout(function () {
              $("#overlay").fadeIn(400);
df90a7cb   alex   правки по формам
167
168
169
170
171
172
173
174
175
176
177
178
179
            
                     if(data.status=="success"){
               $("#success_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
              else{
               $("#success_form.error_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
          
          
          
          
          
          
c420c609   alex   first commit
180
181
182
          },400)}',
  
              ],
e095876b   alex   правки по формам
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
  	        'request_1' => [
  		        'class'      => 'artbox\core\forms\Module',
  		        'activeRecord' => "common\models\Feedback",
  		        'templateForm' => '<div class="row">{form}</div>',
  		        'attributes' => [
  			        'name',
  			        'phone',
  			        'message',
  
  		        ],
  		        'rules'      => [
  			        [
  				        [ 'message' ],
  				        'text',
  			        ],
  			        [
  				        [
e095876b   alex   правки по формам
200
201
202
203
204
  					        'name',
  					        'phone',
  				        ],
  				        'required',
  
df90a7cb   alex   правки по формам
205
206
207
208
  			        ],
  			        [['name','phone'],
  				        'string'
  				        ],
e095876b   alex   правки по формам
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  		        ],
  		        'labels'     => [
  			        'message'   => 'Message',
  			        'name'    => 'Name',
  			        'phone'   => 'Phone'
  		        ],
  
  		        'inputOptions'    => [
  			        'name'   => [
  				        'template' => '<div class="col-sm-12">{input}</div>'
  			        ],
  			        'message' => [
  				        'type'    => 'textarea',
  				        'options' => [],
  				        'template' => '<div class="input-wr">{input}</div>'
  			        ],
  			        'phone'   => [
  				        'template' => '<div class="col-sm-12">{input}</div>'
  			        ],
  
  		        ],
  		        'buttonTemplate'  => '<div class="button-wr">{button}</div>',
df90a7cb   alex   правки по формам
231
  		        'buttonContent'   => $send,
be2b3be7   alex   правки по формам
232
  		        'sendEmail'       => true,
69768df7   alex   правки по формам
233
  		        'email'           => 'buh.artplast@gmail.com',
4ab98ba2   alex   правки по формам
234
  		        'subject'         => 'Новая заявка',
be2b3be7   alex   правки по формам
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
  		        'ajax'            => true,
  		        'formId'          => 'contact-form',
  		        'scenario'        => 'callback',
  		        'successCallback' => 'function (data) {
                               document.getElementById("contact-form").reset();
                                 
                                
                                  var pos = ($(window).scrollTop()) + 30;
                                  
                                 $(".forms_").animate({opacity: 0, top: "0"}, 200,function(){
              $(this).css("display", "none");
          });
          setTimeout(function () {
              $("#overlay").fadeIn(400);
              
              if(data.status=="success"){
               $("#success_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
              else{
               $("#success_form.error_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
              
             
         
         
          },400)}',
  
  	        ],
  	        'request_2' => [
  		        'class'      => 'artbox\core\forms\Module',
  		        'activeRecord' => "common\models\Feedback",
  		        'templateForm' => '<div class="row">{form}</div>',
  		        'attributes' => [
  			        'name',
  			        'phone',
  			        'message',
  
  		        ],
  		        'rules'      => [
  			        [
  				        [ 'message' ],
  				        'text',
  			        ],
  			        [
  				        [
  
  					        'name',
  					        'phone',
  				        ],
  				        'required',
  
df90a7cb   alex   правки по формам
286
287
288
289
290
  			        ],
  			        [
  			        	['name','phone'],
  				        'string'
  			        ],
be2b3be7   alex   правки по формам
291
292
293
294
295
296
297
298
299
300
  		        ],
  		        'labels'     => [
  			        'message'   => 'Message',
  			        'name'    => 'Name',
  			        'phone'   => 'Phone'
  		        ],
  
  		        'inputOptions'    => [
  			        'name'   => [
  				        'template' => '<div class="col-sm-12">{input}</div>',
df90a7cb   alex   правки по формам
301
302
303
  				        'labelOptions' => [ 'class' => 'callback_text_input_label'],
  
  
be2b3be7   alex   правки по формам
304
305
306
307
308
309
310
311
312
313
314
315
316
  			        ],
  			        'message' => [
  				        'type'    => 'textarea',
  				        'options' => [],
  				        'template' => '<div class="input-wr">{input}</div>'
  			        ],
  			        'phone'   => [
  				        'template' => '<div class="col-sm-12">{input}</div>',
  				        'labelOptions' => [ 'class' => 'callback_text_input_label' ]
  			        ],
  
  		        ],
  		        'buttonTemplate'  => '<div class="button-wr">{button}</div>',
e095876b   alex   правки по формам
317
  
d23c67c0   alex   правки по формам
318
  		        'buttonContent'   => $send,
e095876b   alex   правки по формам
319
  		        'sendEmail'       => true,
69768df7   alex   правки по формам
320
  		        'email'           => 'buh.artplast@gmail.com',
4ab98ba2   alex   правки по формам
321
  		        'subject'         => 'Новая заявка',
e095876b   alex   правки по формам
322
323
324
325
326
327
  		        'ajax'            => true,
  		        'formId'          => 'contact-form',
  		        'scenario'        => 'callback',
  		        'successCallback' => 'function (data) {
                               document.getElementById("contact-form").reset();
                                 
69768df7   alex   правки по формам
328
                      
e095876b   alex   правки по формам
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
                                  var pos = ($(window).scrollTop()) + 30;
                                  
                                 $(".forms_").animate({opacity: 0, top: "0"}, 200,function(){
              $(this).css("display", "none");
          });
          setTimeout(function () {
              $("#overlay").fadeIn(400);
              
              if(data.status=="success"){
               $("#success_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
              else{
               $("#success_form.error_form").css("display", "block").animate({opacity: 1, top: pos}, 700);
              }
              
             
         
         
          },400)}',
c420c609   alex   first commit
348
  
e095876b   alex   правки по формам
349
  	        ],
c420c609   alex   first commit
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
  
  
  
          ],
          'components'          => [
              'request'      => [
                  'csrfParam' => '_csrf-frontend',
                  'baseUrl'   => '',
              ],
              'user'         => [
                  'identityClass'   => 'common\models\User',
                  'enableAutoLogin' => true,
                  'identityCookie'  => [
                      'name'     => '_identity-frontend',
                      'httpOnly' => true,
                  ],
              ],
              'session'      => [
                  // this is the name of the session cookie used for login on the frontend
                  'name' => 'advanced-frontend',
              ],
              'log'          => [
                  'traceLevel' => YII_DEBUG ? 3 : 0,
                  'targets'    => [
                      [
                          'class'  => 'yii\log\FileTarget',
                          'levels' => [
                              'error',
                              'warning',
                          ],
                      ],
                  ],
              ],
              'seo'                => [
                  'class' => SeoComponent::className(),
              ],
              'errorHandler' => [
                  'errorAction' => 'site/error',
              ],
              'urlManager'   => [
                  'class'           => UrlManager::className(),
                  'baseUrl'         => '/',
                  'enablePrettyUrl' => true,
                  'showScriptName'  => false,
                  'rules'           => [],
                  'hideDefaultLanguagePrefix' => true,
              ],
          ],
          
          'params'              => $params,
      ];