Commit eb56e5f23b9be580da0e27ce44031238da3adb48
0 parents
first commit
Showing
400 changed files
with
17826 additions
and
0 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 400 files are displayed.
1 | +++ a/.gitignore | |
1 | +# yii console command | |
2 | +/yii | |
3 | + | |
4 | +# phpstorm project files | |
5 | +.idea | |
6 | + | |
7 | +# netbeans project files | |
8 | +nbproject | |
9 | + | |
10 | +# zend studio for eclipse project files | |
11 | +.buildpath | |
12 | +.project | |
13 | +.settings | |
14 | + | |
15 | +# windows thumbnail cache | |
16 | +Thumbs.db | |
17 | + | |
18 | +# composer vendor dir | |
19 | +/vendor | |
20 | + | |
21 | +# composer itself is not needed | |
22 | +composer.phar | |
23 | + | |
24 | +# Mac DS_Store Files | |
25 | +.DS_Store | |
26 | + | |
27 | +# phpunit itself is not needed | |
28 | +phpunit.phar | |
29 | +# local phpunit config | |
30 | +/phpunit.xml | |
31 | + | |
32 | +# vagrant runtime | |
33 | +/.vagrant | ... | ... |
1 | +++ a/.htaccess | |
1 | +AddDefaultCharset utf-8 | |
2 | +<IfModule mod_rewrite.c> | |
3 | + | |
4 | + | |
5 | + Options +FollowSymlinks | |
6 | + | |
7 | + RewriteEngine On | |
8 | + | |
9 | +</IfModule> | |
10 | + | |
11 | +<IfModule mod_rewrite.c> | |
12 | + | |
13 | + RewriteBase / | |
14 | + # deal with admin first | |
15 | + | |
16 | + | |
17 | + | |
18 | + RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
19 | + | |
20 | + RewriteCond %{REQUEST_URI} ^/(admin) | |
21 | + | |
22 | + | |
23 | + | |
24 | + RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] | |
25 | + | |
26 | + RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] | |
27 | + | |
28 | + RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L] | |
29 | + | |
30 | + RewriteRule ^admin/images/(.*)$ backend/web/images/$1 [L] | |
31 | + | |
32 | + RewriteRule ^admin/fonts/(.*)$ backend/web/fonts/$1 [L] | |
33 | + | |
34 | + | |
35 | + | |
36 | + | |
37 | + | |
38 | + RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js|images|fonts)/ | |
39 | + | |
40 | + RewriteCond %{REQUEST_URI} ^/(admin) | |
41 | + | |
42 | + RewriteRule ^.*$ backend/web/index.php [L] | |
43 | + | |
44 | + | |
45 | + RewriteCond %{REQUEST_URI} ^/(assets|css) | |
46 | + | |
47 | + RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L] | |
48 | + | |
49 | + RewriteRule ^css/(.*)$ frontend/web/css/$1 [L] | |
50 | + | |
51 | + RewriteRule ^js/(.*)$ frontend/web/js/$1 [L] | |
52 | + | |
53 | + RewriteRule ^images/(.*)$ frontend/web/images/$1 [L] | |
54 | + | |
55 | + RewriteRule ^libraries/(.*)$ frontend/web/libraries/$1 [L] | |
56 | + | |
57 | + RewriteRule ^img/(.*)$ frontend/web/img/$1 [L] | |
58 | + | |
59 | + RewriteRule ^files/(.*)$ frontend/web/files/$1 [L] | |
60 | + | |
61 | + RewriteRule ^fonts/(.*)$ frontend/web/fonts/$1 [L] | |
62 | + | |
63 | + RewriteRule robots.txt$ frontend/web/robots.txt [L] | |
64 | + | |
65 | + | |
66 | + RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|txt|js|images|fonts|img|files)/ | |
67 | + | |
68 | + RewriteCond %{REQUEST_URI} !index.php | |
69 | + | |
70 | + RewriteCond %{REQUEST_FILENAME} !-f [OR] | |
71 | + | |
72 | + RewriteCond %{REQUEST_FILENAME} !-d | |
73 | + | |
74 | + RewriteCond %{HTTP_HOST} ^www\.(.*) | |
75 | + RewriteRule ^(.*)$ frontend/web/index.php | |
76 | + | |
77 | + | |
78 | + RewriteCond %{HTTP_HOST} ^([^www].*)$ | |
79 | + RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
80 | + | |
81 | + RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] | |
82 | + RewriteRule /$ /%1 [R,L] | |
83 | + | |
84 | + | |
85 | + | |
86 | + RewriteCond %{HTTP_HOST} ^([^www].*)$ | |
87 | + RewriteRule ^(.*)$ http://www.%1/$1 [R=301] | |
88 | + | |
89 | +</IfModule> | |
90 | + | |
91 | +#для возможности загрузки файлов парсера | |
92 | +<IfModule mod_php5.c> | |
93 | + php_value upload_max_filesize 20M | |
94 | + php_value post_max_size 30M | |
95 | +</IfModule> | |
96 | + | |
97 | + | |
98 | +# кеширование в браузере на стороне пользователя | |
99 | + | |
100 | +<IfModule mod_expires.c> | |
101 | + ExpiresActive On | |
102 | + ExpiresDefault "access 7 days" | |
103 | + ExpiresByType application/javascript "access plus 1 year" | |
104 | + ExpiresByType text/javascript "access plus 1 year" | |
105 | + ExpiresByType text/css "access plus 1 year" | |
106 | + ExpiresByType text/html "access plus 7 day" | |
107 | + ExpiresByType text/x-javascript "access 1 year" | |
108 | + ExpiresByType image/gif "access plus 1 year" | |
109 | + ExpiresByType image/jpeg "access plus 1 year" | |
110 | + ExpiresByType image/png "access plus 1 year" | |
111 | + ExpiresByType image/jpg "access plus 1 year" | |
112 | + ExpiresByType image/x-icon "access 1 year" | |
113 | + ExpiresByType application/x-shockwave-flash "access 1 year" | |
114 | + </IfModule> | |
115 | +<IfModule mod_deflate.c> | |
116 | +AddOutputFilterByType DEFLATE text/plain | |
117 | +AddOutputFilterByType DEFLATE text/html | |
118 | +AddOutputFilterByType DEFLATE text/xml | |
119 | +AddOutputFilterByType DEFLATE text/css | |
120 | +AddOutputFilterByType DEFLATE application/xml | |
121 | +AddOutputFilterByType DEFLATE application/xhtml+xml | |
122 | +AddOutputFilterByType DEFLATE application/rss+xml | |
123 | +AddOutputFilterByType DEFLATE application/javascript | |
124 | +AddOutputFilterByType DEFLATE application/x-javascript | |
125 | +BrowserMatch ^Mozilla/4 gzip-only-text/html | |
126 | +BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
127 | +BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
128 | +Header append Vary User-Agent | |
129 | +RewriteEngine On | |
130 | +AddEncoding gzip .gz | |
131 | +RewriteCond %{HTTP:Accept-encoding} gzip | |
132 | +RewriteCond %{REQUEST_FILENAME}.gz -f | |
133 | +RewriteRule ^(.*)$ $1.gz [QSA,L] | |
134 | +</IfModule> | |
135 | +# Cache-Control | |
136 | +<ifModule mod_headers.c> | |
137 | +# 30 дней | |
138 | + <filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> | |
139 | + Header set Cache-Control "max-age=2592000, public" | |
140 | + </filesMatch> | |
141 | + # 30 дней | |
142 | + <filesMatch "\.(css|js)$"> | |
143 | + Header set Cache-Control "max-age=2592000, public" | |
144 | + </filesMatch> | |
145 | + # 2 дня | |
146 | + <filesMatch "\.(xml|txt)$"> | |
147 | + Header set Cache-Control "max-age=172800, public, must-revalidate" | |
148 | + </filesMatch> | |
149 | + # 1 день | |
150 | + <filesMatch "\.(html|htm|php)$"> | |
151 | + Header set Cache-Control "max-age=172800, private, must-revalidate" | |
152 | + </filesMatch> | |
153 | +</ifModule> | |
154 | + | |
155 | +#Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE | |
156 | +<IfModule mod_setenvif.c> | |
157 | +BrowserMatch "MSIE" force-no-vary | |
158 | +BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary | |
159 | +</IfModule> | |
160 | + | ... | ... |
1 | +++ a/LICENSE.md | |
1 | +The Yii framework is free software. It is released under the terms of | |
2 | +the following BSD License. | |
3 | + | |
4 | +Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) | |
5 | +All rights reserved. | |
6 | + | |
7 | +Redistribution and use in source and binary forms, with or without | |
8 | +modification, are permitted provided that the following conditions | |
9 | +are met: | |
10 | + | |
11 | + * Redistributions of source code must retain the above copyright | |
12 | + notice, this list of conditions and the following disclaimer. | |
13 | + * Redistributions in binary form must reproduce the above copyright | |
14 | + notice, this list of conditions and the following disclaimer in | |
15 | + the documentation and/or other materials provided with the | |
16 | + distribution. | |
17 | + * Neither the name of Yii Software LLC nor the names of its | |
18 | + contributors may be used to endorse or promote products derived | |
19 | + from this software without specific prior written permission. | |
20 | + | |
21 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
22 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
23 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
24 | +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
25 | +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
26 | +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
27 | +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
28 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
29 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 | +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
31 | +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
32 | +POSSIBILITY OF SUCH DAMAGE. | ... | ... |
1 | +++ a/README.md | |
1 | +Yii 2 Advanced Project Template | |
2 | +=============================== | |
3 | + | |
4 | +Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for | |
5 | +developing complex Web applications with multiple tiers. | |
6 | + | |
7 | +The template includes three tiers: front end, back end, and console, each of which | |
8 | +is a separate Yii application. | |
9 | + | |
10 | +The template is designed to work in a team development environment. It supports | |
11 | +deploying the application in different environments. | |
12 | + | |
13 | +Documentation is at [docs/guide/README.md](docs/guide/README.md). | |
14 | + | |
15 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
16 | +[](https://packagist.org/packages/yiisoft/yii2-app-advanced) | |
17 | +[](https://travis-ci.org/yiisoft/yii2-app-advanced) | |
18 | + | |
19 | +DIRECTORY STRUCTURE | |
20 | +------------------- | |
21 | + | |
22 | +``` | |
23 | +common | |
24 | + config/ contains shared configurations | |
25 | + mail/ contains view files for e-mails | |
26 | + models/ contains model classes used in both backend and frontend | |
27 | +console | |
28 | + config/ contains console configurations | |
29 | + controllers/ contains console controllers (commands) | |
30 | + migrations/ contains database migrations | |
31 | + models/ contains console-specific model classes | |
32 | + runtime/ contains files generated during runtime | |
33 | +backend | |
34 | + assets/ contains application assets such as JavaScript and CSS | |
35 | + config/ contains backend configurations | |
36 | + controllers/ contains Web controller classes | |
37 | + models/ contains backend-specific model classes | |
38 | + runtime/ contains files generated during runtime | |
39 | + views/ contains view files for the Web application | |
40 | + web/ contains the entry script and Web resources | |
41 | +frontend | |
42 | + assets/ contains application assets such as JavaScript and CSS | |
43 | + config/ contains frontend configurations | |
44 | + controllers/ contains Web controller classes | |
45 | + models/ contains frontend-specific model classes | |
46 | + runtime/ contains files generated during runtime | |
47 | + views/ contains view files for the Web application | |
48 | + web/ contains the entry script and Web resources | |
49 | + widgets/ contains frontend widgets | |
50 | +vendor/ contains dependent 3rd-party packages | |
51 | +environments/ contains environment-based overrides | |
52 | +tests contains various tests for the advanced application | |
53 | + codeception/ contains tests developed with Codeception PHP Testing Framework | |
54 | +``` | ... | ... |
1 | +++ a/Vagrantfile | |
1 | +require 'yaml' | |
2 | +require 'fileutils' | |
3 | + | |
4 | +domains = { | |
5 | + frontend: 'y2aa-frontend.dev', | |
6 | + backend: 'y2aa-backend.dev' | |
7 | +} | |
8 | + | |
9 | +config = { | |
10 | + local: './vagrant/config/vagrant-local.yml', | |
11 | + example: './vagrant/config/vagrant-local.example.yml' | |
12 | +} | |
13 | + | |
14 | +# copy config from example if local config not exists | |
15 | +FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local]) | |
16 | +# read config | |
17 | +options = YAML.load_file config[:local] | |
18 | + | |
19 | +# check github token | |
20 | +if options['github_token'].nil? || options['github_token'].to_s.length != 40 | |
21 | + puts "You must place REAL GitHub token into configuration:\n/yii2-app-advancded/vagrant/config/vagrant-local.yml" | |
22 | + exit | |
23 | +end | |
24 | + | |
25 | +# vagrant configurate | |
26 | +Vagrant.configure(2) do |config| | |
27 | + # select the box | |
28 | + config.vm.box = 'ubuntu/trusty64' | |
29 | + | |
30 | + # should we ask about box updates? | |
31 | + config.vm.box_check_update = options['box_check_update'] | |
32 | + | |
33 | + config.vm.provider 'virtualbox' do |vb| | |
34 | + # machine cpus count | |
35 | + vb.cpus = options['cpus'] | |
36 | + # machine memory size | |
37 | + vb.memory = options['memory'] | |
38 | + # machine name (for VirtualBox UI) | |
39 | + vb.name = options['machine_name'] | |
40 | + end | |
41 | + | |
42 | + # machine name (for vagrant console) | |
43 | + config.vm.define options['machine_name'] | |
44 | + | |
45 | + # machine name (for guest machine console) | |
46 | + config.vm.hostname = options['machine_name'] | |
47 | + | |
48 | + # network settings | |
49 | + config.vm.network 'private_network', ip: options['ip'] | |
50 | + | |
51 | + # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine) | |
52 | + config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant' | |
53 | + | |
54 | + # disable folder '/vagrant' (guest machine) | |
55 | + config.vm.synced_folder '.', '/vagrant', disabled: true | |
56 | + | |
57 | + # hosts settings (host machine) | |
58 | + config.vm.provision :hostmanager | |
59 | + config.hostmanager.enabled = true | |
60 | + config.hostmanager.manage_host = true | |
61 | + config.hostmanager.ignore_private_ip = false | |
62 | + config.hostmanager.include_offline = true | |
63 | + config.hostmanager.aliases = domains.values | |
64 | + | |
65 | + # provisioners | |
66 | + config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] | |
67 | + config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false | |
68 | + config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' | |
69 | + | |
70 | + # post-install message (vagrant console) | |
71 | + config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}" | |
72 | +end | ... | ... |
1 | +++ a/backend/assets/AppAsset.php | |
1 | +<?php | |
2 | + | |
3 | +namespace backend\assets; | |
4 | + | |
5 | +use yii\web\AssetBundle; | |
6 | + | |
7 | +/** | |
8 | + * Main backend application asset bundle. | |
9 | + */ | |
10 | +class AppAsset extends AssetBundle | |
11 | +{ | |
12 | + public $basePath = '@webroot'; | |
13 | + public $baseUrl = '@web'; | |
14 | + public $css = [ | |
15 | + 'css/site.css', | |
16 | + ]; | |
17 | + public $js = [ | |
18 | + ]; | |
19 | + public $depends = [ | |
20 | + 'yii\web\YiiAsset', | |
21 | + 'yii\bootstrap\BootstrapAsset', | |
22 | + ]; | |
23 | +} | ... | ... |
1 | +++ a/backend/config/main.php | |
1 | +<?php | |
2 | + $params = array_merge( | |
3 | + require(__DIR__ . '/../../common/config/params.php'), | |
4 | + require(__DIR__ . '/../../common/config/params-local.php'), | |
5 | + require(__DIR__ . '/params.php'), | |
6 | + require(__DIR__ . '/params-local.php') | |
7 | + ); | |
8 | + | |
9 | + return [ | |
10 | + 'id' => 'app-backend', | |
11 | + 'basePath' => dirname(__DIR__), | |
12 | + 'controllerNamespace' => 'backend\controllers', | |
13 | + 'bootstrap' => ['log'], | |
14 | + 'components' => [ | |
15 | + 'user' => [ | |
16 | + 'identityClass' => 'common\models\User', | |
17 | + 'enableAutoLogin' => true, | |
18 | + ], | |
19 | + 'log' => [ | |
20 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | |
21 | + 'targets' => [ | |
22 | + [ | |
23 | + 'class' => 'yii\log\FileTarget', | |
24 | + 'levels' => ['error', 'warning'], | |
25 | + ], | |
26 | + ], | |
27 | + ], | |
28 | + 'errorHandler' => [ | |
29 | + 'errorAction' => 'site/error', | |
30 | + ], | |
31 | + 'request'=>[ | |
32 | + 'cookieValidationKey' => 'j4iuot9u5894e7tu8reyh78g9y54sy7i', | |
33 | + 'csrfParam' => '_backendCSRF', | |
34 | + | |
35 | + 'class' => 'common\components\Request', | |
36 | + | |
37 | + 'web'=> '/backend/web', | |
38 | + | |
39 | + 'adminUrl' => '/admin' | |
40 | + | |
41 | + ], | |
42 | + 'urlManager' => [ | |
43 | + 'baseUrl' => '/admin', | |
44 | + 'enablePrettyUrl' => true, | |
45 | + 'showScriptName' => false, | |
46 | + ] | |
47 | + | |
48 | + ], | |
49 | + 'params' => $params, | |
50 | + ]; | ... | ... |
1 | +++ a/backend/controllers/CarController.php | |
1 | +<?php | |
2 | + | |
3 | + namespace backend\controllers; | |
4 | + | |
5 | + use Yii; | |
6 | + use common\models\Car; | |
7 | + use common\models\CarSearch; | |
8 | + use yii\filters\AccessControl; | |
9 | + use yii\web\Controller; | |
10 | + use yii\web\NotFoundHttpException; | |
11 | + use yii\filters\VerbFilter; | |
12 | + | |
13 | + /** | |
14 | + * CarController implements the CRUD actions for Car model. | |
15 | + */ | |
16 | + class CarController extends Controller | |
17 | + { | |
18 | + | |
19 | + /** | |
20 | + * @inheritdoc | |
21 | + */ | |
22 | + public function behaviors() | |
23 | + { | |
24 | + return [ | |
25 | + 'access' => [ | |
26 | + 'class' => AccessControl::className(), | |
27 | + 'rules' => [ | |
28 | + [ | |
29 | + 'actions' => ['error'], | |
30 | + 'allow' => true, | |
31 | + ], | |
32 | + [ | |
33 | + 'allow' => true, | |
34 | + 'roles' => ['@'], | |
35 | + ], | |
36 | + ], | |
37 | + ], | |
38 | + 'verbs' => [ | |
39 | + 'class' => VerbFilter::className(), | |
40 | + 'actions' => [ | |
41 | + 'delete' => [ 'POST' ], | |
42 | + ], | |
43 | + ], | |
44 | + ]; | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * Lists all Car models. | |
49 | + * @return mixed | |
50 | + */ | |
51 | + public function actionIndex() | |
52 | + { | |
53 | + $searchModel = new CarSearch(); | |
54 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
55 | + | |
56 | + return $this->render('index', [ | |
57 | + 'searchModel' => $searchModel, | |
58 | + 'dataProvider' => $dataProvider, | |
59 | + ]); | |
60 | + } | |
61 | + | |
62 | + /** | |
63 | + * Displays a single Car model. | |
64 | + * | |
65 | + * @param integer $id | |
66 | + * | |
67 | + * @return mixed | |
68 | + */ | |
69 | + public function actionView($id) | |
70 | + { | |
71 | + return $this->render('view', [ | |
72 | + 'model' => $this->findModel($id), | |
73 | + ]); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * Creates a new Car model. | |
78 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
79 | + * @return mixed | |
80 | + */ | |
81 | + public function actionCreate() | |
82 | + { | |
83 | + $model = new Car(); | |
84 | + | |
85 | + if($model->load(Yii::$app->request->post()) && $model->validate()) { | |
86 | + $model->upload(); | |
87 | + $model->save(false); | |
88 | + return $this->redirect([ | |
89 | + 'view', | |
90 | + 'id' => $model->car_id, | |
91 | + ]); | |
92 | + } else { | |
93 | + return $this->render('create', [ | |
94 | + 'model' => $model, | |
95 | + ]); | |
96 | + } | |
97 | + } | |
98 | + | |
99 | + /** | |
100 | + * Updates an existing Car model. | |
101 | + * If update is successful, the browser will be redirected to the 'view' page. | |
102 | + * | |
103 | + * @param integer $id | |
104 | + * | |
105 | + * @return mixed | |
106 | + */ | |
107 | + public function actionUpdate($id) | |
108 | + { | |
109 | + $model = $this->findModel($id); | |
110 | + | |
111 | + if($model->load(Yii::$app->request->post())) { | |
112 | + if($model->validate()) { | |
113 | + $model->upload(); | |
114 | + $model->save(false); | |
115 | + return $this->redirect([ | |
116 | + 'view', | |
117 | + 'id' => $model->car_id, | |
118 | + ]); | |
119 | + } | |
120 | + } | |
121 | + return $this->render('update', [ | |
122 | + 'model' => $model, | |
123 | + ]); | |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * Deletes an existing Car model. | |
128 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
129 | + * | |
130 | + * @param integer $id | |
131 | + * | |
132 | + * @return mixed | |
133 | + */ | |
134 | + public function actionDelete($id) | |
135 | + { | |
136 | + $this->findModel($id) | |
137 | + ->delete(); | |
138 | + | |
139 | + return $this->redirect([ 'index' ]); | |
140 | + } | |
141 | + | |
142 | + /** | |
143 | + * Finds the Car model based on its primary key value. | |
144 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
145 | + * | |
146 | + * @param integer $id | |
147 | + * | |
148 | + * @return Car the loaded model | |
149 | + * @throws NotFoundHttpException if the model cannot be found | |
150 | + */ | |
151 | + protected function findModel($id) | |
152 | + { | |
153 | + if(( $model = Car::findOne($id) ) !== NULL) { | |
154 | + return $model; | |
155 | + } else { | |
156 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
157 | + } | |
158 | + } | |
159 | + } | ... | ... |
1 | +++ a/backend/controllers/SiteController.php | |
1 | +<?php | |
2 | +namespace backend\controllers; | |
3 | + | |
4 | +use Yii; | |
5 | +use yii\web\Controller; | |
6 | +use yii\filters\VerbFilter; | |
7 | +use yii\filters\AccessControl; | |
8 | +use common\models\LoginForm; | |
9 | + | |
10 | +/** | |
11 | + * Site controller | |
12 | + */ | |
13 | +class SiteController extends Controller | |
14 | +{ | |
15 | + /** | |
16 | + * @inheritdoc | |
17 | + */ | |
18 | + public function behaviors() | |
19 | + { | |
20 | + return [ | |
21 | + 'access' => [ | |
22 | + 'class' => AccessControl::className(), | |
23 | + 'rules' => [ | |
24 | + [ | |
25 | + 'actions' => ['login', 'error'], | |
26 | + 'allow' => true, | |
27 | + ], | |
28 | + [ | |
29 | + 'actions' => ['logout', 'index'], | |
30 | + 'allow' => true, | |
31 | + 'roles' => ['@'], | |
32 | + ], | |
33 | + ], | |
34 | + ], | |
35 | + 'verbs' => [ | |
36 | + 'class' => VerbFilter::className(), | |
37 | + 'actions' => [ | |
38 | + 'logout' => ['post'], | |
39 | + ], | |
40 | + ], | |
41 | + ]; | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * @inheritdoc | |
46 | + */ | |
47 | + public function actions() | |
48 | + { | |
49 | + return [ | |
50 | + 'error' => [ | |
51 | + 'class' => 'yii\web\ErrorAction', | |
52 | + ], | |
53 | + ]; | |
54 | + } | |
55 | + | |
56 | + /** | |
57 | + * Displays homepage. | |
58 | + * | |
59 | + * @return string | |
60 | + */ | |
61 | + public function actionIndex() | |
62 | + { | |
63 | + return $this->render('index'); | |
64 | + } | |
65 | + | |
66 | + /** | |
67 | + * Login action. | |
68 | + * | |
69 | + * @return string | |
70 | + */ | |
71 | + public function actionLogin() | |
72 | + { | |
73 | + if (!Yii::$app->user->isGuest) { | |
74 | + return $this->goHome(); | |
75 | + } | |
76 | + | |
77 | + $model = new LoginForm(); | |
78 | + if ($model->load(Yii::$app->request->post()) && $model->login()) { | |
79 | + return $this->goBack(); | |
80 | + } else { | |
81 | + return $this->render('login', [ | |
82 | + 'model' => $model, | |
83 | + ]); | |
84 | + } | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * Logout action. | |
89 | + * | |
90 | + * @return string | |
91 | + */ | |
92 | + public function actionLogout() | |
93 | + { | |
94 | + Yii::$app->user->logout(); | |
95 | + | |
96 | + return $this->goHome(); | |
97 | + } | |
98 | +} | ... | ... |
1 | +++ a/backend/views/car/_form.php | |
1 | +<?php | |
2 | + | |
3 | + use kartik\file\FileInput; | |
4 | + use yii\helpers\Html; | |
5 | + use yii\jui\DatePicker; | |
6 | + use yii\widgets\ActiveForm; | |
7 | + | |
8 | + /* @var $this yii\web\View */ | |
9 | + /* @var $model common\models\Car */ | |
10 | + /* @var $form yii\widgets\ActiveForm */ | |
11 | + | |
12 | + $models = [ | |
13 | + 'Nissan Leaf S' => 'Nissan Leaf S', | |
14 | + 'Nissan Leaf SV' => 'Nissan Leaf SV', | |
15 | + 'Nissan Leaf SL' => 'Nissan Leaf SL', | |
16 | + ]; | |
17 | + $years = [ ]; | |
18 | + for($year = 2013; $year <= date('Y'); $year++) { | |
19 | + $years[ $year ] = $year; | |
20 | + } | |
21 | +?> | |
22 | + | |
23 | +<div class="car-form"> | |
24 | + | |
25 | + <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> | |
26 | + | |
27 | + <?= $form->field($model, 'model') | |
28 | + ->dropDownList($models) ?> | |
29 | + | |
30 | + <?= $form->field($model, 'year') | |
31 | + ->dropDownList($years) ?> | |
32 | + | |
33 | + <?= $form->field($model, 'image') | |
34 | + ->widget(FileInput::className(), [ | |
35 | + 'options' => [ 'accept' => 'image/*' ], | |
36 | + 'pluginOptions' => [ | |
37 | + 'allowedFileExtensions' => ['jpg', 'png'], | |
38 | + 'initialPreview' => ($model->image?(Html::img($model->image, ['width' => '240px'])):false), | |
39 | + 'initialPreviewConfig' => [ | |
40 | + 'width' => '120px', | |
41 | + ], | |
42 | + 'overwriteInitial' => true, | |
43 | + 'showUpload' => false, | |
44 | + 'previewFileType' => 'image', | |
45 | + ], | |
46 | + ]) ?> | |
47 | + | |
48 | + <?= $form->field($model, 'color') | |
49 | + ->textInput([ 'maxlength' => true ]) ?> | |
50 | + | |
51 | + <?= $form->field($model, 'mileage') | |
52 | + ->textInput() | |
53 | + ->label('Пробег (тыс. км.)') ?> | |
54 | + | |
55 | + <?= $form->field($model, 'build') | |
56 | + ->widget(DatePicker::className(), [ | |
57 | + 'dateFormat' => 'MM/yyyy', | |
58 | + 'clientOptions' => [ | |
59 | + 'changeMonth' => true, | |
60 | + 'changeYear' => true, | |
61 | + 'yearRange' => '2013:' . date('Y'), | |
62 | + ], | |
63 | + 'options' => [ | |
64 | + 'class' => 'form-control', | |
65 | + ], | |
66 | + ]) | |
67 | + ->label('Дата выпуска (выбор дня не влияет)') ?> | |
68 | + | |
69 | + <?= $form->field($model, 'option') | |
70 | + ->textarea([ 'rows' => 6 ]) ?> | |
71 | + | |
72 | + <?= $form->field($model, 'price') | |
73 | + ->textInput() ?> | |
74 | + | |
75 | + <div class="form-group"> | |
76 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?> | |
77 | + </div> | |
78 | + | |
79 | + <?php ActiveForm::end(); ?> | |
80 | + | |
81 | +</div> | ... | ... |
1 | +++ a/backend/views/car/_search.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\CarSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="car-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'car_id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'model') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'year') ?> | |
23 | + | |
24 | + <?= $form->field($model, 'image') ?> | |
25 | + | |
26 | + <?= $form->field($model, 'color') ?> | |
27 | + | |
28 | + <?php // echo $form->field($model, 'mileage') ?> | |
29 | + | |
30 | + <?php // echo $form->field($model, 'build') ?> | |
31 | + | |
32 | + <?php // echo $form->field($model, 'option') ?> | |
33 | + | |
34 | + <?php // echo $form->field($model, 'price') ?> | |
35 | + | |
36 | + <div class="form-group"> | |
37 | + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?> | |
38 | + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?> | |
39 | + </div> | |
40 | + | |
41 | + <?php ActiveForm::end(); ?> | |
42 | + | |
43 | +</div> | ... | ... |
1 | +++ a/backend/views/car/create.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\Car */ | |
8 | + | |
9 | +$this->title = 'Добавить автомобиль'; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Автомобили', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="car-create"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <?= $this->render('_form', [ | |
18 | + 'model' => $model, | |
19 | + ]) ?> | |
20 | + | |
21 | +</div> | ... | ... |
1 | +++ a/backend/views/car/index.php | |
1 | +<?php | |
2 | + | |
3 | + use common\models\Car; | |
4 | + use yii\helpers\Html; | |
5 | + use yii\grid\GridView; | |
6 | + | |
7 | + /* @var $this yii\web\View */ | |
8 | + /* @var $searchModel common\models\CarSearch */ | |
9 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | |
10 | + | |
11 | + $this->title = 'Автомобили'; | |
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | |
13 | +?> | |
14 | +<div class="car-index"> | |
15 | + | |
16 | + <h1><?= Html::encode($this->title) ?></h1> | |
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
18 | + | |
19 | + <p> | |
20 | + <?= Html::a('Добавить автомобиль', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | |
21 | + </p> | |
22 | + <?= GridView::widget( | |
23 | + [ | |
24 | + 'dataProvider' => $dataProvider, | |
25 | + 'filterModel' => $searchModel, | |
26 | + 'columns' => [ | |
27 | + [ 'class' => 'yii\grid\ActionColumn' ], | |
28 | + [ | |
29 | + 'attribute' => 'car_id', | |
30 | + 'headerOptions' => [ | |
31 | + 'style' => 'word-break: break-all', | |
32 | + ], | |
33 | + ], | |
34 | + 'model', | |
35 | + 'year', | |
36 | + [ | |
37 | + 'attribute' => 'image', | |
38 | + 'format' => [ | |
39 | + 'image', | |
40 | + [ | |
41 | + 'style' => [ 'max-width' => '300px' ], | |
42 | + ], | |
43 | + ], | |
44 | + ], | |
45 | + 'color', | |
46 | + [ | |
47 | + 'attribute' => 'mileage', | |
48 | + 'value' => function ($model) { | |
49 | + /** | |
50 | + * @var Car $model | |
51 | + */ | |
52 | + return $model->mileage . ' тыс. км.'; | |
53 | + }, | |
54 | + ], | |
55 | + 'build', | |
56 | + [ | |
57 | + 'attribute' => 'option', | |
58 | + 'format' => 'ntext', | |
59 | + 'contentOptions' => [ | |
60 | + 'style' => 'white-space: normal', | |
61 | + ], | |
62 | + ], | |
63 | + [ | |
64 | + 'attribute' => 'price', | |
65 | + 'value' => function ($model) { | |
66 | + /** | |
67 | + * @var Car $model | |
68 | + */ | |
69 | + return '$' . number_format($model->price, 3); | |
70 | + }, | |
71 | + ], | |
72 | + | |
73 | + ], | |
74 | + ] | |
75 | + ); ?> | |
76 | +</div> | ... | ... |
1 | +++ a/backend/views/car/update.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | + | |
5 | +/* @var $this yii\web\View */ | |
6 | +/* @var $model common\models\Car */ | |
7 | + | |
8 | +$this->title = 'Обновить автомобиль: ' . $model->model; | |
9 | +$this->params['breadcrumbs'][] = ['label' => 'Автомобили', 'url' => ['index']]; | |
10 | +$this->params['breadcrumbs'][] = ['label' => $model->model, 'url' => ['view', 'id' => $model->car_id]]; | |
11 | +$this->params['breadcrumbs'][] = 'Обновить'; | |
12 | +?> | |
13 | +<div class="car-update"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <?= $this->render('_form', [ | |
18 | + 'model' => $model, | |
19 | + ]) ?> | |
20 | + | |
21 | +</div> | ... | ... |
1 | +++ a/backend/views/car/view.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\Car */ | |
8 | + | |
9 | +$this->title = $model->car_id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => 'Cars', 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="car-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a('Update', ['update', 'id' => $model->car_id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a('Delete', ['delete', 'id' => $model->car_id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => '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 | + 'car_id', | |
32 | + 'model', | |
33 | + 'year', | |
34 | + 'image', | |
35 | + 'color', | |
36 | + 'mileage', | |
37 | + 'build', | |
38 | + 'option:ntext', | |
39 | + 'price', | |
40 | + ], | |
41 | + ]) ?> | |
42 | + | |
43 | +</div> | ... | ... |
1 | +++ a/backend/views/layouts/main.php | |
1 | +<?php | |
2 | + | |
3 | +/* @var $this \yii\web\View */ | |
4 | +/* @var $content string */ | |
5 | + | |
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 | + | |
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() ?> | |
27 | + | |
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 | + ['label' => 'Каталог автомобилей', 'url' => ['car/index']], | |
40 | + ]; | |
41 | + if (Yii::$app->user->isGuest) { | |
42 | + $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; | |
43 | + } else { | |
44 | + $menuItems[] = '<li>' | |
45 | + . Html::beginForm(['/site/logout'], 'post') | |
46 | + . Html::submitButton( | |
47 | + 'Logout (' . Yii::$app->user->identity->username . ')', | |
48 | + ['class' => 'btn btn-link'] | |
49 | + ) | |
50 | + . Html::endForm() | |
51 | + . '</li>'; | |
52 | + } | |
53 | + echo Nav::widget([ | |
54 | + 'options' => ['class' => 'navbar-nav navbar-right'], | |
55 | + 'items' => $menuItems, | |
56 | + ]); | |
57 | + NavBar::end(); | |
58 | + ?> | |
59 | + | |
60 | + <div class="container"> | |
61 | + <?= Breadcrumbs::widget([ | |
62 | + 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | |
63 | + ]) ?> | |
64 | + <?= Alert::widget() ?> | |
65 | + <?= $content ?> | |
66 | + </div> | |
67 | +</div> | |
68 | + | |
69 | +<footer class="footer"> | |
70 | + <div class="container"> | |
71 | + <p class="pull-left">© My Company <?= date('Y') ?></p> | |
72 | + | |
73 | + <p class="pull-right"><?= Yii::powered() ?></p> | |
74 | + </div> | |
75 | +</footer> | |
76 | + | |
77 | +<?php $this->endBody() ?> | |
78 | +</body> | |
79 | +</html> | |
80 | +<?php $this->endPage() ?> | ... | ... |
1 | +++ a/backend/views/site/error.php | |
1 | +<?php | |
2 | + | |
3 | +/* @var $this yii\web\View */ | |
4 | +/* @var $name string */ | |
5 | +/* @var $message string */ | |
6 | +/* @var $exception Exception */ | |
7 | + | |
8 | +use yii\helpers\Html; | |
9 | + | |
10 | +$this->title = $name; | |
11 | +?> | |
12 | +<div class="site-error"> | |
13 | + | |
14 | + <h1><?= Html::encode($this->title) ?></h1> | |
15 | + | |
16 | + <div class="alert alert-danger"> | |
17 | + <?= nl2br(Html::encode($message)) ?> | |
18 | + </div> | |
19 | + | |
20 | + <p> | |
21 | + The above error occurred while the Web server was processing your request. | |
22 | + </p> | |
23 | + <p> | |
24 | + Please contact us if you think this is a server error. Thank you. | |
25 | + </p> | |
26 | + | |
27 | +</div> | ... | ... |
1 | +++ a/backend/views/site/index.php | |
1 | +<?php | |
2 | + | |
3 | +/* @var $this yii\web\View */ | |
4 | + | |
5 | +$this->title = 'My Yii Application'; | |
6 | +?> | |
7 | +<div class="site-index"> | |
8 | + | |
9 | + <div class="jumbotron"> | |
10 | + <h1>Congratulations!</h1> | |
11 | + | |
12 | + <p class="lead">You have successfully created your Yii-powered application.</p> | |
13 | + | |
14 | + <p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> | |
15 | + </div> | |
16 | + | |
17 | + <div class="body-content"> | |
18 | + | |
19 | + <div class="row"> | |
20 | + <div class="col-lg-4"> | |
21 | + <h2>Heading</h2> | |
22 | + | |
23 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
24 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
25 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
26 | + fugiat nulla pariatur.</p> | |
27 | + | |
28 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> | |
29 | + </div> | |
30 | + <div class="col-lg-4"> | |
31 | + <h2>Heading</h2> | |
32 | + | |
33 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
34 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
35 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
36 | + fugiat nulla pariatur.</p> | |
37 | + | |
38 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> | |
39 | + </div> | |
40 | + <div class="col-lg-4"> | |
41 | + <h2>Heading</h2> | |
42 | + | |
43 | + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et | |
44 | + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | |
45 | + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu | |
46 | + fugiat nulla pariatur.</p> | |
47 | + | |
48 | + <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> | |
49 | + </div> | |
50 | + </div> | |
51 | + | |
52 | + </div> | |
53 | +</div> | ... | ... |
1 | +++ a/backend/views/site/login.php | |
1 | +<?php | |
2 | + | |
3 | +/* @var $this yii\web\View */ | |
4 | +/* @var $form yii\bootstrap\ActiveForm */ | |
5 | +/* @var $model \common\models\LoginForm */ | |
6 | + | |
7 | +use yii\helpers\Html; | |
8 | +use yii\bootstrap\ActiveForm; | |
9 | + | |
10 | +$this->title = 'Login'; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="site-login"> | |
14 | + <h1><?= Html::encode($this->title) ?></h1> | |
15 | + | |
16 | + <p>Please fill out the following fields to login:</p> | |
17 | + | |
18 | + <div class="row"> | |
19 | + <div class="col-lg-5"> | |
20 | + <?php $form = ActiveForm::begin(['id' => 'login-form']); ?> | |
21 | + | |
22 | + <?= $form->field($model, 'username')->textInput(['autofocus' => true]) ?> | |
23 | + | |
24 | + <?= $form->field($model, 'password')->passwordInput() ?> | |
25 | + | |
26 | + <?= $form->field($model, 'rememberMe')->checkbox() ?> | |
27 | + | |
28 | + <div class="form-group"> | |
29 | + <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?> | |
30 | + </div> | |
31 | + | |
32 | + <?php ActiveForm::end(); ?> | |
33 | + </div> | |
34 | + </div> | |
35 | +</div> | ... | ... |
1 | +++ a/backend/web/css/site.css | |
1 | +html, | |
2 | +body { | |
3 | + height: 100%; | |
4 | +} | |
5 | + | |
6 | +.wrap { | |
7 | + min-height: 100%; | |
8 | + height: auto; | |
9 | + margin: 0 auto -60px; | |
10 | + padding: 0 0 60px; | |
11 | +} | |
12 | + | |
13 | +.wrap > .container { | |
14 | + padding: 70px 15px 20px; | |
15 | +} | |
16 | + | |
17 | +.footer { | |
18 | + height: 60px; | |
19 | + background-color: #f5f5f5; | |
20 | + border-top: 1px solid #ddd; | |
21 | + padding-top: 20px; | |
22 | +} | |
23 | + | |
24 | +.jumbotron { | |
25 | + text-align: center; | |
26 | + background-color: transparent; | |
27 | +} | |
28 | + | |
29 | +.jumbotron .btn { | |
30 | + font-size: 21px; | |
31 | + padding: 14px 24px; | |
32 | +} | |
33 | + | |
34 | +.not-set { | |
35 | + color: #c55; | |
36 | + font-style: italic; | |
37 | +} | |
38 | + | |
39 | +/* add sorting icons to gridview sort links */ | |
40 | +a.asc:after, a.desc:after { | |
41 | + position: relative; | |
42 | + top: 1px; | |
43 | + display: inline-block; | |
44 | + font-family: 'Glyphicons Halflings'; | |
45 | + font-style: normal; | |
46 | + font-weight: normal; | |
47 | + line-height: 1; | |
48 | + padding-left: 5px; | |
49 | +} | |
50 | + | |
51 | +a.asc:after { | |
52 | + content: /*"\e113"*/ "\e151"; | |
53 | +} | |
54 | + | |
55 | +a.desc:after { | |
56 | + content: /*"\e114"*/ "\e152"; | |
57 | +} | |
58 | + | |
59 | +.sort-numerical a.asc:after { | |
60 | + content: "\e153"; | |
61 | +} | |
62 | + | |
63 | +.sort-numerical a.desc:after { | |
64 | + content: "\e154"; | |
65 | +} | |
66 | + | |
67 | +.sort-ordinal a.asc:after { | |
68 | + content: "\e155"; | |
69 | +} | |
70 | + | |
71 | +.sort-ordinal a.desc:after { | |
72 | + content: "\e156"; | |
73 | +} | |
74 | + | |
75 | +.grid-view td { | |
76 | + white-space: nowrap; | |
77 | +} | |
78 | + | |
79 | +.grid-view .filters input, | |
80 | +.grid-view .filters select { | |
81 | + min-width: 50px; | |
82 | +} | |
83 | + | |
84 | +.hint-block { | |
85 | + display: block; | |
86 | + margin-top: 5px; | |
87 | + color: #999; | |
88 | +} | |
89 | + | |
90 | +.error-summary { | |
91 | + color: #a94442; | |
92 | + background: #fdf7f7; | |
93 | + border-left: 3px solid #eed3d7; | |
94 | + padding: 10px 20px; | |
95 | + margin: 0 0 15px 0; | |
96 | +} | |
97 | + | |
98 | +/* align the logout "link" (button in form) of the navbar */ | |
99 | +.nav > li > form { | |
100 | + padding: 8px; | |
101 | +} | |
102 | + | |
103 | +@media(max-width:768px) { | |
104 | + .nav li > form { | |
105 | + padding: 3px; | |
106 | + } | |
107 | +} | |
108 | + | |
109 | +.nav > li > form > button:hover { | |
110 | + text-decoration: none; | |
111 | +} | ... | ... |
No preview for this file type
1 | +++ a/common/components/Request.php | |
1 | +<?php | |
2 | +namespace common\components; | |
3 | + | |
4 | +class Request extends \yii\web\Request | |
5 | + | |
6 | +{ | |
7 | + | |
8 | + public $web; | |
9 | + | |
10 | + public $adminUrl; | |
11 | + | |
12 | + | |
13 | + | |
14 | + public function getBaseUrl() | |
15 | + | |
16 | + { | |
17 | + | |
18 | + return str_replace($this->web, "", parent::getBaseUrl()) . $this->adminUrl; | |
19 | + | |
20 | + } | |
21 | + | |
22 | + | |
23 | + | |
24 | + public function resolvePathInfo() | |
25 | + | |
26 | + { | |
27 | + | |
28 | + if ($this->getUrl() === $this->adminUrl) { | |
29 | + | |
30 | + return ""; | |
31 | + | |
32 | + } else { | |
33 | + | |
34 | + return parent::resolvePathInfo(); | |
35 | + | |
36 | + } | |
37 | + | |
38 | + } | |
39 | + | |
40 | +} | |
0 | 41 | \ No newline at end of file | ... | ... |
1 | +++ a/common/components/urlManager/.htaccess | |
1 | +AddDefaultCharset WINDOWS-1251 | |
2 | +#php_value display_errors 1 | |
3 | +#php_value error_reporting 2047 | |
4 | + | |
5 | +RewriteEngine on | |
6 | + | |
7 | + | |
8 | + | |
9 | +RewriteRule ^(.*)(date\.php|votebar|spam|\.css|uploaded|img|rating\.php|forum_comment\.php|js|admin|googlec87a9150150cf5d3.html)(.*)$ $1$2$3 [L] | |
10 | +RewriteRule ^(.*)$ index.php [L] | ... | ... |
1 | +++ a/common/components/urlManager/LangRequest.php | |
1 | +<?php | |
2 | +namespace common\components\urlManager; | |
3 | + | |
4 | +use Yii; | |
5 | +use yii\web\Request; | |
6 | + | |
7 | +class LangRequest extends Request | |
8 | +{ | |
9 | + protected function resolvePathInfo() | |
10 | + { | |
11 | + | |
12 | + foreach(Yii::$app->urlManager->languages as $lang){ | |
13 | + if(strpos($_SERVER['PHP_SELF'], '/'.$lang))Yii::$app->language = $lang; | |
14 | + } | |
15 | + return parent::resolvePathInfo(); | |
16 | + } | |
17 | +} | |
0 | 18 | \ No newline at end of file | ... | ... |
1 | +++ a/common/components/urlManager/LangUrlManager.php | |
1 | +<?php | |
2 | +/* | |
3 | + * To change this template, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/** | |
8 | + * Description of LangUrlManager | |
9 | + * | |
10 | + * @author Ekstazi | |
11 | + * @ver 1.2 | |
12 | + */ | |
13 | +namespace common\components\urlManager; | |
14 | +use yii\web\UrlManager; | |
15 | +use Yii; | |
16 | +class LangUrlManager extends UrlManager{ | |
17 | + public $languages=array('en'); | |
18 | + public $lang='ru'; | |
19 | + public $langParam='language'; | |
20 | + | |
21 | + | |
22 | + | |
23 | + public function createUrl($params=array()){ | |
24 | + | |
25 | + if(!isset($params[$this->langParam])){ if(Yii::$app->language != $this->lang)$params[$this->langParam]=Yii::$app->language;} | |
26 | + else if($params[$this->langParam] == $this->lang)unset($params[$this->langParam]); | |
27 | + return parent::createUrl($params); | |
28 | + } | |
29 | + //put your code here | |
30 | +} | |
0 | 31 | \ No newline at end of file | ... | ... |
1 | +++ a/common/components/urlManager/LangUrlRule.php | |
1 | +<?php | |
2 | +/* | |
3 | + * To change this template, choose Tools | Templates | |
4 | + * and open the template in the editor. | |
5 | + */ | |
6 | + | |
7 | +/** | |
8 | + * Description of LangUrlManager | |
9 | + * | |
10 | + * @author Ekstazi | |
11 | + * @ver 1.2 | |
12 | + */ | |
13 | +namespace common\components\urlManager; | |
14 | +use yii\rest\UrlRule; | |
15 | +use Yii; | |
16 | +class LangUrlRule extends UrlRule{ | |
17 | + public $languages=array('en'); | |
18 | + public $lang='ru'; | |
19 | + public $langParam='language'; | |
20 | + | |
21 | + /*public function parsePathInfo($pathInfo) | |
22 | + { | |
23 | + parent::parsePathInfo($pathInfo); | |
24 | + | |
25 | + $userLang=Yii::app()->getRequest()->getPreferredLanguage(); | |
26 | + //if language pass via url use it | |
27 | + if(isset($_GET[$this->langParam])&&in_array($_GET[$this->langParam],$this->languages)){ | |
28 | + Yii::app()->language=$_GET[$this->langParam]; | |
29 | + //else if preffered language is allowed | |
30 | + }elseif(in_array($userLang,$this->languages)) { | |
31 | + Yii::app()->language=$userLang; | |
32 | + //else use the first language from the list | |
33 | + }else Yii::app()->language=$this->lang; | |
34 | + | |
35 | + }*/ | |
36 | + //put your code here | |
37 | + | |
38 | + public function init(){ | |
39 | + print '=='; | |
40 | + print Yii::$app->getRequest()->getQueryParam('language'); | |
41 | + return parent::init(); | |
42 | + } | |
43 | + public function createUrl($params=array()){ | |
44 | + $userLang=Yii::$app->getRequest()->getPreferredLanguage(); | |
45 | + //if language pass via url use it | |
46 | + if(isset($_GET[$this->langParam])&&in_array($_GET[$this->langParam],$this->languages)){ | |
47 | + Yii::$app->language=$_GET[$this->langParam]; | |
48 | + //else if preffered language is allowed | |
49 | + }elseif(in_array($userLang,$this->languages)) { | |
50 | + Yii::$app->language=$userLang; | |
51 | + //else use the first language from the list | |
52 | + }else Yii::$app->language=$this->lang; | |
53 | + | |
54 | + //print_r($_GET); | |
55 | + if(!isset($params[$this->langParam])){ if(Yii::$app->language != $this->lang)$params[$this->langParam]=Yii::$app->language;} | |
56 | + else if($params[$this->langParam] == $this->lang)unset($params[$this->langParam]); | |
57 | + //print_r($params); | |
58 | + return parent::createUrl($params); | |
59 | + } | |
60 | + //put your code here | |
61 | +} | |
0 | 62 | \ No newline at end of file | ... | ... |
1 | +++ a/common/config/bootstrap.php | |
1 | +<?php | |
2 | + Yii::setAlias('@common', dirname(__DIR__)); | |
3 | + Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend'); | |
4 | + Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend'); | |
5 | + Yii::setAlias('@storage', dirname(dirname(__DIR__)) . '/storage'); | |
6 | + Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console'); | |
7 | + | ... | ... |
1 | +++ a/common/mail/layouts/html.php | |
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | + | |
4 | +/* @var $this \yii\web\View view component instance */ | |
5 | +/* @var $message \yii\mail\MessageInterface the message being composed */ | |
6 | +/* @var $content string main view render result */ | |
7 | +?> | |
8 | +<?php $this->beginPage() ?> | |
9 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
10 | +<html xmlns="http://www.w3.org/1999/xhtml"> | |
11 | +<head> | |
12 | + <meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" /> | |
13 | + <title><?= Html::encode($this->title) ?></title> | |
14 | + <?php $this->head() ?> | |
15 | +</head> | |
16 | +<body> | |
17 | + <?php $this->beginBody() ?> | |
18 | + <?= $content ?> | |
19 | + <?php $this->endBody() ?> | |
20 | +</body> | |
21 | +</html> | |
22 | +<?php $this->endPage() ?> | ... | ... |
1 | +++ a/common/mail/layouts/text.php | |
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | + | |
4 | +/* @var $this \yii\web\View view component instance */ | |
5 | +/* @var $message \yii\mail\MessageInterface the message being composed */ | |
6 | +/* @var $content string main view render result */ | |
7 | +?> | |
8 | +<?php $this->beginPage() ?> | |
9 | +<?php $this->beginBody() ?> | |
10 | +<?= $content ?> | |
11 | +<?php $this->endBody() ?> | |
12 | +<?php $this->endPage() ?> | ... | ... |
1 | +++ a/common/mail/passwordResetToken-html.php | |
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | + | |
4 | +/* @var $this yii\web\View */ | |
5 | +/* @var $user common\models\User */ | |
6 | + | |
7 | +$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); | |
8 | +?> | |
9 | +<div class="password-reset"> | |
10 | + <p>Hello <?= Html::encode($user->username) ?>,</p> | |
11 | + | |
12 | + <p>Follow the link below to reset your password:</p> | |
13 | + | |
14 | + <p><?= Html::a(Html::encode($resetLink), $resetLink) ?></p> | |
15 | +</div> | ... | ... |
1 | +++ a/common/mail/passwordResetToken-text.php | |
1 | +<?php | |
2 | + | |
3 | +/* @var $this yii\web\View */ | |
4 | +/* @var $user common\models\User */ | |
5 | + | |
6 | +$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); | |
7 | +?> | |
8 | +Hello <?= $user->username ?>, | |
9 | + | |
10 | +Follow the link below to reset your password: | |
11 | + | |
12 | +<?= $resetLink ?> | ... | ... |
1 | +++ a/common/models/Buys.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + /** | |
6 | + * Class Buys | |
7 | + * @property int $id | |
8 | + * @property string $username | |
9 | + * @property string $email | |
10 | + * @property string $phone | |
11 | + * @property string $model_name | |
12 | + * @property int $model_year | |
13 | + * @property string $model_color | |
14 | + */ | |
15 | + class Buys extends \yii\db\ActiveRecord | |
16 | + { | |
17 | + | |
18 | + public static function tableName() | |
19 | + { | |
20 | + return 'buys'; | |
21 | + } | |
22 | + | |
23 | + public function rules() | |
24 | + { | |
25 | + return [ | |
26 | + [ | |
27 | + [ 'username' ], | |
28 | + 'string', | |
29 | + 'min' => 2, | |
30 | + 'max' => 255, | |
31 | + ], | |
32 | + | |
33 | + [ | |
34 | + 'email', | |
35 | + 'email', | |
36 | + ], | |
37 | + [ | |
38 | + [ | |
39 | + 'email', | |
40 | + 'phone', | |
41 | + ], | |
42 | + 'string', | |
43 | + 'max' => 255, | |
44 | + ], | |
45 | + | |
46 | + [ | |
47 | + 'phone', | |
48 | + 'required', | |
49 | + ], | |
50 | + [ | |
51 | + [ | |
52 | + 'phone', | |
53 | + 'model_name', | |
54 | + 'model_year', | |
55 | + 'model_color', | |
56 | + ], | |
57 | + 'safe', | |
58 | + ], | |
59 | + | |
60 | + ]; | |
61 | + } | |
62 | + | |
63 | + public function attributeLabels() | |
64 | + { | |
65 | + return [ | |
66 | + 'username' => 'Имя', | |
67 | + 'phone' => 'телефон', | |
68 | + 'email' => 'e-mail', | |
69 | + 'model_name' => '', | |
70 | + 'model_year' => '', | |
71 | + 'model_color' => '', | |
72 | + ]; | |
73 | + } | |
74 | + | |
75 | + } | |
0 | 76 | \ No newline at end of file | ... | ... |
1 | +++ a/common/models/Car.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\web\UploadedFile; | |
7 | + | |
8 | + /** | |
9 | + * This is the model class for table "car". | |
10 | + * @property integer $car_id | |
11 | + * @property string $model | |
12 | + * @property integer $year | |
13 | + * @property string $image | |
14 | + * @property string $color | |
15 | + * @property double $mileage | |
16 | + * @property integer $build | |
17 | + * @property string $option | |
18 | + * @property double $price | |
19 | + */ | |
20 | + class Car extends \yii\db\ActiveRecord | |
21 | + { | |
22 | + | |
23 | + /** | |
24 | + * @inheritdoc | |
25 | + */ | |
26 | + public static function tableName() | |
27 | + { | |
28 | + return 'car'; | |
29 | + } | |
30 | + | |
31 | + /** | |
32 | + * @inheritdoc | |
33 | + */ | |
34 | + public function rules() | |
35 | + { | |
36 | + return [ | |
37 | + [ | |
38 | + [ | |
39 | + 'model', | |
40 | + 'year', | |
41 | + ], | |
42 | + 'required', | |
43 | + ], | |
44 | + [ | |
45 | + [ 'year' ], | |
46 | + 'integer', | |
47 | + ], | |
48 | + [ | |
49 | + [ | |
50 | + 'mileage', | |
51 | + 'price', | |
52 | + ], | |
53 | + 'number', | |
54 | + ], | |
55 | + [ | |
56 | + [ | |
57 | + 'option', | |
58 | + 'build', | |
59 | + ], | |
60 | + 'string', | |
61 | + ], | |
62 | + [ | |
63 | + [ | |
64 | + 'model', | |
65 | + 'color', | |
66 | + ], | |
67 | + 'string', | |
68 | + 'max' => 255, | |
69 | + ], | |
70 | + [ | |
71 | + [ 'image' ], | |
72 | + 'safe', | |
73 | + ], | |
74 | + ]; | |
75 | + } | |
76 | + | |
77 | + /** | |
78 | + * @inheritdoc | |
79 | + */ | |
80 | + public function attributeLabels() | |
81 | + { | |
82 | + return [ | |
83 | + 'car_id' => Yii::t('app', 'Ідентификатор'), | |
84 | + 'model' => Yii::t('app', 'Модель'), | |
85 | + 'year' => Yii::t('app', 'Год производства'), | |
86 | + 'image' => Yii::t('app', 'Изображение'), | |
87 | + 'color' => Yii::t('app', 'Цвет'), | |
88 | + 'mileage' => Yii::t('app', 'Пробег'), | |
89 | + 'build' => Yii::t('app', 'Дата выпуска'), | |
90 | + 'option' => Yii::t('app', 'Доп. опции'), | |
91 | + 'price' => Yii::t('app', 'Цена'), | |
92 | + ]; | |
93 | + } | |
94 | + | |
95 | + public function upload() | |
96 | + { | |
97 | + /** | |
98 | + * @var UploadedFile $image | |
99 | + */ | |
100 | + $this->image = UploadedFile::getInstance($this, 'image'); | |
101 | + $image = $this->image; | |
102 | + if(!empty( $image )) { | |
103 | + $fullName = $image->baseName . time() . '.' . $image->extension; | |
104 | + $path = Yii::getAlias('@storage') . '/' . $fullName; | |
105 | + $image->saveAs($path); | |
106 | + $image->name = '/storage/' . $fullName; | |
107 | + } else { | |
108 | + $this->image = $this->getOldAttribute('image'); | |
109 | + } | |
110 | + return true; | |
111 | + } | |
112 | + } | ... | ... |
1 | +++ a/common/models/CarSearch.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\base\Model; | |
7 | + use yii\data\ActiveDataProvider; | |
8 | + use common\models\Car; | |
9 | + | |
10 | + /** | |
11 | + * CarSearch represents the model behind the search form about `common\models\Car`. | |
12 | + */ | |
13 | + class CarSearch extends Car | |
14 | + { | |
15 | + | |
16 | + const DEFAULT_MODEL = 'Nissan Leaf S'; | |
17 | + const DEFAULT_YEAR = 2013; | |
18 | + const SCENARIO_PUBLIC = 'public'; | |
19 | + | |
20 | + /** | |
21 | + * @inheritdoc | |
22 | + */ | |
23 | + public function rules() | |
24 | + { | |
25 | + return [ | |
26 | + [ | |
27 | + [ | |
28 | + 'car_id', | |
29 | + 'year', | |
30 | + 'build', | |
31 | + ], | |
32 | + 'integer', | |
33 | + ], | |
34 | + [ | |
35 | + [ | |
36 | + 'model', | |
37 | + 'image', | |
38 | + 'color', | |
39 | + 'option', | |
40 | + ], | |
41 | + 'safe', | |
42 | + ], | |
43 | + [ | |
44 | + [ | |
45 | + 'mileage', | |
46 | + 'price', | |
47 | + ], | |
48 | + 'number', | |
49 | + ], | |
50 | + ]; | |
51 | + } | |
52 | + | |
53 | + /** | |
54 | + * @inheritdoc | |
55 | + */ | |
56 | + public function scenarios() | |
57 | + { | |
58 | + // bypass scenarios() implementation in the parent class | |
59 | + $scenarios = parent::scenarios(); | |
60 | + $scenarios[self::SCENARIO_PUBLIC] = ['model', 'year']; | |
61 | + return $scenarios; | |
62 | + } | |
63 | + | |
64 | + /** | |
65 | + * Creates data provider instance with search query applied | |
66 | + * | |
67 | + * @param array $params | |
68 | + * | |
69 | + * @return ActiveDataProvider | |
70 | + */ | |
71 | + public function search($params) | |
72 | + { | |
73 | + $query = Car::find(); | |
74 | + | |
75 | + // add conditions that should always apply here | |
76 | + | |
77 | + $dataProvider = new ActiveDataProvider([ | |
78 | + 'query' => $query, | |
79 | + 'pagination' => false, | |
80 | + ]); | |
81 | + | |
82 | + $this->load($params); | |
83 | + | |
84 | + if(!$this->validate()) { | |
85 | + // uncomment the following line if you do not want to return any records when validation fails | |
86 | + // $query->where('0=1'); | |
87 | + return $dataProvider; | |
88 | + } | |
89 | + | |
90 | + if($this->scenario == self::SCENARIO_PUBLIC) { | |
91 | + if(empty( $this->model )) { | |
92 | + $this->model = self::DEFAULT_MODEL; | |
93 | + }; | |
94 | + if(empty( $this->year )) { | |
95 | + $this->year = self::DEFAULT_YEAR; | |
96 | + }; | |
97 | + } | |
98 | + | |
99 | + // grid filtering conditions | |
100 | + $query->andFilterWhere([ | |
101 | + 'car_id' => $this->car_id, | |
102 | + 'year' => $this->year, | |
103 | + 'mileage' => $this->mileage, | |
104 | + 'build' => $this->build, | |
105 | + 'price' => $this->price, | |
106 | + 'model' => $this->model, | |
107 | + ]); | |
108 | + | |
109 | + $query->andFilterWhere([ | |
110 | + 'like', | |
111 | + 'image', | |
112 | + $this->image, | |
113 | + ]) | |
114 | + ->andFilterWhere([ | |
115 | + 'like', | |
116 | + 'color', | |
117 | + $this->color, | |
118 | + ]) | |
119 | + ->andFilterWhere([ | |
120 | + 'like', | |
121 | + 'option', | |
122 | + $this->option, | |
123 | + ]); | |
124 | + | |
125 | + return $dataProvider; | |
126 | + } | |
127 | + } | ... | ... |
1 | +++ a/common/models/Emails.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\models; | |
4 | + | |
5 | + /** | |
6 | + * Class Emails | |
7 | + * @property int $id | |
8 | + * @property string $username | |
9 | + * @property string $email | |
10 | + * @property string $phone | |
11 | + * @property string $message | |
12 | + * @property int $date_from | |
13 | + * @property int $date_to | |
14 | + * @property int $date_count | |
15 | + */ | |
16 | + class Emails extends \yii\db\ActiveRecord | |
17 | + { | |
18 | + | |
19 | + const SCENARIO_EMAIL = 'email'; | |
20 | + const SCENARIO_QUESTION = 'question'; | |
21 | + const SCENARIO_BOOKING = 'booking'; | |
22 | + const SCENARIO_KEY = 'key'; | |
23 | + | |
24 | + public static function tableName() | |
25 | + { | |
26 | + return 'emails'; | |
27 | + } | |
28 | + | |
29 | + public function scenarios() | |
30 | + { | |
31 | + $scenario = parent::scenarios(); | |
32 | + $new_scenarios = [ | |
33 | + self::SCENARIO_EMAIL => [ | |
34 | + 'username', | |
35 | + 'email', | |
36 | + 'phone', | |
37 | + ], | |
38 | + self::SCENARIO_QUESTION => [ | |
39 | + 'username', | |
40 | + 'email', | |
41 | + 'phone', | |
42 | + 'message' | |
43 | + ], | |
44 | + self::SCENARIO_BOOKING => [ | |
45 | + 'username', | |
46 | + 'email', | |
47 | + 'phone', | |
48 | + 'date_from', | |
49 | + 'date_to', | |
50 | + ], | |
51 | + self::SCENARIO_KEY => [ | |
52 | + 'username', | |
53 | + 'email', | |
54 | + 'phone', | |
55 | + 'date_count', | |
56 | + ], | |
57 | + ]; | |
58 | + return array_merge($scenario, $new_scenarios); | |
59 | + } | |
60 | + | |
61 | + public function rules() | |
62 | + { | |
63 | + return [ | |
64 | + [ | |
65 | + [ 'username' ], | |
66 | + 'string', | |
67 | + 'min' => 2, | |
68 | + 'max' => 255, | |
69 | + ], | |
70 | + | |
71 | + [ | |
72 | + 'email', | |
73 | + 'email', | |
74 | + ], | |
75 | + [ | |
76 | + [ | |
77 | + 'email', | |
78 | + 'phone', | |
79 | + ], | |
80 | + 'string', | |
81 | + 'max' => 255, | |
82 | + ], | |
83 | + | |
84 | + [ | |
85 | + 'phone', | |
86 | + 'required', | |
87 | + ], | |
88 | + [ | |
89 | + 'message', | |
90 | + 'string', | |
91 | + ], | |
92 | + [ | |
93 | + ['date_from', 'date_to'], | |
94 | + 'safe', | |
95 | + ], | |
96 | + [ | |
97 | + ['date_from', 'date_to'], | |
98 | + 'filter', | |
99 | + 'filter' => function($value) { | |
100 | + return strtotime($value); | |
101 | + } | |
102 | + ], | |
103 | + [ | |
104 | + 'date_count', | |
105 | + 'integer', | |
106 | + ], | |
107 | + ]; | |
108 | + } | |
109 | + | |
110 | + public function attributeLabels() | |
111 | + { | |
112 | + return [ | |
113 | + 'username' => \Yii::t('app', 'Имя'), | |
114 | + 'phone' => \Yii::t('app', 'телефон'), | |
115 | + 'email' => \Yii::t('app', 'e-mail'), | |
116 | + 'message' => \Yii::t('app', 'сообщение'), | |
117 | + 'date_to' => \Yii::t('app', 'дата проката до'), | |
118 | + 'date_from' => \Yii::t('app', 'дата проката с'), | |
119 | + 'date_count' => \Yii::t('app', 'количество дней'), | |
120 | + ]; | |
121 | + } | |
122 | + | |
123 | + } | |
0 | 124 | \ No newline at end of file | ... | ... |
1 | +++ a/common/models/LoginForm.php | |
1 | +<?php | |
2 | +namespace common\models; | |
3 | + | |
4 | +use Yii; | |
5 | +use yii\base\Model; | |
6 | + | |
7 | +/** | |
8 | + * Login form | |
9 | + */ | |
10 | +class LoginForm extends Model | |
11 | +{ | |
12 | + public $username; | |
13 | + public $password; | |
14 | + public $rememberMe = true; | |
15 | + | |
16 | + private $_user; | |
17 | + | |
18 | + | |
19 | + /** | |
20 | + * @inheritdoc | |
21 | + */ | |
22 | + public function rules() | |
23 | + { | |
24 | + return [ | |
25 | + // username and password are both required | |
26 | + [['username', 'password'], 'required'], | |
27 | + // rememberMe must be a boolean value | |
28 | + ['rememberMe', 'boolean'], | |
29 | + // password is validated by validatePassword() | |
30 | + ['password', 'validatePassword'], | |
31 | + ]; | |
32 | + } | |
33 | + | |
34 | + /** | |
35 | + * Validates the password. | |
36 | + * This method serves as the inline validation for password. | |
37 | + * | |
38 | + * @param string $attribute the attribute currently being validated | |
39 | + * @param array $params the additional name-value pairs given in the rule | |
40 | + */ | |
41 | + public function validatePassword($attribute, $params) | |
42 | + { | |
43 | + if (!$this->hasErrors()) { | |
44 | + $user = $this->getUser(); | |
45 | + if (!$user || !$user->validatePassword($this->password)) { | |
46 | + $this->addError($attribute, 'Incorrect username or password.'); | |
47 | + } | |
48 | + } | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * Logs in a user using the provided username and password. | |
53 | + * | |
54 | + * @return boolean whether the user is logged in successfully | |
55 | + */ | |
56 | + public function login() | |
57 | + { | |
58 | + if ($this->validate()) { | |
59 | + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); | |
60 | + } else { | |
61 | + return false; | |
62 | + } | |
63 | + } | |
64 | + | |
65 | + /** | |
66 | + * Finds user by [[username]] | |
67 | + * | |
68 | + * @return User|null | |
69 | + */ | |
70 | + protected function getUser() | |
71 | + { | |
72 | + if ($this->_user === null) { | |
73 | + $this->_user = User::findByUsername($this->username); | |
74 | + } | |
75 | + | |
76 | + return $this->_user; | |
77 | + } | |
78 | +} | ... | ... |
1 | +++ a/common/models/Quest.php | |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | +use Yii; | |
5 | + | |
6 | +class Quest extends \yii\db\ActiveRecord | |
7 | +{ | |
8 | + public static function tableName() | |
9 | + { | |
10 | + return 'quest'; | |
11 | + } | |
12 | + public function rules() | |
13 | + { | |
14 | + return [ | |
15 | + [['username'], 'string', 'min' => 2, 'max' => 255], | |
16 | + | |
17 | + ['email', 'email'], | |
18 | + [['email','phone'], 'string', 'max' => 255], | |
19 | + | |
20 | + ['phone', 'required'], | |
21 | + [['phone','model_name','model_year','model_color'], 'safe'] | |
22 | + | |
23 | + ]; | |
24 | + } | |
25 | + | |
26 | + public function attributeLabels() | |
27 | + { | |
28 | + return [ | |
29 | + 'username' =>'Имя', | |
30 | + 'phone' =>'телефон', | |
31 | + 'email' =>'e-mail', | |
32 | + 'model_name' =>'', | |
33 | + 'model_year' =>'', | |
34 | + 'model_color' =>'', | |
35 | + ]; | |
36 | + } | |
37 | + | |
38 | + | |
39 | + | |
40 | + | |
41 | +} | |
0 | 42 | \ No newline at end of file | ... | ... |
1 | +++ a/common/models/Question.php | ... | ... |
1 | +++ a/common/models/User.php | |
1 | +<?php | |
2 | +namespace common\models; | |
3 | + | |
4 | +use Yii; | |
5 | +use yii\base\NotSupportedException; | |
6 | +use yii\behaviors\TimestampBehavior; | |
7 | +use yii\db\ActiveRecord; | |
8 | +use yii\web\IdentityInterface; | |
9 | + | |
10 | +/** | |
11 | + * User model | |
12 | + * | |
13 | + * @property integer $id | |
14 | + * @property string $username | |
15 | + * @property string $password_hash | |
16 | + * @property string $password_reset_token | |
17 | + * @property string $email | |
18 | + * @property string $auth_key | |
19 | + * @property integer $status | |
20 | + * @property integer $created_at | |
21 | + * @property integer $updated_at | |
22 | + * @property string $password write-only password | |
23 | + */ | |
24 | +class User extends ActiveRecord implements IdentityInterface | |
25 | +{ | |
26 | + const STATUS_DELETED = 0; | |
27 | + const STATUS_ACTIVE = 10; | |
28 | + | |
29 | + | |
30 | + /** | |
31 | + * @inheritdoc | |
32 | + */ | |
33 | + public static function tableName() | |
34 | + { | |
35 | + return '{{%user}}'; | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * @inheritdoc | |
40 | + */ | |
41 | + public function behaviors() | |
42 | + { | |
43 | + return [ | |
44 | + TimestampBehavior::className(), | |
45 | + ]; | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * @inheritdoc | |
50 | + */ | |
51 | + public function rules() | |
52 | + { | |
53 | + return [ | |
54 | + ['status', 'default', 'value' => self::STATUS_ACTIVE], | |
55 | + ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], | |
56 | + ]; | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * @inheritdoc | |
61 | + */ | |
62 | + public static function findIdentity($id) | |
63 | + { | |
64 | + return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); | |
65 | + } | |
66 | + | |
67 | + /** | |
68 | + * @inheritdoc | |
69 | + */ | |
70 | + public static function findIdentityByAccessToken($token, $type = null) | |
71 | + { | |
72 | + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); | |
73 | + } | |
74 | + | |
75 | + /** | |
76 | + * Finds user by username | |
77 | + * | |
78 | + * @param string $username | |
79 | + * @return static|null | |
80 | + */ | |
81 | + public static function findByUsername($username) | |
82 | + { | |
83 | + return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); | |
84 | + } | |
85 | + | |
86 | + /** | |
87 | + * Finds user by password reset token | |
88 | + * | |
89 | + * @param string $token password reset token | |
90 | + * @return static|null | |
91 | + */ | |
92 | + public static function findByPasswordResetToken($token) | |
93 | + { | |
94 | + if (!static::isPasswordResetTokenValid($token)) { | |
95 | + return null; | |
96 | + } | |
97 | + | |
98 | + return static::findOne([ | |
99 | + 'password_reset_token' => $token, | |
100 | + 'status' => self::STATUS_ACTIVE, | |
101 | + ]); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * Finds out if password reset token is valid | |
106 | + * | |
107 | + * @param string $token password reset token | |
108 | + * @return boolean | |
109 | + */ | |
110 | + public static function isPasswordResetTokenValid($token) | |
111 | + { | |
112 | + if (empty($token)) { | |
113 | + return false; | |
114 | + } | |
115 | + | |
116 | + $timestamp = (int) substr($token, strrpos($token, '_') + 1); | |
117 | + $expire = Yii::$app->params['user.passwordResetTokenExpire']; | |
118 | + return $timestamp + $expire >= time(); | |
119 | + } | |
120 | + | |
121 | + /** | |
122 | + * @inheritdoc | |
123 | + */ | |
124 | + public function getId() | |
125 | + { | |
126 | + return $this->getPrimaryKey(); | |
127 | + } | |
128 | + | |
129 | + /** | |
130 | + * @inheritdoc | |
131 | + */ | |
132 | + public function getAuthKey() | |
133 | + { | |
134 | + return $this->auth_key; | |
135 | + } | |
136 | + | |
137 | + /** | |
138 | + * @inheritdoc | |
139 | + */ | |
140 | + public function validateAuthKey($authKey) | |
141 | + { | |
142 | + return $this->getAuthKey() === $authKey; | |
143 | + } | |
144 | + | |
145 | + /** | |
146 | + * Validates password | |
147 | + * | |
148 | + * @param string $password password to validate | |
149 | + * @return boolean if password provided is valid for current user | |
150 | + */ | |
151 | + public function validatePassword($password) | |
152 | + { | |
153 | + return Yii::$app->security->validatePassword($password, $this->password_hash); | |
154 | + } | |
155 | + | |
156 | + /** | |
157 | + * Generates password hash from password and sets it to the model | |
158 | + * | |
159 | + * @param string $password | |
160 | + */ | |
161 | + public function setPassword($password) | |
162 | + { | |
163 | + $this->password_hash = Yii::$app->security->generatePasswordHash($password); | |
164 | + } | |
165 | + | |
166 | + /** | |
167 | + * Generates "remember me" authentication key | |
168 | + */ | |
169 | + public function generateAuthKey() | |
170 | + { | |
171 | + $this->auth_key = Yii::$app->security->generateRandomString(); | |
172 | + } | |
173 | + | |
174 | + /** | |
175 | + * Generates new password reset token | |
176 | + */ | |
177 | + public function generatePasswordResetToken() | |
178 | + { | |
179 | + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); | |
180 | + } | |
181 | + | |
182 | + /** | |
183 | + * Removes password reset token | |
184 | + */ | |
185 | + public function removePasswordResetToken() | |
186 | + { | |
187 | + $this->password_reset_token = null; | |
188 | + } | |
189 | +} | ... | ... |
common/modules/language/components/LanguageRequest.php
0 → 100755
1 | +++ a/common/modules/language/components/LanguageRequest.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\modules\language\components; | |
4 | + | |
5 | + use common\modules\language\models\Language; | |
6 | + use yii\base\InvalidConfigException; | |
7 | + use yii\web\Request; | |
8 | + | |
9 | + class LanguageRequest extends Request | |
10 | + { | |
11 | + | |
12 | + private $_language_url; | |
13 | + | |
14 | + public function getLanguageUrl() | |
15 | + { | |
16 | + if($this->_language_url === NULL) { | |
17 | + $this->_language_url = $this->getUrl(); | |
18 | + | |
19 | + $url_list = explode('/', $this->_language_url); | |
20 | + | |
21 | + $language_url = isset( $url_list[ 1 ] ) ? $url_list[ 1 ] : NULL; | |
22 | + Language::setCurrent($language_url); | |
23 | + | |
24 | + if($language_url !== NULL && $language_url === Language::getCurrent()->url && strpos($this->_language_url, Language::getCurrent()->url) === 1) { | |
25 | + $this->_language_url = substr($this->_language_url, strlen(Language::getCurrent()->url) + 1); | |
26 | + } | |
27 | + } | |
28 | + | |
29 | + | |
30 | + return $this->_language_url; | |
31 | + } | |
32 | + | |
33 | + protected function resolvePathInfo() | |
34 | + { | |
35 | + $pathInfo = $this->getLanguageUrl(); | |
36 | + | |
37 | + if(( $pos = strpos($pathInfo, '?') ) !== false) { | |
38 | + $pathInfo = substr($pathInfo, 0, $pos); | |
39 | + } | |
40 | + | |
41 | + $pathInfo = urldecode($pathInfo); | |
42 | + | |
43 | + if(!preg_match('%^(?: | |
44 | + [\x09\x0A\x0D\x20-\x7E] | |
45 | + | [\xC2-\xDF][\x80-\xBF] | |
46 | + | \xE0[\xA0-\xBF][\x80-\xBF] | |
47 | + | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} | |
48 | + | \xED[\x80-\x9F][\x80-\xBF] | |
49 | + | \xF0[\x90-\xBF][\x80-\xBF]{2} | |
50 | + | [\xF1-\xF3][\x80-\xBF]{3} | |
51 | + | \xF4[\x80-\x8F][\x80-\xBF]{2} | |
52 | + )*$%xs', $pathInfo) | |
53 | + ) { | |
54 | + $pathInfo = utf8_encode($pathInfo); | |
55 | + } | |
56 | + | |
57 | + $scriptUrl = $this->getScriptUrl(); | |
58 | + $baseUrl = $this->getBaseUrl(); | |
59 | + | |
60 | + if(strpos($pathInfo, $scriptUrl) === 0) { | |
61 | + $pathInfo = substr($pathInfo, strlen($scriptUrl)); | |
62 | + } elseif($baseUrl === '' || strpos($pathInfo, $baseUrl) === 0) { | |
63 | + $pathInfo = substr($pathInfo, strlen($baseUrl)); | |
64 | + } elseif(isset( $_SERVER[ 'PHP_SELF' ] ) && strpos($_SERVER[ 'PHP_SELF' ], $scriptUrl) === 0) { | |
65 | + $pathInfo = substr($_SERVER[ 'PHP_SELF' ], strlen($scriptUrl)); | |
66 | + } else { | |
67 | + throw new InvalidConfigException('Unable to determine the path info of the current request.'); | |
68 | + } | |
69 | + | |
70 | + if($pathInfo === '/') { | |
71 | + $pathInfo = substr($pathInfo, 1); | |
72 | + } | |
73 | + | |
74 | + return (string) $pathInfo; | |
75 | + } | |
76 | + } | |
0 | 77 | \ No newline at end of file | ... | ... |
common/modules/language/components/LanguageUrlManager.php
0 → 100755
1 | +++ a/common/modules/language/components/LanguageUrlManager.php | |
1 | +<?php | |
2 | + namespace common\modules\language\components; | |
3 | + | |
4 | + use common\modules\language\models\Language; | |
5 | + use yii\web\UrlManager; | |
6 | + | |
7 | + class LanguageUrlManager extends UrlManager | |
8 | + { | |
9 | + | |
10 | + /** | |
11 | + * @inheritdoc | |
12 | + */ | |
13 | + public function createUrl($params) | |
14 | + { | |
15 | + if(isset($params['language_id'])) { | |
16 | + | |
17 | + $language = Language::findOne($params['language_id']); | |
18 | + if($language === NULL) { | |
19 | + $language = Language::getDefaultLanguage(); | |
20 | + } | |
21 | + unset($params['language_id']); | |
22 | + } else { | |
23 | + | |
24 | + $language = Language::getCurrent(); | |
25 | + } | |
26 | + | |
27 | + $url = parent::createUrl($params); | |
28 | + | |
29 | + | |
30 | + if($url == '/') { | |
31 | + return '/'.$language->url; | |
32 | + } else { | |
33 | + return '/'.$language->url.$url; | |
34 | + } | |
35 | + } | |
36 | + } | |
0 | 37 | \ No newline at end of file | ... | ... |
common/modules/language/migrations/m160829_104745_create_table_language.php
0 → 100755
1 | +++ a/common/modules/language/migrations/m160829_104745_create_table_language.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160829_104745_create_table_language extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->createTable('{{%language}}', [ | |
10 | + 'language_id' => $this->primaryKey(), | |
11 | + 'url' => $this->string()->notNull(), | |
12 | + 'local' => $this->string()->notNull(), | |
13 | + 'name' => $this->string()->notNull(), | |
14 | + 'default' => $this->boolean()->notNull()->defaultValue(false), | |
15 | + 'date_create' => $this->integer()->notNull(), | |
16 | + 'date_update' => $this->integer()->notNull(), | |
17 | + ]); | |
18 | + } | |
19 | + | |
20 | + public function down() | |
21 | + { | |
22 | + $this->dropTable('{{%language}}'); | |
23 | + } | |
24 | +} | ... | ... |
common/modules/language/migrations/m160829_105345_add_default_languages.php
0 → 100755
1 | +++ a/common/modules/language/migrations/m160829_105345_add_default_languages.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160829_105345_add_default_languages extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->batchInsert('{{%language}}', [ | |
10 | + 'language_id', | |
11 | + 'url', | |
12 | + 'local', | |
13 | + 'name', | |
14 | + 'default', | |
15 | + 'date_create', | |
16 | + 'date_update', | |
17 | + ], [ | |
18 | + [ | |
19 | + 1, | |
20 | + 'en', | |
21 | + 'en-EN', | |
22 | + 'English', | |
23 | + 0, | |
24 | + time(), | |
25 | + time(), | |
26 | + ], | |
27 | + [ | |
28 | + 2, | |
29 | + 'ru', | |
30 | + 'ru-RU', | |
31 | + 'Русский', | |
32 | + 1, | |
33 | + time(), | |
34 | + time(), | |
35 | + ], | |
36 | + ]); | |
37 | + } | |
38 | + | |
39 | + public function down() | |
40 | + { | |
41 | + $this->delete('{{%language}}', ['language_id' => [1, 2]]); | |
42 | + } | |
43 | +} | ... | ... |
common/modules/language/migrations/m160901_140639_add_ukrainian_language.php
0 → 100755
1 | +++ a/common/modules/language/migrations/m160901_140639_add_ukrainian_language.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160901_140639_add_ukrainian_language extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->batchInsert('{{%language}}', [ | |
10 | + 'language_id', | |
11 | + 'url', | |
12 | + 'local', | |
13 | + 'name', | |
14 | + 'default', | |
15 | + 'date_create', | |
16 | + 'date_update', | |
17 | + ], [ | |
18 | + [ | |
19 | + 3, | |
20 | + 'ua', | |
21 | + 'ua-UA', | |
22 | + 'Українська', | |
23 | + 0, | |
24 | + time(), | |
25 | + time(), | |
26 | + ], | |
27 | + ]); | |
28 | + } | |
29 | + | |
30 | + public function down() | |
31 | + { | |
32 | + $this->delete('{{%language}}', ['language_id' => [3]]); | |
33 | + } | |
34 | +} | ... | ... |
1 | +++ a/common/modules/language/models/Language.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\modules\language\models; | |
4 | + | |
5 | + use Yii; | |
6 | + use yii\db\ActiveRecord; | |
7 | + | |
8 | + /** | |
9 | + * This is the model class for table "language". | |
10 | + * @property integer $language_id | |
11 | + * @property string $url | |
12 | + * @property string $local | |
13 | + * @property string $name | |
14 | + * @property boolean $default | |
15 | + * @property integer $date_create | |
16 | + * @property integer $date_update | |
17 | + */ | |
18 | + class Language extends \yii\db\ActiveRecord | |
19 | + { | |
20 | + | |
21 | + public static $current = null; | |
22 | + | |
23 | + /** | |
24 | + * @inheritdoc | |
25 | + */ | |
26 | + public static function tableName() | |
27 | + { | |
28 | + return 'language'; | |
29 | + } | |
30 | + | |
31 | + /** | |
32 | + * @inheritdoc | |
33 | + */ | |
34 | + public function behaviors() | |
35 | + { | |
36 | + return [ | |
37 | + 'timestamp' => [ | |
38 | + 'class' => 'yii\behaviors\TimestampBehavior', | |
39 | + 'attributes' => [ | |
40 | + ActiveRecord::EVENT_BEFORE_INSERT => [ | |
41 | + 'date_create', | |
42 | + 'date_update', | |
43 | + ], | |
44 | + ActiveRecord::EVENT_BEFORE_UPDATE => [ | |
45 | + 'date_update', | |
46 | + ], | |
47 | + ], | |
48 | + ], | |
49 | + ]; | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * @inheritdoc | |
54 | + */ | |
55 | + public function rules() | |
56 | + { | |
57 | + return [ | |
58 | + [ | |
59 | + [ | |
60 | + 'url', | |
61 | + 'local', | |
62 | + 'name', | |
63 | + 'date_create', | |
64 | + 'date_update', | |
65 | + ], | |
66 | + 'required', | |
67 | + ], | |
68 | + [ | |
69 | + [ 'default' ], | |
70 | + 'boolean', | |
71 | + ], | |
72 | + [ | |
73 | + [ | |
74 | + 'date_create', | |
75 | + 'date_update', | |
76 | + ], | |
77 | + 'integer', | |
78 | + ], | |
79 | + [ | |
80 | + [ | |
81 | + 'url', | |
82 | + 'local', | |
83 | + 'name', | |
84 | + ], | |
85 | + 'string', | |
86 | + 'max' => 255, | |
87 | + ], | |
88 | + ]; | |
89 | + } | |
90 | + | |
91 | + /** | |
92 | + * @inheritdoc | |
93 | + */ | |
94 | + public function attributeLabels() | |
95 | + { | |
96 | + return [ | |
97 | + 'language_id' => Yii::t('app', 'Language ID'), | |
98 | + 'url' => Yii::t('app', 'Url'), | |
99 | + 'local' => Yii::t('app', 'Local'), | |
100 | + 'name' => Yii::t('app', 'Name'), | |
101 | + 'default' => Yii::t('app', 'Default'), | |
102 | + 'date_create' => Yii::t('app', 'Date Create'), | |
103 | + 'date_update' => Yii::t('app', 'Date Update'), | |
104 | + ]; | |
105 | + } | |
106 | + | |
107 | + /** | |
108 | + * Get current language | |
109 | + * | |
110 | + * @return null|Language | |
111 | + */ | |
112 | + public static function getCurrent() | |
113 | + { | |
114 | + if(self::$current === null) { | |
115 | + self::$current = self::getDefaultLanguage(); | |
116 | + } | |
117 | + return self::$current; | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * Set current language by Url param | |
122 | + * | |
123 | + * @param null|string $url Language url param | |
124 | + */ | |
125 | + public static function setCurrent($url = null) { | |
126 | + $language = self::getLanguageByUrl($url); | |
127 | + self::$current = ($language === null) ? self::getDefaultLanguage() : $language; | |
128 | + Yii::$app->language = self::$current->local; | |
129 | + } | |
130 | + | |
131 | + /** | |
132 | + * Get default language | |
133 | + * | |
134 | + * @return null|Language | |
135 | + */ | |
136 | + public static function getDefaultLanguage() { | |
137 | + /** | |
138 | + * @var null|Language $language | |
139 | + */ | |
140 | + $language = self::find()->where(['default' => true])->one(); | |
141 | + return $language; | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * Get language by Url param | |
146 | + * | |
147 | + * @param null|string $url Language url param | |
148 | + * | |
149 | + * @return null|Language | |
150 | + */ | |
151 | + public static function getLanguageByUrl($url = null) { | |
152 | + if($url === NULL) { | |
153 | + return NULL; | |
154 | + } else { | |
155 | + /** | |
156 | + * @var null|Language $language | |
157 | + */ | |
158 | + $language = self::find()->where(['url' => $url])->one(); | |
159 | + if($language === NULL) { | |
160 | + return NULL; | |
161 | + } else { | |
162 | + return $language; | |
163 | + } | |
164 | + } | |
165 | + } | |
166 | + } | ... | ... |
1 | +++ a/common/modules/language/readme.txt | |
1 | +1. Запускаем миграцию: php yii migrate --migrationPath=common/modules/language/migrations | |
2 | +2. Добавляем в файл конфигурации: | |
3 | +'urlManager' => [ | |
4 | + 'enablePrettyUrl' => true, | |
5 | + 'showScriptName' => false, | |
6 | + 'class'=>'common\modules\language\components\LanguageUrlManager', | |
7 | + 'rules'=>[ | |
8 | + '/' => 'site/index', | |
9 | + '<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>', | |
10 | + ] | |
11 | +], | |
12 | +3. Добавляем в файл конфигурации: | |
13 | +'request' => [ | |
14 | + 'class' => 'common\modules\language\components\LanguageRequest' | |
15 | +], | |
16 | +4. Добавляем в файл конфигурации: | |
17 | +'language'=>'ru-RU', | |
18 | +'i18n' => [ | |
19 | + 'translations' => [ | |
20 | + '*' => [ | |
21 | + 'class' => 'yii\i18n\PhpMessageSource', | |
22 | + 'basePath' => '@frontend/messages', | |
23 | + 'sourceLanguage' => 'en', | |
24 | + 'fileMap' => [ | |
25 | + ], | |
26 | + ], | |
27 | + ], | |
28 | +], | |
29 | +5. Переводы писать в файл frontend\messages\{language}\app.php, где {language} - нужный язык, например ru. | |
30 | +6. Для вывода на странице сообщения с переводом используем функцию: Yii::t('app', {message}, $params = [], $language = null), | |
31 | + где {message} - нужное сообщение, $params - массив параметров, $language - нужный язык (по умолчанию используется текущий язык). | |
32 | +7. В наличие также виджет переключения языка: LanguagePicker::widget() | |
0 | 33 | \ No newline at end of file | ... | ... |
1 | +++ a/common/modules/language/widgets/LanguagePicker.php | |
1 | +<?php | |
2 | + | |
3 | + namespace common\modules\language\widgets; | |
4 | + | |
5 | + use common\modules\language\models\Language; | |
6 | + use yii\bootstrap\Widget; | |
7 | + | |
8 | + class LanguagePicker extends Widget | |
9 | + { | |
10 | + public function init() | |
11 | + { | |
12 | + | |
13 | + } | |
14 | + | |
15 | + public function run() | |
16 | + { | |
17 | + return $this->render('view', [ | |
18 | + 'current' => Language::getCurrent(), | |
19 | + 'languages' => Language::find()->where(['!=', 'language_id', Language::getCurrent()->language_id])->all(), | |
20 | + ]); | |
21 | + } | |
22 | + } | |
0 | 23 | \ No newline at end of file | ... | ... |
1 | +++ a/common/modules/language/widgets/views/view.php | |
1 | +<?php | |
2 | + use common\models\Language; | |
3 | + use yii\bootstrap\Html; | |
4 | + | |
5 | + /** | |
6 | + * @var Language $current Current language | |
7 | + * @var Language[] $languages Available languages | |
8 | + */ | |
9 | +?> | |
10 | +<div id="language_picker"> | |
11 | + <span id="current_language"> | |
12 | + <?php | |
13 | + echo $current->name; | |
14 | + ?> | |
15 | + <span class="show-more-language">▼</span> | |
16 | + </span> | |
17 | + <ul id="languages"> | |
18 | + <?php | |
19 | + foreach($languages as $language) { | |
20 | + ?> | |
21 | + <li class="item-language"> | |
22 | + <?php | |
23 | + echo Html::a($language->name, '/' . $language->url . Yii::$app->getRequest() | |
24 | + ->getLanguageUrl()); | |
25 | + ?> | |
26 | + </li> | |
27 | + <?php | |
28 | + } | |
29 | + ?> | |
30 | + </ul> | |
31 | +</div> | ... | ... |
1 | +++ a/common/translation/ru/app.php | |
1 | +<?php | |
2 | +return [ | |
3 | + 'id' => 'ID', | |
4 | + 'username' => 'Имя', | |
5 | + 'surname' => 'Фамилия', | |
6 | + 'auth_key' => 'Auth Key', | |
7 | + 'password_hash' => 'Password Hash', | |
8 | + 'password_reset_token' => 'Password Reset Token', | |
9 | + 'email' => 'Логин (e-mail)', | |
10 | + 'phone' => 'Телефон', | |
11 | + 'status' => 'Статус', | |
12 | + 'created_at' => 'Created At', | |
13 | + 'updated_at' => 'Updated At', | |
14 | + 'verifyCode' => 'Код проверки', | |
15 | + 'password' => 'Пароль', | |
16 | + 'password_repeat' => 'Повторить пароль', | |
17 | + 'registration' => 'Регистрация', | |
18 | + 'message' => 'Этот {field} уже занят', | |
19 | + 'message_match_password' => 'Пароли не совпадают', | |
20 | + 'exit' => 'Выход', | |
21 | + 'enter' => 'Войти', | |
22 | + 'your_personal_area' => 'Вход в личный кабинет', | |
23 | + 'forgot_password' => 'Забыли пароль?', | |
24 | + 'rememberMe' => 'Запомнить меня', | |
25 | + 'articles' => 'Всего товаров', | |
26 | + 'code' => 'Код: {0}', | |
27 | + 'checkout' => 'оформить заказ', | |
28 | + 'sum' => 'Сумма', | |
29 | + 'continue_shopping' => 'продолжить покупки', | |
30 | + 'edit_personal_data' => 'Редактировать личные данные', | |
31 | + 'personal_data' => 'Личные данные', | |
32 | + 'my_orders' => 'Мои заказы', | |
33 | + 'bookmarks' => 'Закладки', | |
34 | + 'basket' => 'Корзина', | |
35 | + 'banner_id' => 'Banner ID', | |
36 | + 'image' => 'Изображение', | |
37 | + 'alt' => 'Описание', | |
38 | + 'title' => 'Заголовок', | |
39 | + 'url' => 'Ссылка', | |
40 | + 'width' => 'Ширина', | |
41 | + 'height' => 'Высота', | |
42 | + 'blog_id' => 'Blog ID', | |
43 | + 'user_id' => 'User ID', | |
44 | + 'name' => 'Название', | |
45 | + 'link' => 'Ссылка', | |
46 | + 'date_add' => 'Дата добавления', | |
47 | + 'user_add_id' => 'User Add ID', | |
48 | + 'view_count' => 'Количество просмотров', | |
49 | + 'description' => 'Описание', | |
50 | + 'cover' => 'Фото главное', | |
51 | + 'event_id' => 'Event ID', | |
52 | + 'alias' => 'Ссылка', | |
53 | + 'body' => 'Тело', | |
54 | + 'meta_title' => 'Мета заголовок', | |
55 | + 'h1' => 'H1', | |
56 | + 'seo_text' => 'Сео Текст', | |
57 | + 'end_at' => 'Срок действия по', | |
58 | + 'order_items_id' => 'Order Items ID', | |
59 | + 'order_id' => 'Order ID', | |
60 | + 'item_id' => 'Item ID', | |
61 | + 'item_count' => 'Количество', | |
62 | + 'price' => 'Цена', | |
63 | + 'customer_id' => 'Customer ID', | |
64 | + 'delivery' => 'Доставка', | |
65 | + 'payment' => 'Оплата', | |
66 | + 'seo_id' => 'Seo ID', | |
67 | + 'controller' => 'Controller', | |
68 | + 'seo_category_id' => 'Seo Category ID', | |
69 | + 'seo_dynamic_id' => 'Seo Dynamic ID', | |
70 | + 'action' => 'Action', | |
71 | + 'fields' => 'Поля', | |
72 | + 'param' => 'Параметры', | |
73 | + 'key' => 'Ключ', | |
74 | + 'service_id' => 'Service ID', | |
75 | + 'slider_id' => 'Slider ID', | |
76 | + 'speed' => 'Скорость', | |
77 | + 'duration' => 'Продолжительность', | |
78 | + 'slider_image_id' => 'Slider Image ID', | |
79 | + 'sort' => 'Сортировка', | |
80 | + 'Цвет' => 'Цвет', | |
81 | + 'year_made' => 'Год производства', | |
82 | + | |
83 | + 'citycar_chose' => 'Выбери свой<br /><span>идеальный</span><br />CityCar', | |
84 | + 'enroll' => 'Записаться на тест драйв', | |
85 | + 'buy_leaf' => 'Купить Nissan Leaf', | |
86 | + 'why_leaf' => 'Почему Nissan Leaf', | |
87 | + 'why_leaf_line1' => '<h3>за <span class="big">10</span> сек</h3><p>Разгон 0-100км/ч</p>', | |
88 | + 'why_leaf_line2' => '<h3><span class="big">5</span> звезд</h3><p>Рейтинг безопасности</p>', | |
89 | + 'why_leaf_line3' => '<h3><span class="big">152</span> км/ч</h3><p>Максимальная скорость</p>', | |
90 | + 'why_leaf_line4' => '<h3>от <span class="big">5</span> до <span class="big">7</span> часов</h3><p>Время полной зарядки</p>', | |
91 | + 'why_leaf_line5' => '<h3>от <span class="big">15000</span> $</h3><p>Стоимость модели базовой комплектации</p>', | |
92 | + 'why_leaf_line6' => '<h3>по городу <span class="big">150</span><span class="d-inline-block">км в режиме эко 192 км</span></h3><p> Запас хода</p>', | |
93 | + 'why_we' => 'Почему мы', | |
94 | + 'why_we_line1' => '<p><strong>Лидер Украины</strong> в продаже и обслуживании электрокаров</p>', | |
95 | + 'why_we_line2' => '<p>Производим <strong>экспертное консультирование</strong></p>', | |
96 | + 'why_we_line3' => '<p><strong>Предлагаем тестирование</strong> перед осуществлением покупки</p>', | |
97 | + 'why_we_line4' => '<p><strong>Осуществляем полную проверку авто</strong> (подтверждаем карфаксом)</p>', | |
98 | + 'why_we_line5' => '<p>Наиболее <strong>выгодные</strong> <strong>ценовые предложения</strong></p>', | |
99 | + 'why_we_line6' => '<p>Предоставляем полное <strong>гарантийное обслуживание</strong></p>', | |
100 | + 'contacts' => 'Контакты', | |
101 | + 'contacts1' => 'проспект Степана Бандеры 9в', | |
102 | + 'kyiv' => 'Киев', | |
103 | + 'partners' => 'Наши партнеры', | |
104 | + 'rent_auto' => 'Аренда и прокат авто', | |
105 | + 'rent_auto1' => 'Выбери <span class="border_rent">Nissan Leaf</span> <small>получи</small> <span class="text-yellow">3 дня аренды в подарок</span>', | |
106 | + 'rent_auto2' => 'Почувствуй бесшумный ход, приятную езду, легкую управляемость автомобиля и нашу заботу. Только <span class="text-yellow">мы предоставляем</span> нашим клиентам <span class="text-yellow">полную карту зарядных станций</span> и подробно описываем условия доступа к разным операторам + осуществляем полную техническую помощь на дороге. Поэтому вам не придется ни о чем беспокоиться, а только наслаждаться поездкой в привычном для вас ритме жизни.', | |
107 | + 'rent_auto3' => 'Стоимость проката', | |
108 | + 'days' => 'дней', | |
109 | + 'week' => 'неделя', | |
110 | + 'weeks' => 'Недель', | |
111 | + 'month' => 'Месяц', | |
112 | + 'months' => 'месяцев', | |
113 | + | |
114 | + 'deposit' => 'Залоговый депозит', | |
115 | + 'dontforget1' => 'Не забудьте взять с собой', | |
116 | + 'dontforget2' => 'Паспорт', | |
117 | + 'dontforget3' => 'Идентификационный код', | |
118 | + 'dontforget4' => 'Водительские права', | |
119 | + 'rent1' => 'Что входит в стоимость проката', | |
120 | + 'rent2' => 'Страхование КАСКО', | |
121 | + 'rent3' => 'Профессиональная техническая помощь на дороге', | |
122 | + 'rent4' => 'Полный комплект необходимых аксессуаров', | |
123 | + 'rent_button' => 'Забронировать', | |
124 | + 'keytokey' => 'Акция "Ключ-на-ключ"', | |
125 | + 'keytokey11' => 'Специальное предложение от СЕО компании ElectroCars', | |
126 | + 'keytokey12' => 'Александра Кравцова для тех, кто решил познакомиться со всеми преимуществами электромобиля лично:', | |
127 | + 'keytokey2' => 'Два года существования проекта ElectroCars показали, что лучший аргумент перейти на электромобиль - дать попробовать пересесть на него хотя бы на несколько дней. После этого обычная машина кажется прошлым веком, а все страхи по имеющейся инфраструктуре для электромобилей и пробега на одном заряде исчезают.', | |
128 | + 'keytokey3' => 'Мы решили запустить проект "Ключ-на-ключ", чтобы дать возможность нашим друзьям попробовать электрокар, а нам вспомнить, что такое оставлять на заправке 1000 грн :)', | |
129 | + 'keytokey4' => 'Если вы имеете водительский стаж не менее 2-х лет, собственное авто и желание узнать, что значит водить электрокар, тогда вам нужно просто', | |
130 | + 'submit_but1' => 'Оставить заявку', | |
131 | + 'be_friend' => 'Стать<br />нашим другом', | |
132 | + 'share_fb' => 'Поделиться вашими фото и впечатлениями от поездки на своей страничке в ФБ.', | |
133 | + 'chose_var' => 'Выбирайте оптимальный для себя вариант', | |
134 | + 'leaf_days3' => 'Leaf Викенд / 3 дня', | |
135 | + 'leaf_days5' => 'Leaf Будни / 5 дней', | |
136 | + | |
137 | + 'models' => 'Модельный ряд Nissan Leaf', | |
138 | + 'models2' => 'Модели Nissan Leaf в наличии', | |
139 | + | |
140 | + 'footer1' => 'Все права защищены.', | |
141 | + 'footer2' => 'Использование материалов сайта возможно только со ссылкой на источник.', | |
142 | + 'footer3' => 'Создание сайтов', | |
143 | + 'comment' => 'комментарий', | |
144 | + 'send' => 'отправить', | |
145 | + 'text_message' => 'Сообщение', | |
146 | + 'buy_but' => 'купить', | |
147 | + 'questions' => 'Остались вопросы?<br/>Напишите нам', | |
148 | + 'zapys' => 'записаться', | |
149 | + 'from' => 'с', | |
150 | + 'to' => 'по', | |
151 | + 'numdays' => 'Количество дней', | |
152 | + 'tsd_km' => 'тыс. км', | |
153 | + 'bron' => 'Дата брони', | |
154 | +]; | |
0 | 155 | \ No newline at end of file | ... | ... |
1 | +++ a/common/translation/ru/product.php | |
1 | +<?php | |
2 | +return [ | |
3 | + 'Categories' => 'Категории', | |
4 | + 'Create Category' => 'Создать Категорию', | |
5 | + 'Name' => 'Наименование', | |
6 | + 'Remote ID' => 'ID в 1С', | |
7 | + 'Search for "{keywords}"' => 'Поиск по "{keywords}"', | |
8 | + 'Search for "{keywords}" in category "{category}"' => 'Поиск по "{keywords}" в категории "{category}"', | |
9 | + 'Promo products' => 'Акционные товары', | |
10 | + 'New products' => 'Новинки', | |
11 | + 'Top products' => 'Популярные', | |
12 | + 'Similar products' => 'Похожие товары', | |
13 | + 'Brands' => 'Бренды', | |
14 | + 'Brand' => 'Бренд', | |
15 | + 'Categories' => 'Категории', | |
16 | + 'Category' => 'Категория', | |
17 | + 'Select brand' => 'Выберите бренд', | |
18 | + 'Select category' => 'Выберите категорию', | |
19 | + 'SKU' => 'Артикул', | |
20 | + 'Stock' => 'Остаток', | |
21 | + 'Price' => 'Цена', | |
22 | + 'Price Old' => 'Старая Цена', | |
23 | + 'Products' => 'Товары', | |
24 | + 'Product' => 'Товар', | |
25 | + 'Variants' => 'Модификации', | |
26 | + 'Variant' => 'Модификация', | |
27 | + 'Create Product' => 'Создать Товар', | |
28 | + 'Enable' => 'Доступно', | |
29 | + 'Disable' => 'Отсутсвует', | |
30 | +]; | |
0 | 31 | \ No newline at end of file | ... | ... |
1 | +++ a/common/translation/ua/app.php | |
1 | +<?php | |
2 | +return [ | |
3 | + 'id' => 'ID', | |
4 | + 'username' => "Ім'я", | |
5 | + 'surname' => 'Фамилия', | |
6 | + 'auth_key' => 'Auth Key', | |
7 | + 'password_hash' => 'Password Hash', | |
8 | + 'password_reset_token' => 'Password Reset Token', | |
9 | + 'email' => 'Логин (e-mail)', | |
10 | + 'phone' => 'Телефон', | |
11 | + 'status' => 'Статус', | |
12 | + 'created_at' => 'Created At', | |
13 | + 'updated_at' => 'Updated At', | |
14 | + 'verifyCode' => 'Код проверки', | |
15 | + 'password' => 'Пароль', | |
16 | + 'password_repeat' => 'Повторить пароль', | |
17 | + 'registration' => 'Регистрация', | |
18 | + 'message' => 'Этот {field} уже занят', | |
19 | + 'message_match_password' => 'Пароли не совпадают', | |
20 | + 'exit' => 'Выход', | |
21 | + 'enter' => 'Войти', | |
22 | + 'your_personal_area' => 'Вход в личный кабинет', | |
23 | + 'forgot_password' => 'Забыли пароль?', | |
24 | + 'rememberMe' => 'Запомнить меня', | |
25 | + 'articles' => 'Всего товаров', | |
26 | + 'code' => 'Код: {0}', | |
27 | + 'checkout' => 'оформить заказ', | |
28 | + 'sum' => 'Сумма', | |
29 | + 'continue_shopping' => 'продолжить покупки', | |
30 | + 'edit_personal_data' => 'Редактировать личные данные', | |
31 | + 'personal_data' => 'Личные данные', | |
32 | + 'my_orders' => 'Мои заказы', | |
33 | + 'bookmarks' => 'Закладки', | |
34 | + 'basket' => 'Корзина', | |
35 | + 'banner_id' => 'Banner ID', | |
36 | + 'image' => 'Изображение', | |
37 | + 'alt' => 'Описание', | |
38 | + 'title' => 'Заголовок', | |
39 | + 'url' => 'Ссылка', | |
40 | + 'width' => 'Ширина', | |
41 | + 'height' => 'Высота', | |
42 | + 'blog_id' => 'Blog ID', | |
43 | + 'user_id' => 'User ID', | |
44 | + 'name' => 'Название', | |
45 | + 'link' => 'Ссылка', | |
46 | + 'date_add' => 'Дата добавления', | |
47 | + 'user_add_id' => 'User Add ID', | |
48 | + 'view_count' => 'Количество просмотров', | |
49 | + 'description' => 'Описание', | |
50 | + 'cover' => 'Фото главное', | |
51 | + 'event_id' => 'Event ID', | |
52 | + 'alias' => 'Ссылка', | |
53 | + 'body' => 'Тело', | |
54 | + 'meta_title' => 'Мета заголовок', | |
55 | + 'h1' => 'H1', | |
56 | + 'seo_text' => 'Сео Текст', | |
57 | + 'end_at' => 'Срок действия по', | |
58 | + 'order_items_id' => 'Order Items ID', | |
59 | + 'order_id' => 'Order ID', | |
60 | + 'item_id' => 'Item ID', | |
61 | + 'item_count' => 'Количество', | |
62 | + 'price' => 'Цена', | |
63 | + 'customer_id' => 'Customer ID', | |
64 | + 'delivery' => 'Доставка', | |
65 | + 'payment' => 'Оплата', | |
66 | + 'seo_id' => 'Seo ID', | |
67 | + 'controller' => 'Controller', | |
68 | + 'seo_category_id' => 'Seo Category ID', | |
69 | + 'seo_dynamic_id' => 'Seo Dynamic ID', | |
70 | + 'action' => 'Action', | |
71 | + 'fields' => 'Поля', | |
72 | + 'param' => 'Параметры', | |
73 | + 'key' => 'Ключ', | |
74 | + 'service_id' => 'Service ID', | |
75 | + 'slider_id' => 'Slider ID', | |
76 | + 'speed' => 'Скорость', | |
77 | + 'duration' => 'Продолжительность', | |
78 | + 'slider_image_id' => 'Slider Image ID', | |
79 | + 'sort' => 'Сортировка', | |
80 | + 'Цвет' => 'Колір', | |
81 | + 'Пробег' => 'Пробіг', | |
82 | + 'Дата выпуска' => 'Дата випуску', | |
83 | + 'Доп. опции' => 'Дод. опції', | |
84 | + 'черный' => 'Чорний', | |
85 | + 'year_made' => 'Рік виробництва', | |
86 | + | |
87 | + 'citycar_chose' => 'Обери<br>свій <span>ідеальний</span><br>CityCar', | |
88 | + 'enroll' => 'Записатись на тест драйв', | |
89 | + 'buy_leaf' => 'Купити Nissan Leaf', | |
90 | + 'why_leaf' => 'Чому Nissan Leaf', | |
91 | + 'why_leaf_line1' => '<h3>за <span class="big">10</span> сек</h3><p>Розгін 0-100км/ч</p>', | |
92 | + 'why_leaf_line2' => '<h3><span class="big">5</span> зірок</h3><p>Рейтинг безпеки</p>', | |
93 | + 'why_leaf_line3' => '<h3><span class="big">152</span> км/ч</h3><p>Максимальна швидкість</p>', | |
94 | + 'why_leaf_line4' => '<h3>від <span class="big">5</span> до <span class="big">7</span> годин</h3><p>Час повної зарядки</p>', | |
95 | + 'why_leaf_line5' => '<h3>запас ходу - по місту <span class="big">150</span><span class="d-inline-block">км в режимі еко 192 км</span></h3><p> Запас ходу</p>', | |
96 | + 'why_leaf_line6' => '<h3>від <span class="big">15000</span> у.о.</h3><p>Вартість моделі базової комплектації</p>', | |
97 | + 'why_we' => 'Чому ми', | |
98 | + 'why_we_line1' => '<p><strong>Лідер України</strong> з продажу і обслуговування електрокарів</p>', | |
99 | + 'why_we_line2' => '<p>Надаємо <strong>експертне консультування</strong></p>', | |
100 | + 'why_we_line3' => '<p><strong>Пропонуємо тестування</strong> перед здійсненням покупки</p>', | |
101 | + 'why_we_line4' => '<p><strong>Здійснюємо повну перевірку авто</strong> (підтверджуємо карфаксом)</p>', | |
102 | + 'why_we_line5' => '<p>Найбільш <strong>вигідні цінові пропозиції</strong></p>', | |
103 | + 'why_we_line6' => '<p>Надаємо повне <strong>гарантійне обслуговування</strong></p>', | |
104 | + 'contacts' => 'Контакти', | |
105 | + 'contacts1' => 'вул. Набережно-Лугова, 4', | |
106 | + 'kyiv' => 'Київ', | |
107 | + 'partners' => 'Наші партнери', | |
108 | + 'rent_auto' => 'Оренда и прокат авто', | |
109 | + 'rent_auto1' => 'Обери <span class="border_rent">Nissan Leaf</span> <small>отримай</small> <span class="color_rent">3 дні оренди в подарунок</span>', | |
110 | + 'rent_auto2' => 'Відчуй безшумний хід, приємну їзду, легку керованість автомобіля і нашу турботу. Тільки <span>ми надаємо</span> нашим клієнтам <span>повну карту зарядних станцій</span> і детально описуємо умови доступу до різних операторів + здійснюємо повну технічну допомогу на дорозі. Тож вам не доведеться ні про що турбуватися, а тільки насолоджуватися поїздкою в звичному для вас ритмі життя', | |
111 | + 'rent_auto3' => 'Вартість прокату', | |
112 | + 'days' => 'днів', | |
113 | + 'week' => 'тиждень', | |
114 | + 'weeks' => 'Тижнів', | |
115 | + 'month' => 'Місяць', | |
116 | + 'months' => 'місяців', | |
117 | + | |
118 | + 'deposit' => 'Заставний депозит', | |
119 | + 'dontforget1' => 'Не забудьте взяти з собою', | |
120 | + 'dontforget2' => 'Паспорт', | |
121 | + 'dontforget3' => 'Ідентифікаційний код', | |
122 | + 'dontforget4' => 'Водійські права', | |
123 | + 'rent1' => 'Що входить у вартість прокату', | |
124 | + 'rent2' => 'Страхування КАСКО', | |
125 | + 'rent3' => 'Професійна технічна допомога на дорозі', | |
126 | + 'rent4' => 'Повний Комплект необхідних аксесуарів', | |
127 | + 'rent_button' => 'Забронювати', | |
128 | + 'keytokey' => 'Акція "Ключ-на-ключ"', | |
129 | + 'keytokey11' => 'Спеціальна пропозиція<br/>від <span>СЕО компанії ElectroCars</span>', | |
130 | + 'keytokey12' => 'Олександра Кравцова для тих, хто вирішив познайомитися з усіма перевагами електромобіля особисто', | |
131 | + 'keytokey2' => 'Два роки проекту ElectroCars показали, що найкращий аргумент перейти на електромобіль - дати спробувати пересісти на нього бодай на кілька днів. Після цього звичайна автівка видається минулим століттям, а всі страхи щодо наявної інфраструктури для електромобілів, проїзду на одній зарядці зникають.', | |
132 | + 'keytokey3' => 'Ми вирішили запустити проект "Ключ-на-ключ", щоб дати змогу нашим друзям спробувати електрокар, а нам згадати, що таке залишати на заправці 1000 грн :)', | |
133 | + 'keytokey4' => 'Якщо ви маєте водійський стаж не менше 2-х років, власне авто і бажання дізнатися, що означає керувати електрокаром, тоді вам потрібно просто', | |
134 | + 'submit_but1' => 'Залишити заявку', | |
135 | + 'be_friend' => 'Стати<br />нашим другом', | |
136 | + 'share_fb' => 'Поділитися вашими фото та враженнями від поїздки на своїй сторінці в ФБ.', | |
137 | + 'chose_var' => 'Обирайте оптимальний для себе варіант', | |
138 | + 'leaf_days3' => 'Leaf Вікенд / 3 дні', | |
139 | + 'leaf_days5' => 'Leaf Будні / 5 днів', | |
140 | + | |
141 | + 'models' => 'Модельний ряд Nissan Leaf', | |
142 | + 'models2' => 'Моделі Nissan Leaf в наявності', | |
143 | + | |
144 | + 'footer1' => 'Усі права захищені.', | |
145 | + 'footer2' => 'Використання матеріалів сайту можливо лише із посиланням на джерело.', | |
146 | + 'footer3' => 'Створення сайтів', | |
147 | + 'comment' => 'коментар', | |
148 | + 'send' => 'надіслати', | |
149 | + 'text_message' => 'повідомлення', | |
150 | + 'buy_but' => 'купити', | |
151 | + 'questions' => 'Залишились питання?<br/>Напишіть нам', | |
152 | + 'zapys' => 'записатись', | |
153 | + 'from' => 'з', | |
154 | + 'to' => 'по', | |
155 | + 'numdays' => 'кількість днів', | |
156 | + 'tsd_km' => 'тис. км', | |
157 | + 'Черный' => 'Чорний', | |
158 | + 'Белый' => 'Білий', | |
159 | + 'Графитовый' => 'Графітовий', | |
160 | + 'Голубой' => 'Блакитний', | |
161 | + 'Серебристый' => 'Сріблястий', | |
162 | + 'Красный' => 'Червоний', | |
163 | + 'Центральный замок, иммобилайзер, подушки безопасности (Airbag) 8 шт., ABS, ESP, электроусилитель руля, стеклоподъемники 4-ох окон, бортовой компьютер, климат-контроль, подогрев 4-ох сидений, бесключевой доступ, заводка с кнопки, подогрев руля, bluetooth, hands free, круиз-контроль, многофункциональная мультимедийная система Nissan Connect: AM/FM/CD/MP3, навигационная система, камера заднего вида, музыка BOSE, легкосплавные диски R16.' => 'Центральний замок, іммобілайзер, подушки безпеки (Airbag) 8 шт., ABS, ESP, електропідсилювач керма, склопідйомники 4-ох вікон, бортовий комп\'ютер, клімат-контроль, підігрів 4-ох сидінь, безключовий доступ, заводка з кнопки, підігрів керма, bluetooth, hands free, круїз-контроль, багатофункціональна мультимедійна система Nissan Connect: AM/FM/CD/MP3, навігаційна система, камера заднього виду, музика BOSE, легкосплавні диски R16.', | |
164 | + 'Центральный замок, иммобилайзер, подушки безопасности (Airbag) 8 шт., ABS, ESP, электроусилитель руля, стеклоподъемники 4-ох окон, бортовой компьютер, климат-контроль, подогрев 4-ох сидений, бесключевой доступ, заводка с кнопки, подогрев руля, bluetooth, hands free, камера заднего вида, круиз-контроль, многофункциональная мультимедийная система Nissan Connect: AM/FM/CD/MP3, навигационная система, камера заднего вида, легкосплавные диски R16.' => 'Центральний замок, іммобілайзер, подушки безпеки (Airbag) 8 шт., ABS, ESP, електропідсилювач керма, склопідйомники 4-ох вікон, бортовий комп\'ютер, клімат-контроль, підігрів 4-ох сидінь, безключовий доступ, заводка з кнопки, підігрів керма, bluetooth, hands free, круїз-контроль, багатофункціональна мультимедійна система Nissan Connect: AM/FM/CD/MP3, навігаційна система, камера заднього виду, легкосплавні диски R16.', | |
165 | + 'Центральный замок, иммобилайзер, подушки безопасности (Airbag) 8 шт., ABS, ESP, электроусилитель руля, стеклоподъемники 4-ох окон, бортовой компьютер, климат-контроль, подогрев 4-ох сидений, бесключевой доступ, заводка с кнопки, подогрев руля, bluetooth, hands free.' => 'Центральний замок, іммобілайзер, подушки безпеки (Airbag) 8 шт., ABS, ESP, електропідсилювач керма, склопідйомники 4-ох вікон, бортовий комп\'ютер, клімат-контроль, підігрів 4-ох сидінь, безключовий доступ, заводка з кнопки, підігрів керма, bluetooth, hands free.', | |
166 | + 'Центральный замок, иммобилайзер, подушки безопасности (Airbag) 8 шт., ABS, ESP, электроусилитель руля, стеклоподъемники 4-ох окон, бортовой компьютер, климат-контроль, подогрев 4-ох сидений, бесключевой доступ, заводка с кнопки, подогрев руля, bluetooth, hands free, камера заднего вида.' => 'Центральний замок, іммобілайзер, подушки безпеки (Airbag) 8 шт., ABS, ESP, електропідсилювач керма, склопідйомники 4-ох вікон, бортовий комп\'ютер, клімат-контроль, підігрів 4-ох сидінь, безключовий доступ, заводка з кнопки, підігрів керма, bluetooth, hands free, камера заднього виду.', | |
167 | + 'Центральный замок, иммобилайзер, 8 шт. подушек безопасности (Airbag), ABS, ESP, электроусилитель руля, стеклоподъемники 4-ох окон, бортовой компьютер, климат-контроль, подогрев 4-ох сидений, бесключевой доступ, подогрев руля, bluetooth, hands free, заводка с кнопки, камера заднего вида, порт CHADEMO.' => 'Центральний замок, іммобілайзер, подушки безпеки (Airbag) 8 шт., ABS, ESP, електропідсилювач керма, склопідйомники 4-ох вікон, бортовий комп\'ютер, клімат-контроль, підігрів 4-ох сидінь, безключовий доступ, підігрів керма, bluetooth, hands free, заводка з кнопки, камера заднього виду, порт CHADEMO.', | |
168 | + 'Камера заднего вида, порт CHADEMO' => 'Камера заднього виду, порт CHADEMO', | |
169 | +]; | |
0 | 170 | \ No newline at end of file | ... | ... |
1 | +++ a/common/translation/ua/product.php | |
1 | +<?php | |
2 | +return [ | |
3 | + 'Categories' => 'Категории', | |
4 | + 'Create Category' => 'Создать Категорию', | |
5 | + 'Name' => 'Наименование', | |
6 | + 'Remote ID' => 'ID в 1С', | |
7 | + 'Search for "{keywords}"' => 'Поиск по "{keywords}"', | |
8 | + 'Search for "{keywords}" in category "{category}"' => 'Поиск по "{keywords}" в категории "{category}"', | |
9 | + 'Promo products' => 'Акционные товары', | |
10 | + 'New products' => 'Новинки', | |
11 | + 'Top products' => 'Популярные', | |
12 | + 'Similar products' => 'Похожие товары', | |
13 | + 'Brands' => 'Бренды', | |
14 | + 'Brand' => 'Бренд', | |
15 | + 'Categories' => 'Категории', | |
16 | + 'Category' => 'Категория', | |
17 | + 'Select brand' => 'Выберите бренд', | |
18 | + 'Select category' => 'Выберите категорию', | |
19 | + 'SKU' => 'Артикул', | |
20 | + 'Stock' => 'Остаток', | |
21 | + 'Price' => 'Цена', | |
22 | + 'Price Old' => 'Старая Цена', | |
23 | + 'Products' => 'Товары', | |
24 | + 'Product' => 'Товар', | |
25 | + 'Variants' => 'Модификации', | |
26 | + 'Variant' => 'Модификация', | |
27 | + 'Create Product' => 'Создать Товар', | |
28 | + 'Enable' => 'Доступно', | |
29 | + 'Disable' => 'Отсутсвует', | |
30 | +]; | |
0 | 31 | \ No newline at end of file | ... | ... |
1 | +++ a/common/widgets/Alert.php | |
1 | +<?php | |
2 | +/** | |
3 | + * @link http://www.yiiframework.com/ | |
4 | + * @copyright Copyright (c) 2008 Yii Software LLC | |
5 | + * @license http://www.yiiframework.com/license/ | |
6 | + */ | |
7 | + | |
8 | +namespace common\widgets; | |
9 | + | |
10 | +use Yii; | |
11 | + | |
12 | +/** | |
13 | + * Alert widget renders a message from session flash. All flash messages are displayed | |
14 | + * in the sequence they were assigned using setFlash. You can set message as following: | |
15 | + * | |
16 | + * ```php | |
17 | + * Yii::$app->session->setFlash('error', 'This is the message'); | |
18 | + * Yii::$app->session->setFlash('success', 'This is the message'); | |
19 | + * Yii::$app->session->setFlash('info', 'This is the message'); | |
20 | + * ``` | |
21 | + * | |
22 | + * Multiple messages could be set as follows: | |
23 | + * | |
24 | + * ```php | |
25 | + * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); | |
26 | + * ``` | |
27 | + * | |
28 | + * @author Kartik Visweswaran <kartikv2@gmail.com> | |
29 | + * @author Alexander Makarov <sam@rmcreative.ru> | |
30 | + */ | |
31 | +class Alert extends \yii\bootstrap\Widget | |
32 | +{ | |
33 | + /** | |
34 | + * @var array the alert types configuration for the flash messages. | |
35 | + * This array is setup as $key => $value, where: | |
36 | + * - $key is the name of the session flash variable | |
37 | + * - $value is the bootstrap alert type (i.e. danger, success, info, warning) | |
38 | + */ | |
39 | + public $alertTypes = [ | |
40 | + 'error' => 'alert-danger', | |
41 | + 'danger' => 'alert-danger', | |
42 | + 'success' => 'alert-success', | |
43 | + 'info' => 'alert-info', | |
44 | + 'warning' => 'alert-warning' | |
45 | + ]; | |
46 | + /** | |
47 | + * @var array the options for rendering the close button tag. | |
48 | + */ | |
49 | + public $closeButton = []; | |
50 | + | |
51 | + | |
52 | + public function init() | |
53 | + { | |
54 | + parent::init(); | |
55 | + | |
56 | + $session = Yii::$app->session; | |
57 | + $flashes = $session->getAllFlashes(); | |
58 | + $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; | |
59 | + | |
60 | + foreach ($flashes as $type => $data) { | |
61 | + if (isset($this->alertTypes[$type])) { | |
62 | + $data = (array) $data; | |
63 | + foreach ($data as $i => $message) { | |
64 | + /* initialize css class for each alert box */ | |
65 | + $this->options['class'] = $this->alertTypes[$type] . $appendCss; | |
66 | + | |
67 | + /* assign unique id to each alert box */ | |
68 | + $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; | |
69 | + | |
70 | + echo \yii\bootstrap\Alert::widget([ | |
71 | + 'body' => $message, | |
72 | + 'closeButton' => $this->closeButton, | |
73 | + 'options' => $this->options, | |
74 | + ]); | |
75 | + } | |
76 | + | |
77 | + $session->removeFlash($type); | |
78 | + } | |
79 | + } | |
80 | + } | |
81 | +} | ... | ... |
1 | +++ a/common/widgets/Mailer.php | |
1 | +<?php | |
2 | + | |
3 | +namespace common\widgets; | |
4 | + | |
5 | +use yii\base\Widget; | |
6 | + | |
7 | +class Mailer extends Widget{ | |
8 | + public $message; | |
9 | + public $email; | |
10 | + public $text; | |
11 | + public $subject; | |
12 | + public $type; | |
13 | + public $params; | |
14 | + | |
15 | + | |
16 | + public function init(){ | |
17 | + | |
18 | + parent::init(); | |
19 | + | |
20 | + } | |
21 | + | |
22 | + public function run(){ | |
23 | + | |
24 | + $mail = new \PHPMailer(); | |
25 | + | |
26 | + $mail->IsSMTP(); | |
27 | + $mail->CharSet = 'UTF-8'; | |
28 | +// $mail->SMTPDebug = 1; | |
29 | + $mail->SMTPAuth = true; | |
30 | + $mail->SMTPSecure = 'ssl'; | |
31 | + $mail->Host = "smtp.gmail.com"; | |
32 | + $mail->Port = 465; // or 587 | |
33 | + $mail->IsHTML(true); | |
34 | + $mail->Username = "login@gmail.com"; // Google email account | |
35 | + $mail->Password = "password"; // Password to this account | |
36 | + $mail->SetFrom("leaf@electrocars.ua"); | |
37 | + $mail->isHTML(true); | |
38 | + $mail->Subject = $this->subject; | |
39 | + $mail->Body = $this->render($this->type, ['params' => $this->params]); | |
40 | + $mail->AddAddress('zhegal@gmail.com'); | |
41 | + $mail->AddAddress('pmartweb1@gmail.com'); | |
42 | + if(!$mail->Send()) { | |
43 | + echo "Mailer Error: " . $mail->ErrorInfo; | |
44 | + } else { | |
45 | + echo "Message has been sent"; | |
46 | + } | |
47 | + } | |
48 | + | |
49 | +} | |
50 | + | ... | ... |
1 | +++ a/common/widgets/views/buy.php | |
1 | +Name: <?= $params['username'] ?><br/> | |
2 | +Phone: <?= $params['phone'] ?><br/> | |
3 | +Email: <?= $params['email'] ?><br/> | |
4 | +Model: <?= $params['model_name'] ?><br/> | |
5 | +Year: <?= $params['model_color'] ?><br/> | |
6 | +Color: <?= $params['model_year'] ?> | |
0 | 7 | \ No newline at end of file | ... | ... |
1 | +++ a/composer.json | |
1 | +{ | |
2 | + "name": "yiisoft/yii2-app-advanced", | |
3 | + "description": "Yii 2 Advanced Project Template", | |
4 | + "keywords": ["yii2", "framework", "advanced", "project template"], | |
5 | + "homepage": "http://www.yiiframework.com/", | |
6 | + "type": "project", | |
7 | + "license": "BSD-3-Clause", | |
8 | + "support": { | |
9 | + "issues": "https://github.com/yiisoft/yii2/issues?state=open", | |
10 | + "forum": "http://www.yiiframework.com/forum/", | |
11 | + "wiki": "http://www.yiiframework.com/wiki/", | |
12 | + "irc": "irc://irc.freenode.net/yii", | |
13 | + "source": "https://github.com/yiisoft/yii2" | |
14 | + }, | |
15 | + "minimum-stability": "dev", | |
16 | + "require": { | |
17 | + "php": ">=5.4.0", | |
18 | + "yiisoft/yii2": ">=2.0.6", | |
19 | + "phpmailer/phpmailer": "^5.2", | |
20 | + "yiisoft/yii2-bootstrap": "*", | |
21 | + "yiisoft/yii2-jui": "~2.0.0", | |
22 | + "yiisoft/yii2-swiftmailer": "*", | |
23 | + "kartik-v/yii2-widget-fileinput": "@dev" | |
24 | + }, | |
25 | + "require-dev": { | |
26 | + "yiisoft/yii2-codeception": "*", | |
27 | + "yiisoft/yii2-debug": "*", | |
28 | + "yiisoft/yii2-gii": "*", | |
29 | + "yiisoft/yii2-faker": "*" | |
30 | + }, | |
31 | + "config": { | |
32 | + "process-timeout": 1800 | |
33 | + }, | |
34 | + "extra": { | |
35 | + "asset-installer-paths": { | |
36 | + "npm-asset-library": "vendor/npm", | |
37 | + "bower-asset-library": "vendor/bower" | |
38 | + } | |
39 | + }, | |
40 | + "scripts": { | |
41 | + "post-install-cmd": "php init --env=Development --overwrite=n" | |
42 | + } | |
43 | +} | ... | ... |
1 | +++ a/composer.lock | |
1 | +{ | |
2 | + "_readme": [ | |
3 | + "This file locks the dependencies of your project to a known state", | |
4 | + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | |
5 | + "This file is @generated automatically" | |
6 | + ], | |
7 | + "hash": "7ec2028a77e36e45dcb343058fbac059", | |
8 | + "content-hash": "b12c59124f1c9351d06c60758a6f1a3f", | |
9 | + "packages": [ | |
10 | + { | |
11 | + "name": "bower-asset/bootstrap", | |
12 | + "version": "v3.3.5", | |
13 | + "source": { | |
14 | + "type": "git", | |
15 | + "url": "https://github.com/twbs/bootstrap.git", | |
16 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" | |
17 | + }, | |
18 | + "dist": { | |
19 | + "type": "zip", | |
20 | + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", | |
21 | + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", | |
22 | + "shasum": "" | |
23 | + }, | |
24 | + "require": { | |
25 | + "bower-asset/jquery": ">=1.9.1" | |
26 | + }, | |
27 | + "type": "bower-asset-library", | |
28 | + "extra": { | |
29 | + "bower-asset-main": [ | |
30 | + "less/bootstrap.less", | |
31 | + "dist/js/bootstrap.js" | |
32 | + ], | |
33 | + "bower-asset-ignore": [ | |
34 | + "/.*", | |
35 | + "_config.yml", | |
36 | + "CNAME", | |
37 | + "composer.json", | |
38 | + "CONTRIBUTING.md", | |
39 | + "docs", | |
40 | + "js/tests", | |
41 | + "test-infra" | |
42 | + ] | |
43 | + }, | |
44 | + "license": [ | |
45 | + "MIT" | |
46 | + ], | |
47 | + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", | |
48 | + "keywords": [ | |
49 | + "css", | |
50 | + "framework", | |
51 | + "front-end", | |
52 | + "js", | |
53 | + "less", | |
54 | + "mobile-first", | |
55 | + "responsive", | |
56 | + "web" | |
57 | + ] | |
58 | + }, | |
59 | + { | |
60 | + "name": "bower-asset/jquery", | |
61 | + "version": "2.2.4", | |
62 | + "source": { | |
63 | + "type": "git", | |
64 | + "url": "https://github.com/jquery/jquery-dist.git", | |
65 | + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72" | |
66 | + }, | |
67 | + "dist": { | |
68 | + "type": "zip", | |
69 | + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72", | |
70 | + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72", | |
71 | + "shasum": "" | |
72 | + }, | |
73 | + "type": "bower-asset-library", | |
74 | + "extra": { | |
75 | + "bower-asset-main": "dist/jquery.js", | |
76 | + "bower-asset-ignore": [ | |
77 | + "package.json" | |
78 | + ] | |
79 | + }, | |
80 | + "license": [ | |
81 | + "MIT" | |
82 | + ], | |
83 | + "keywords": [ | |
84 | + "browser", | |
85 | + "javascript", | |
86 | + "jquery", | |
87 | + "library" | |
88 | + ] | |
89 | + }, | |
90 | + { | |
91 | + "name": "bower-asset/jquery-ui", | |
92 | + "version": "1.11.4", | |
93 | + "source": { | |
94 | + "type": "git", | |
95 | + "url": "https://github.com/components/jqueryui.git", | |
96 | + "reference": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1" | |
97 | + }, | |
98 | + "dist": { | |
99 | + "type": "zip", | |
100 | + "url": "https://api.github.com/repos/components/jqueryui/zipball/c34f8dbf3ba57b3784b93f26119f436c0e8288e1", | |
101 | + "reference": "c34f8dbf3ba57b3784b93f26119f436c0e8288e1", | |
102 | + "shasum": "" | |
103 | + }, | |
104 | + "require": { | |
105 | + "bower-asset/jquery": ">=1.6" | |
106 | + }, | |
107 | + "type": "bower-asset-library", | |
108 | + "extra": { | |
109 | + "bower-asset-main": [ | |
110 | + "jquery-ui.js" | |
111 | + ], | |
112 | + "bower-asset-ignore": [] | |
113 | + } | |
114 | + }, | |
115 | + { | |
116 | + "name": "bower-asset/jquery.inputmask", | |
117 | + "version": "3.2.7", | |
118 | + "source": { | |
119 | + "type": "git", | |
120 | + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", | |
121 | + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38" | |
122 | + }, | |
123 | + "dist": { | |
124 | + "type": "zip", | |
125 | + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/5a72c563b502b8e05958a524cdfffafe9987be38", | |
126 | + "reference": "5a72c563b502b8e05958a524cdfffafe9987be38", | |
127 | + "shasum": "" | |
128 | + }, | |
129 | + "require": { | |
130 | + "bower-asset/jquery": ">=1.7" | |
131 | + }, | |
132 | + "type": "bower-asset-library", | |
133 | + "extra": { | |
134 | + "bower-asset-main": [ | |
135 | + "./dist/inputmask/inputmask.js" | |
136 | + ], | |
137 | + "bower-asset-ignore": [ | |
138 | + "**/*", | |
139 | + "!dist/*", | |
140 | + "!dist/inputmask/*", | |
141 | + "!dist/min/*", | |
142 | + "!dist/min/inputmask/*", | |
143 | + "!extra/bindings/*", | |
144 | + "!extra/dependencyLibs/*", | |
145 | + "!extra/phone-codes/*" | |
146 | + ] | |
147 | + }, | |
148 | + "license": [ | |
149 | + "http://opensource.org/licenses/mit-license.php" | |
150 | + ], | |
151 | + "description": "jquery.inputmask is a jquery plugin which create an input mask.", | |
152 | + "keywords": [ | |
153 | + "form", | |
154 | + "input", | |
155 | + "inputmask", | |
156 | + "jquery", | |
157 | + "mask", | |
158 | + "plugins" | |
159 | + ] | |
160 | + }, | |
161 | + { | |
162 | + "name": "bower-asset/punycode", | |
163 | + "version": "v1.3.2", | |
164 | + "source": { | |
165 | + "type": "git", | |
166 | + "url": "https://github.com/bestiejs/punycode.js.git", | |
167 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" | |
168 | + }, | |
169 | + "dist": { | |
170 | + "type": "zip", | |
171 | + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", | |
172 | + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", | |
173 | + "shasum": "" | |
174 | + }, | |
175 | + "type": "bower-asset-library", | |
176 | + "extra": { | |
177 | + "bower-asset-main": "punycode.js", | |
178 | + "bower-asset-ignore": [ | |
179 | + "coverage", | |
180 | + "tests", | |
181 | + ".*", | |
182 | + "component.json", | |
183 | + "Gruntfile.js", | |
184 | + "node_modules", | |
185 | + "package.json" | |
186 | + ] | |
187 | + } | |
188 | + }, | |
189 | + { | |
190 | + "name": "bower-asset/yii2-pjax", | |
191 | + "version": "v2.0.6", | |
192 | + "source": { | |
193 | + "type": "git", | |
194 | + "url": "https://github.com/yiisoft/jquery-pjax.git", | |
195 | + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978" | |
196 | + }, | |
197 | + "dist": { | |
198 | + "type": "zip", | |
199 | + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/60728da6ade5879e807a49ce59ef9a72039b8978", | |
200 | + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978", | |
201 | + "shasum": "" | |
202 | + }, | |
203 | + "require": { | |
204 | + "bower-asset/jquery": ">=1.8" | |
205 | + }, | |
206 | + "type": "bower-asset-library", | |
207 | + "extra": { | |
208 | + "bower-asset-main": "./jquery.pjax.js", | |
209 | + "bower-asset-ignore": [ | |
210 | + ".travis.yml", | |
211 | + "Gemfile", | |
212 | + "Gemfile.lock", | |
213 | + "CONTRIBUTING.md", | |
214 | + "vendor/", | |
215 | + "script/", | |
216 | + "test/" | |
217 | + ] | |
218 | + }, | |
219 | + "license": [ | |
220 | + "MIT" | |
221 | + ] | |
222 | + }, | |
223 | + { | |
224 | + "name": "cebe/markdown", | |
225 | + "version": "dev-master", | |
226 | + "source": { | |
227 | + "type": "git", | |
228 | + "url": "https://github.com/cebe/markdown.git", | |
229 | + "reference": "04bfcaa26356cf86c6c4a2420eb95857a86e03ab" | |
230 | + }, | |
231 | + "dist": { | |
232 | + "type": "zip", | |
233 | + "url": "https://api.github.com/repos/cebe/markdown/zipball/04bfcaa26356cf86c6c4a2420eb95857a86e03ab", | |
234 | + "reference": "04bfcaa26356cf86c6c4a2420eb95857a86e03ab", | |
235 | + "shasum": "" | |
236 | + }, | |
237 | + "require": { | |
238 | + "lib-pcre": "*", | |
239 | + "php": ">=5.4.0" | |
240 | + }, | |
241 | + "require-dev": { | |
242 | + "cebe/indent": "*", | |
243 | + "facebook/xhprof": "*@dev", | |
244 | + "phpunit/phpunit": "4.1.*" | |
245 | + }, | |
246 | + "bin": [ | |
247 | + "bin/markdown" | |
248 | + ], | |
249 | + "type": "library", | |
250 | + "extra": { | |
251 | + "branch-alias": { | |
252 | + "dev-master": "1.1.x-dev" | |
253 | + } | |
254 | + }, | |
255 | + "autoload": { | |
256 | + "psr-4": { | |
257 | + "cebe\\markdown\\": "" | |
258 | + } | |
259 | + }, | |
260 | + "notification-url": "https://packagist.org/downloads/", | |
261 | + "license": [ | |
262 | + "MIT" | |
263 | + ], | |
264 | + "authors": [ | |
265 | + { | |
266 | + "name": "Carsten Brandt", | |
267 | + "email": "mail@cebe.cc", | |
268 | + "homepage": "http://cebe.cc/", | |
269 | + "role": "Creator" | |
270 | + } | |
271 | + ], | |
272 | + "description": "A super fast, highly extensible markdown parser for PHP", | |
273 | + "homepage": "https://github.com/cebe/markdown#readme", | |
274 | + "keywords": [ | |
275 | + "extensible", | |
276 | + "fast", | |
277 | + "gfm", | |
278 | + "markdown", | |
279 | + "markdown-extra" | |
280 | + ], | |
281 | + "time": "2016-06-20 21:09:53" | |
282 | + }, | |
283 | + { | |
284 | + "name": "ezyang/htmlpurifier", | |
285 | + "version": "v4.7.0", | |
286 | + "source": { | |
287 | + "type": "git", | |
288 | + "url": "https://github.com/ezyang/htmlpurifier.git", | |
289 | + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" | |
290 | + }, | |
291 | + "dist": { | |
292 | + "type": "zip", | |
293 | + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", | |
294 | + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", | |
295 | + "shasum": "" | |
296 | + }, | |
297 | + "require": { | |
298 | + "php": ">=5.2" | |
299 | + }, | |
300 | + "type": "library", | |
301 | + "autoload": { | |
302 | + "psr-0": { | |
303 | + "HTMLPurifier": "library/" | |
304 | + }, | |
305 | + "files": [ | |
306 | + "library/HTMLPurifier.composer.php" | |
307 | + ] | |
308 | + }, | |
309 | + "notification-url": "https://packagist.org/downloads/", | |
310 | + "license": [ | |
311 | + "LGPL" | |
312 | + ], | |
313 | + "authors": [ | |
314 | + { | |
315 | + "name": "Edward Z. Yang", | |
316 | + "email": "admin@htmlpurifier.org", | |
317 | + "homepage": "http://ezyang.com" | |
318 | + } | |
319 | + ], | |
320 | + "description": "Standards compliant HTML filter written in PHP", | |
321 | + "homepage": "http://htmlpurifier.org/", | |
322 | + "keywords": [ | |
323 | + "html" | |
324 | + ], | |
325 | + "time": "2015-08-05 01:03:42" | |
326 | + }, | |
327 | + { | |
328 | + "name": "kartik-v/bootstrap-fileinput", | |
329 | + "version": "dev-master", | |
330 | + "source": { | |
331 | + "type": "git", | |
332 | + "url": "https://github.com/kartik-v/bootstrap-fileinput.git", | |
333 | + "reference": "8dd9021a6678d176bdbcd1e7cbb8c8b4169e50e8" | |
334 | + }, | |
335 | + "dist": { | |
336 | + "type": "zip", | |
337 | + "url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/8dd9021a6678d176bdbcd1e7cbb8c8b4169e50e8", | |
338 | + "reference": "8dd9021a6678d176bdbcd1e7cbb8c8b4169e50e8", | |
339 | + "shasum": "" | |
340 | + }, | |
341 | + "type": "library", | |
342 | + "extra": { | |
343 | + "branch-alias": { | |
344 | + "dev-master": "4.3.x-dev" | |
345 | + } | |
346 | + }, | |
347 | + "autoload": { | |
348 | + "psr-4": { | |
349 | + "kartik\\plugins\\fileinput\\": "" | |
350 | + } | |
351 | + }, | |
352 | + "notification-url": "https://packagist.org/downloads/", | |
353 | + "license": [ | |
354 | + "BSD-3-Clause" | |
355 | + ], | |
356 | + "authors": [ | |
357 | + { | |
358 | + "name": "Kartik Visweswaran", | |
359 | + "email": "kartikv2@gmail.com", | |
360 | + "homepage": "http://www.krajee.com/" | |
361 | + } | |
362 | + ], | |
363 | + "description": "An enhanced HTML 5 file input for Bootstrap 3.x with features for file preview for many file types, multiple selection, ajax uploads, and more.", | |
364 | + "homepage": "https://github.com/kartik-v/bootstrap-fileinput", | |
365 | + "keywords": [ | |
366 | + "ajax", | |
367 | + "bootstrap", | |
368 | + "delete", | |
369 | + "file", | |
370 | + "image", | |
371 | + "input", | |
372 | + "jquery", | |
373 | + "multiple", | |
374 | + "preview", | |
375 | + "progress", | |
376 | + "upload" | |
377 | + ], | |
378 | + "time": "2016-07-11 09:07:59" | |
379 | + }, | |
380 | + { | |
381 | + "name": "kartik-v/yii2-krajee-base", | |
382 | + "version": "dev-master", | |
383 | + "source": { | |
384 | + "type": "git", | |
385 | + "url": "https://github.com/kartik-v/yii2-krajee-base.git", | |
386 | + "reference": "473fb568ff1144dc49bdb74f40a5d7f025fc72e4" | |
387 | + }, | |
388 | + "dist": { | |
389 | + "type": "zip", | |
390 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/473fb568ff1144dc49bdb74f40a5d7f025fc72e4", | |
391 | + "reference": "473fb568ff1144dc49bdb74f40a5d7f025fc72e4", | |
392 | + "shasum": "" | |
393 | + }, | |
394 | + "require": { | |
395 | + "yiisoft/yii2-bootstrap": "@dev" | |
396 | + }, | |
397 | + "type": "yii2-extension", | |
398 | + "extra": { | |
399 | + "branch-alias": { | |
400 | + "dev-master": "1.8.x-dev" | |
401 | + } | |
402 | + }, | |
403 | + "autoload": { | |
404 | + "psr-4": { | |
405 | + "kartik\\base\\": "" | |
406 | + } | |
407 | + }, | |
408 | + "notification-url": "https://packagist.org/downloads/", | |
409 | + "license": [ | |
410 | + "BSD-3-Clause" | |
411 | + ], | |
412 | + "authors": [ | |
413 | + { | |
414 | + "name": "Kartik Visweswaran", | |
415 | + "email": "kartikv2@gmail.com", | |
416 | + "homepage": "http://www.krajee.com/" | |
417 | + } | |
418 | + ], | |
419 | + "description": "Base library and foundation components for all Yii2 Krajee extensions.", | |
420 | + "homepage": "https://github.com/kartik-v/yii2-krajee-base", | |
421 | + "keywords": [ | |
422 | + "base", | |
423 | + "extension", | |
424 | + "foundation", | |
425 | + "krajee", | |
426 | + "widget", | |
427 | + "yii2" | |
428 | + ], | |
429 | + "time": "2016-06-02 16:20:24" | |
430 | + }, | |
431 | + { | |
432 | + "name": "kartik-v/yii2-widget-fileinput", | |
433 | + "version": "dev-master", | |
434 | + "source": { | |
435 | + "type": "git", | |
436 | + "url": "https://github.com/kartik-v/yii2-widget-fileinput.git", | |
437 | + "reference": "b0fb41e4290fc4aa35a49a977bf4484cb30f8ff9" | |
438 | + }, | |
439 | + "dist": { | |
440 | + "type": "zip", | |
441 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-fileinput/zipball/b0fb41e4290fc4aa35a49a977bf4484cb30f8ff9", | |
442 | + "reference": "b0fb41e4290fc4aa35a49a977bf4484cb30f8ff9", | |
443 | + "shasum": "" | |
444 | + }, | |
445 | + "require": { | |
446 | + "kartik-v/bootstrap-fileinput": "~4.2", | |
447 | + "kartik-v/yii2-krajee-base": "~1.7" | |
448 | + }, | |
449 | + "type": "yii2-extension", | |
450 | + "extra": { | |
451 | + "branch-alias": { | |
452 | + "dev-master": "1.0.x-dev" | |
453 | + } | |
454 | + }, | |
455 | + "autoload": { | |
456 | + "psr-4": { | |
457 | + "kartik\\file\\": "" | |
458 | + } | |
459 | + }, | |
460 | + "notification-url": "https://packagist.org/downloads/", | |
461 | + "license": [ | |
462 | + "BSD-3-Clause" | |
463 | + ], | |
464 | + "authors": [ | |
465 | + { | |
466 | + "name": "Kartik Visweswaran", | |
467 | + "email": "kartikv2@gmail.com", | |
468 | + "homepage": "http://www.krajee.com/" | |
469 | + } | |
470 | + ], | |
471 | + "description": "An enhanced FileInput widget for Bootstrap 3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)", | |
472 | + "homepage": "https://github.com/kartik-v/yii2-widget-fileinput", | |
473 | + "keywords": [ | |
474 | + "extension", | |
475 | + "file", | |
476 | + "form", | |
477 | + "input", | |
478 | + "jquery", | |
479 | + "plugin", | |
480 | + "upload", | |
481 | + "widget", | |
482 | + "yii2" | |
483 | + ], | |
484 | + "time": "2016-07-06 19:27:12" | |
485 | + }, | |
486 | + { | |
487 | + "name": "phpmailer/phpmailer", | |
488 | + "version": "v5.2.16", | |
489 | + "source": { | |
490 | + "type": "git", | |
491 | + "url": "https://github.com/PHPMailer/PHPMailer.git", | |
492 | + "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a" | |
493 | + }, | |
494 | + "dist": { | |
495 | + "type": "zip", | |
496 | + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", | |
497 | + "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", | |
498 | + "shasum": "" | |
499 | + }, | |
500 | + "require": { | |
501 | + "php": ">=5.0.0" | |
502 | + }, | |
503 | + "require-dev": { | |
504 | + "phpdocumentor/phpdocumentor": "*", | |
505 | + "phpunit/phpunit": "4.7.*" | |
506 | + }, | |
507 | + "suggest": { | |
508 | + "league/oauth2-google": "Needed for Google XOAUTH2 authentication" | |
509 | + }, | |
510 | + "type": "library", | |
511 | + "autoload": { | |
512 | + "classmap": [ | |
513 | + "class.phpmailer.php", | |
514 | + "class.phpmaileroauth.php", | |
515 | + "class.phpmaileroauthgoogle.php", | |
516 | + "class.smtp.php", | |
517 | + "class.pop3.php", | |
518 | + "extras/EasyPeasyICS.php", | |
519 | + "extras/ntlm_sasl_client.php" | |
520 | + ] | |
521 | + }, | |
522 | + "notification-url": "https://packagist.org/downloads/", | |
523 | + "license": [ | |
524 | + "LGPL-2.1" | |
525 | + ], | |
526 | + "authors": [ | |
527 | + { | |
528 | + "name": "Jim Jagielski", | |
529 | + "email": "jimjag@gmail.com" | |
530 | + }, | |
531 | + { | |
532 | + "name": "Marcus Bointon", | |
533 | + "email": "phpmailer@synchromedia.co.uk" | |
534 | + }, | |
535 | + { | |
536 | + "name": "Andy Prevost", | |
537 | + "email": "codeworxtech@users.sourceforge.net" | |
538 | + }, | |
539 | + { | |
540 | + "name": "Brent R. Matzelle" | |
541 | + } | |
542 | + ], | |
543 | + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", | |
544 | + "time": "2016-06-06 09:09:37" | |
545 | + }, | |
546 | + { | |
547 | + "name": "swiftmailer/swiftmailer", | |
548 | + "version": "5.x-dev", | |
549 | + "source": { | |
550 | + "type": "git", | |
551 | + "url": "https://github.com/swiftmailer/swiftmailer.git", | |
552 | + "reference": "17ba8f8fc03074f90771e52b226698e37bc2c115" | |
553 | + }, | |
554 | + "dist": { | |
555 | + "type": "zip", | |
556 | + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/17ba8f8fc03074f90771e52b226698e37bc2c115", | |
557 | + "reference": "17ba8f8fc03074f90771e52b226698e37bc2c115", | |
558 | + "shasum": "" | |
559 | + }, | |
560 | + "require": { | |
561 | + "php": ">=5.3.3" | |
562 | + }, | |
563 | + "require-dev": { | |
564 | + "mockery/mockery": "~0.9.1" | |
565 | + }, | |
566 | + "type": "library", | |
567 | + "extra": { | |
568 | + "branch-alias": { | |
569 | + "dev-master": "5.4-dev" | |
570 | + } | |
571 | + }, | |
572 | + "autoload": { | |
573 | + "files": [ | |
574 | + "lib/swift_required.php" | |
575 | + ] | |
576 | + }, | |
577 | + "notification-url": "https://packagist.org/downloads/", | |
578 | + "license": [ | |
579 | + "MIT" | |
580 | + ], | |
581 | + "authors": [ | |
582 | + { | |
583 | + "name": "Chris Corbyn" | |
584 | + }, | |
585 | + { | |
586 | + "name": "Fabien Potencier", | |
587 | + "email": "fabien@symfony.com" | |
588 | + } | |
589 | + ], | |
590 | + "description": "Swiftmailer, free feature-rich PHP mailer", | |
591 | + "homepage": "http://swiftmailer.org", | |
592 | + "keywords": [ | |
593 | + "email", | |
594 | + "mail", | |
595 | + "mailer" | |
596 | + ], | |
597 | + "time": "2016-07-09 18:06:48" | |
598 | + }, | |
599 | + { | |
600 | + "name": "yiisoft/yii2", | |
601 | + "version": "dev-master", | |
602 | + "source": { | |
603 | + "type": "git", | |
604 | + "url": "https://github.com/yiisoft/yii2-framework.git", | |
605 | + "reference": "8c276b391701c3b5edfebc126da4e5361cfa0f01" | |
606 | + }, | |
607 | + "dist": { | |
608 | + "type": "zip", | |
609 | + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/8c276b391701c3b5edfebc126da4e5361cfa0f01", | |
610 | + "reference": "8c276b391701c3b5edfebc126da4e5361cfa0f01", | |
611 | + "shasum": "" | |
612 | + }, | |
613 | + "require": { | |
614 | + "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", | |
615 | + "bower-asset/jquery.inputmask": "~3.2.2", | |
616 | + "bower-asset/punycode": "1.3.*", | |
617 | + "bower-asset/yii2-pjax": "~2.0.1", | |
618 | + "cebe/markdown": "~1.0.0 | ~1.1.0", | |
619 | + "ext-ctype": "*", | |
620 | + "ext-mbstring": "*", | |
621 | + "ezyang/htmlpurifier": "~4.6", | |
622 | + "lib-pcre": "*", | |
623 | + "php": ">=5.4.0", | |
624 | + "yiisoft/yii2-composer": "~2.0.4" | |
625 | + }, | |
626 | + "bin": [ | |
627 | + "yii" | |
628 | + ], | |
629 | + "type": "library", | |
630 | + "extra": { | |
631 | + "branch-alias": { | |
632 | + "dev-master": "2.0.x-dev" | |
633 | + } | |
634 | + }, | |
635 | + "autoload": { | |
636 | + "psr-4": { | |
637 | + "yii\\": "" | |
638 | + } | |
639 | + }, | |
640 | + "notification-url": "https://packagist.org/downloads/", | |
641 | + "license": [ | |
642 | + "BSD-3-Clause" | |
643 | + ], | |
644 | + "authors": [ | |
645 | + { | |
646 | + "name": "Qiang Xue", | |
647 | + "email": "qiang.xue@gmail.com", | |
648 | + "homepage": "http://www.yiiframework.com/", | |
649 | + "role": "Founder and project lead" | |
650 | + }, | |
651 | + { | |
652 | + "name": "Alexander Makarov", | |
653 | + "email": "sam@rmcreative.ru", | |
654 | + "homepage": "http://rmcreative.ru/", | |
655 | + "role": "Core framework development" | |
656 | + }, | |
657 | + { | |
658 | + "name": "Maurizio Domba", | |
659 | + "homepage": "http://mdomba.info/", | |
660 | + "role": "Core framework development" | |
661 | + }, | |
662 | + { | |
663 | + "name": "Carsten Brandt", | |
664 | + "email": "mail@cebe.cc", | |
665 | + "homepage": "http://cebe.cc/", | |
666 | + "role": "Core framework development" | |
667 | + }, | |
668 | + { | |
669 | + "name": "Timur Ruziev", | |
670 | + "email": "resurtm@gmail.com", | |
671 | + "homepage": "http://resurtm.com/", | |
672 | + "role": "Core framework development" | |
673 | + }, | |
674 | + { | |
675 | + "name": "Paul Klimov", | |
676 | + "email": "klimov.paul@gmail.com", | |
677 | + "role": "Core framework development" | |
678 | + }, | |
679 | + { | |
680 | + "name": "Dmitry Naumenko", | |
681 | + "email": "d.naumenko.a@gmail.com", | |
682 | + "role": "Core framework development" | |
683 | + } | |
684 | + ], | |
685 | + "description": "Yii PHP Framework Version 2", | |
686 | + "homepage": "http://www.yiiframework.com/", | |
687 | + "keywords": [ | |
688 | + "framework", | |
689 | + "yii2" | |
690 | + ], | |
691 | + "time": "2016-07-14 09:38:26" | |
692 | + }, | |
693 | + { | |
694 | + "name": "yiisoft/yii2-bootstrap", | |
695 | + "version": "dev-master", | |
696 | + "source": { | |
697 | + "type": "git", | |
698 | + "url": "https://github.com/yiisoft/yii2-bootstrap.git", | |
699 | + "reference": "a7a9282477c9e5f0d63c16b94652fd0fe039e79e" | |
700 | + }, | |
701 | + "dist": { | |
702 | + "type": "zip", | |
703 | + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/a7a9282477c9e5f0d63c16b94652fd0fe039e79e", | |
704 | + "reference": "a7a9282477c9e5f0d63c16b94652fd0fe039e79e", | |
705 | + "shasum": "" | |
706 | + }, | |
707 | + "require": { | |
708 | + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", | |
709 | + "yiisoft/yii2": ">=2.0.6" | |
710 | + }, | |
711 | + "type": "yii2-extension", | |
712 | + "extra": { | |
713 | + "branch-alias": { | |
714 | + "dev-master": "2.0.x-dev" | |
715 | + }, | |
716 | + "asset-installer-paths": { | |
717 | + "npm-asset-library": "vendor/npm", | |
718 | + "bower-asset-library": "vendor/bower" | |
719 | + } | |
720 | + }, | |
721 | + "autoload": { | |
722 | + "psr-4": { | |
723 | + "yii\\bootstrap\\": "" | |
724 | + } | |
725 | + }, | |
726 | + "notification-url": "https://packagist.org/downloads/", | |
727 | + "license": [ | |
728 | + "BSD-3-Clause" | |
729 | + ], | |
730 | + "authors": [ | |
731 | + { | |
732 | + "name": "Qiang Xue", | |
733 | + "email": "qiang.xue@gmail.com" | |
734 | + } | |
735 | + ], | |
736 | + "description": "The Twitter Bootstrap extension for the Yii framework", | |
737 | + "keywords": [ | |
738 | + "bootstrap", | |
739 | + "yii2" | |
740 | + ], | |
741 | + "time": "2016-07-12 10:21:49" | |
742 | + }, | |
743 | + { | |
744 | + "name": "yiisoft/yii2-composer", | |
745 | + "version": "dev-master", | |
746 | + "source": { | |
747 | + "type": "git", | |
748 | + "url": "https://github.com/yiisoft/yii2-composer.git", | |
749 | + "reference": "e882cc327a6935a41f2e8665b9ef0317f6852d4d" | |
750 | + }, | |
751 | + "dist": { | |
752 | + "type": "zip", | |
753 | + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/e882cc327a6935a41f2e8665b9ef0317f6852d4d", | |
754 | + "reference": "e882cc327a6935a41f2e8665b9ef0317f6852d4d", | |
755 | + "shasum": "" | |
756 | + }, | |
757 | + "require": { | |
758 | + "composer-plugin-api": "^1.0" | |
759 | + }, | |
760 | + "type": "composer-plugin", | |
761 | + "extra": { | |
762 | + "class": "yii\\composer\\Plugin", | |
763 | + "branch-alias": { | |
764 | + "dev-master": "2.0.x-dev" | |
765 | + } | |
766 | + }, | |
767 | + "autoload": { | |
768 | + "psr-4": { | |
769 | + "yii\\composer\\": "" | |
770 | + } | |
771 | + }, | |
772 | + "notification-url": "https://packagist.org/downloads/", | |
773 | + "license": [ | |
774 | + "BSD-3-Clause" | |
775 | + ], | |
776 | + "authors": [ | |
777 | + { | |
778 | + "name": "Qiang Xue", | |
779 | + "email": "qiang.xue@gmail.com" | |
780 | + } | |
781 | + ], | |
782 | + "description": "The composer plugin for Yii extension installer", | |
783 | + "keywords": [ | |
784 | + "composer", | |
785 | + "extension installer", | |
786 | + "yii2" | |
787 | + ], | |
788 | + "time": "2016-06-05 20:34:32" | |
789 | + }, | |
790 | + { | |
791 | + "name": "yiisoft/yii2-jui", | |
792 | + "version": "dev-master", | |
793 | + "source": { | |
794 | + "type": "git", | |
795 | + "url": "https://github.com/yiisoft/yii2-jui.git", | |
796 | + "reference": "1612593ac710975c235e75708b69fa9ee375ab46" | |
797 | + }, | |
798 | + "dist": { | |
799 | + "type": "zip", | |
800 | + "url": "https://api.github.com/repos/yiisoft/yii2-jui/zipball/1612593ac710975c235e75708b69fa9ee375ab46", | |
801 | + "reference": "1612593ac710975c235e75708b69fa9ee375ab46", | |
802 | + "shasum": "" | |
803 | + }, | |
804 | + "require": { | |
805 | + "bower-asset/jquery-ui": "1.11.*@stable", | |
806 | + "yiisoft/yii2": ">=2.0.4" | |
807 | + }, | |
808 | + "type": "yii2-extension", | |
809 | + "extra": { | |
810 | + "branch-alias": { | |
811 | + "dev-master": "2.0.x-dev" | |
812 | + }, | |
813 | + "asset-installer-paths": { | |
814 | + "npm-asset-library": "vendor/npm", | |
815 | + "bower-asset-library": "vendor/bower" | |
816 | + } | |
817 | + }, | |
818 | + "autoload": { | |
819 | + "psr-4": { | |
820 | + "yii\\jui\\": "" | |
821 | + } | |
822 | + }, | |
823 | + "notification-url": "https://packagist.org/downloads/", | |
824 | + "license": [ | |
825 | + "BSD-3-Clause" | |
826 | + ], | |
827 | + "authors": [ | |
828 | + { | |
829 | + "name": "Qiang Xue", | |
830 | + "email": "qiang.xue@gmail.com" | |
831 | + } | |
832 | + ], | |
833 | + "description": "The Jquery UI extension for the Yii framework", | |
834 | + "keywords": [ | |
835 | + "jQuery UI", | |
836 | + "yii2" | |
837 | + ], | |
838 | + "time": "2016-06-11 22:54:20" | |
839 | + }, | |
840 | + { | |
841 | + "name": "yiisoft/yii2-swiftmailer", | |
842 | + "version": "dev-master", | |
843 | + "source": { | |
844 | + "type": "git", | |
845 | + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", | |
846 | + "reference": "163b9c6273e133c43a596aef46a9f5b1537731f9" | |
847 | + }, | |
848 | + "dist": { | |
849 | + "type": "zip", | |
850 | + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/163b9c6273e133c43a596aef46a9f5b1537731f9", | |
851 | + "reference": "163b9c6273e133c43a596aef46a9f5b1537731f9", | |
852 | + "shasum": "" | |
853 | + }, | |
854 | + "require": { | |
855 | + "swiftmailer/swiftmailer": "~5.0", | |
856 | + "yiisoft/yii2": ">=2.0.4" | |
857 | + }, | |
858 | + "type": "yii2-extension", | |
859 | + "extra": { | |
860 | + "branch-alias": { | |
861 | + "dev-master": "2.0.x-dev" | |
862 | + } | |
863 | + }, | |
864 | + "autoload": { | |
865 | + "psr-4": { | |
866 | + "yii\\swiftmailer\\": "" | |
867 | + } | |
868 | + }, | |
869 | + "notification-url": "https://packagist.org/downloads/", | |
870 | + "license": [ | |
871 | + "BSD-3-Clause" | |
872 | + ], | |
873 | + "authors": [ | |
874 | + { | |
875 | + "name": "Paul Klimov", | |
876 | + "email": "klimov.paul@gmail.com" | |
877 | + } | |
878 | + ], | |
879 | + "description": "The SwiftMailer integration for the Yii framework", | |
880 | + "keywords": [ | |
881 | + "email", | |
882 | + "mail", | |
883 | + "mailer", | |
884 | + "swift", | |
885 | + "swiftmailer", | |
886 | + "yii2" | |
887 | + ], | |
888 | + "time": "2016-04-14 08:50:13" | |
889 | + } | |
890 | + ], | |
891 | + "packages-dev": [ | |
892 | + { | |
893 | + "name": "bower-asset/typeahead.js", | |
894 | + "version": "v0.11.1", | |
895 | + "source": { | |
896 | + "type": "git", | |
897 | + "url": "https://github.com/twitter/typeahead.js.git", | |
898 | + "reference": "588440f66559714280628a4f9799f0c4eb880a4a" | |
899 | + }, | |
900 | + "dist": { | |
901 | + "type": "zip", | |
902 | + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/588440f66559714280628a4f9799f0c4eb880a4a", | |
903 | + "reference": "588440f66559714280628a4f9799f0c4eb880a4a", | |
904 | + "shasum": "" | |
905 | + }, | |
906 | + "require": { | |
907 | + "bower-asset/jquery": ">=1.7" | |
908 | + }, | |
909 | + "require-dev": { | |
910 | + "bower-asset/jasmine-ajax": "~1.3.1", | |
911 | + "bower-asset/jasmine-jquery": "~1.5.2", | |
912 | + "bower-asset/jquery": "~1.7" | |
913 | + }, | |
914 | + "type": "bower-asset-library", | |
915 | + "extra": { | |
916 | + "bower-asset-main": "dist/typeahead.bundle.js" | |
917 | + } | |
918 | + }, | |
919 | + { | |
920 | + "name": "fzaninotto/faker", | |
921 | + "version": "dev-master", | |
922 | + "source": { | |
923 | + "type": "git", | |
924 | + "url": "https://github.com/fzaninotto/Faker.git", | |
925 | + "reference": "039eeba8a61788df89c7800eccb2c56723a0db34" | |
926 | + }, | |
927 | + "dist": { | |
928 | + "type": "zip", | |
929 | + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/039eeba8a61788df89c7800eccb2c56723a0db34", | |
930 | + "reference": "039eeba8a61788df89c7800eccb2c56723a0db34", | |
931 | + "shasum": "" | |
932 | + }, | |
933 | + "require": { | |
934 | + "php": "^5.3.3|^7.0" | |
935 | + }, | |
936 | + "require-dev": { | |
937 | + "ext-intl": "*", | |
938 | + "phpunit/phpunit": "~4.0", | |
939 | + "squizlabs/php_codesniffer": "~1.5" | |
940 | + }, | |
941 | + "type": "library", | |
942 | + "extra": { | |
943 | + "branch-alias": { | |
944 | + "dev-master": "1.6.x-dev" | |
945 | + } | |
946 | + }, | |
947 | + "autoload": { | |
948 | + "psr-4": { | |
949 | + "Faker\\": "src/Faker/" | |
950 | + } | |
951 | + }, | |
952 | + "notification-url": "https://packagist.org/downloads/", | |
953 | + "license": [ | |
954 | + "MIT" | |
955 | + ], | |
956 | + "authors": [ | |
957 | + { | |
958 | + "name": "François Zaninotto" | |
959 | + } | |
960 | + ], | |
961 | + "description": "Faker is a PHP library that generates fake data for you.", | |
962 | + "keywords": [ | |
963 | + "data", | |
964 | + "faker", | |
965 | + "fixtures" | |
966 | + ], | |
967 | + "time": "2016-07-11 08:36:05" | |
968 | + }, | |
969 | + { | |
970 | + "name": "phpspec/php-diff", | |
971 | + "version": "dev-master", | |
972 | + "source": { | |
973 | + "type": "git", | |
974 | + "url": "https://github.com/phpspec/php-diff.git", | |
975 | + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" | |
976 | + }, | |
977 | + "dist": { | |
978 | + "type": "zip", | |
979 | + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", | |
980 | + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", | |
981 | + "shasum": "" | |
982 | + }, | |
983 | + "type": "library", | |
984 | + "extra": { | |
985 | + "branch-alias": { | |
986 | + "dev-master": "1.0.x-dev" | |
987 | + } | |
988 | + }, | |
989 | + "autoload": { | |
990 | + "psr-0": { | |
991 | + "Diff": "lib/" | |
992 | + } | |
993 | + }, | |
994 | + "notification-url": "https://packagist.org/downloads/", | |
995 | + "license": [ | |
996 | + "BSD-3-Clause" | |
997 | + ], | |
998 | + "authors": [ | |
999 | + { | |
1000 | + "name": "Chris Boulton", | |
1001 | + "homepage": "http://github.com/chrisboulton" | |
1002 | + } | |
1003 | + ], | |
1004 | + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", | |
1005 | + "time": "2016-04-07 12:29:16" | |
1006 | + }, | |
1007 | + { | |
1008 | + "name": "yiisoft/yii2-codeception", | |
1009 | + "version": "dev-master", | |
1010 | + "source": { | |
1011 | + "type": "git", | |
1012 | + "url": "https://github.com/yiisoft/yii2-codeception.git", | |
1013 | + "reference": "572a6d46d942cc5733c45931fdbd1d60228f3c89" | |
1014 | + }, | |
1015 | + "dist": { | |
1016 | + "type": "zip", | |
1017 | + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/572a6d46d942cc5733c45931fdbd1d60228f3c89", | |
1018 | + "reference": "572a6d46d942cc5733c45931fdbd1d60228f3c89", | |
1019 | + "shasum": "" | |
1020 | + }, | |
1021 | + "require": { | |
1022 | + "yiisoft/yii2": ">=2.0.4" | |
1023 | + }, | |
1024 | + "type": "yii2-extension", | |
1025 | + "extra": { | |
1026 | + "branch-alias": { | |
1027 | + "dev-master": "2.0.x-dev" | |
1028 | + } | |
1029 | + }, | |
1030 | + "autoload": { | |
1031 | + "psr-4": { | |
1032 | + "yii\\codeception\\": "" | |
1033 | + } | |
1034 | + }, | |
1035 | + "notification-url": "https://packagist.org/downloads/", | |
1036 | + "license": [ | |
1037 | + "BSD-3-Clause" | |
1038 | + ], | |
1039 | + "authors": [ | |
1040 | + { | |
1041 | + "name": "Mark Jebri", | |
1042 | + "email": "mark.github@yandex.ru" | |
1043 | + } | |
1044 | + ], | |
1045 | + "description": "The Codeception integration for the Yii framework", | |
1046 | + "keywords": [ | |
1047 | + "codeception", | |
1048 | + "yii2" | |
1049 | + ], | |
1050 | + "time": "2016-04-14 08:46:27" | |
1051 | + }, | |
1052 | + { | |
1053 | + "name": "yiisoft/yii2-debug", | |
1054 | + "version": "dev-master", | |
1055 | + "source": { | |
1056 | + "type": "git", | |
1057 | + "url": "https://github.com/yiisoft/yii2-debug.git", | |
1058 | + "reference": "07ad6f410eb60c57345e4c687e53b097c40b4a6c" | |
1059 | + }, | |
1060 | + "dist": { | |
1061 | + "type": "zip", | |
1062 | + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/07ad6f410eb60c57345e4c687e53b097c40b4a6c", | |
1063 | + "reference": "07ad6f410eb60c57345e4c687e53b097c40b4a6c", | |
1064 | + "shasum": "" | |
1065 | + }, | |
1066 | + "require": { | |
1067 | + "yiisoft/yii2": ">=2.0.4", | |
1068 | + "yiisoft/yii2-bootstrap": "*" | |
1069 | + }, | |
1070 | + "type": "yii2-extension", | |
1071 | + "extra": { | |
1072 | + "branch-alias": { | |
1073 | + "dev-master": "2.0.x-dev" | |
1074 | + } | |
1075 | + }, | |
1076 | + "autoload": { | |
1077 | + "psr-4": { | |
1078 | + "yii\\debug\\": "" | |
1079 | + } | |
1080 | + }, | |
1081 | + "notification-url": "https://packagist.org/downloads/", | |
1082 | + "license": [ | |
1083 | + "BSD-3-Clause" | |
1084 | + ], | |
1085 | + "authors": [ | |
1086 | + { | |
1087 | + "name": "Qiang Xue", | |
1088 | + "email": "qiang.xue@gmail.com" | |
1089 | + } | |
1090 | + ], | |
1091 | + "description": "The debugger extension for the Yii framework", | |
1092 | + "keywords": [ | |
1093 | + "debug", | |
1094 | + "debugger", | |
1095 | + "yii2" | |
1096 | + ], | |
1097 | + "time": "2016-06-06 19:17:49" | |
1098 | + }, | |
1099 | + { | |
1100 | + "name": "yiisoft/yii2-faker", | |
1101 | + "version": "dev-master", | |
1102 | + "source": { | |
1103 | + "type": "git", | |
1104 | + "url": "https://github.com/yiisoft/yii2-faker.git", | |
1105 | + "reference": "6e6eb430809e3f9c05e367303909a05a4912d4c0" | |
1106 | + }, | |
1107 | + "dist": { | |
1108 | + "type": "zip", | |
1109 | + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/6e6eb430809e3f9c05e367303909a05a4912d4c0", | |
1110 | + "reference": "6e6eb430809e3f9c05e367303909a05a4912d4c0", | |
1111 | + "shasum": "" | |
1112 | + }, | |
1113 | + "require": { | |
1114 | + "fzaninotto/faker": "~1.4", | |
1115 | + "yiisoft/yii2": "*" | |
1116 | + }, | |
1117 | + "type": "yii2-extension", | |
1118 | + "extra": { | |
1119 | + "branch-alias": { | |
1120 | + "dev-master": "2.0.x-dev" | |
1121 | + } | |
1122 | + }, | |
1123 | + "autoload": { | |
1124 | + "psr-4": { | |
1125 | + "yii\\faker\\": "" | |
1126 | + } | |
1127 | + }, | |
1128 | + "notification-url": "https://packagist.org/downloads/", | |
1129 | + "license": [ | |
1130 | + "BSD-3-Clause" | |
1131 | + ], | |
1132 | + "authors": [ | |
1133 | + { | |
1134 | + "name": "Mark Jebri", | |
1135 | + "email": "mark.github@yandex.ru" | |
1136 | + } | |
1137 | + ], | |
1138 | + "description": "Fixture generator. The Faker integration for the Yii framework.", | |
1139 | + "keywords": [ | |
1140 | + "Fixture", | |
1141 | + "faker", | |
1142 | + "yii2" | |
1143 | + ], | |
1144 | + "time": "2016-04-14 08:47:34" | |
1145 | + }, | |
1146 | + { | |
1147 | + "name": "yiisoft/yii2-gii", | |
1148 | + "version": "dev-master", | |
1149 | + "source": { | |
1150 | + "type": "git", | |
1151 | + "url": "https://github.com/yiisoft/yii2-gii.git", | |
1152 | + "reference": "4f7bece043b6e60571ad855cd937bf0e07e1891d" | |
1153 | + }, | |
1154 | + "dist": { | |
1155 | + "type": "zip", | |
1156 | + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/4f7bece043b6e60571ad855cd937bf0e07e1891d", | |
1157 | + "reference": "4f7bece043b6e60571ad855cd937bf0e07e1891d", | |
1158 | + "shasum": "" | |
1159 | + }, | |
1160 | + "require": { | |
1161 | + "bower-asset/typeahead.js": "0.10.* | ~0.11.0", | |
1162 | + "phpspec/php-diff": ">=1.0.2", | |
1163 | + "yiisoft/yii2": ">=2.0.4", | |
1164 | + "yiisoft/yii2-bootstrap": "~2.0" | |
1165 | + }, | |
1166 | + "type": "yii2-extension", | |
1167 | + "extra": { | |
1168 | + "branch-alias": { | |
1169 | + "dev-master": "2.0.x-dev" | |
1170 | + }, | |
1171 | + "asset-installer-paths": { | |
1172 | + "npm-asset-library": "vendor/npm", | |
1173 | + "bower-asset-library": "vendor/bower" | |
1174 | + } | |
1175 | + }, | |
1176 | + "autoload": { | |
1177 | + "psr-4": { | |
1178 | + "yii\\gii\\": "" | |
1179 | + } | |
1180 | + }, | |
1181 | + "notification-url": "https://packagist.org/downloads/", | |
1182 | + "license": [ | |
1183 | + "BSD-3-Clause" | |
1184 | + ], | |
1185 | + "authors": [ | |
1186 | + { | |
1187 | + "name": "Qiang Xue", | |
1188 | + "email": "qiang.xue@gmail.com" | |
1189 | + } | |
1190 | + ], | |
1191 | + "description": "The Gii extension for the Yii framework", | |
1192 | + "keywords": [ | |
1193 | + "code generator", | |
1194 | + "gii", | |
1195 | + "yii2" | |
1196 | + ], | |
1197 | + "time": "2016-07-07 16:09:06" | |
1198 | + } | |
1199 | + ], | |
1200 | + "aliases": [], | |
1201 | + "minimum-stability": "dev", | |
1202 | + "stability-flags": { | |
1203 | + "kartik-v/yii2-widget-fileinput": 20 | |
1204 | + }, | |
1205 | + "prefer-stable": false, | |
1206 | + "prefer-lowest": false, | |
1207 | + "platform": { | |
1208 | + "php": ">=5.4.0" | |
1209 | + }, | |
1210 | + "platform-dev": [] | |
1211 | +} | ... | ... |
1 | +++ a/console/config/main.php | |
1 | +<?php | |
2 | +$params = array_merge( | |
3 | + require(__DIR__ . '/../../common/config/params.php'), | |
4 | + require(__DIR__ . '/../../common/config/params-local.php'), | |
5 | + require(__DIR__ . '/params.php'), | |
6 | + require(__DIR__ . '/params-local.php') | |
7 | +); | |
8 | + | |
9 | +return [ | |
10 | + 'id' => 'app-console', | |
11 | + 'basePath' => dirname(__DIR__), | |
12 | + 'bootstrap' => ['log'], | |
13 | + 'controllerNamespace' => 'console\controllers', | |
14 | + 'components' => [ | |
15 | + 'log' => [ | |
16 | + 'targets' => [ | |
17 | + [ | |
18 | + 'class' => 'yii\log\FileTarget', | |
19 | + 'levels' => ['error', 'warning'], | |
20 | + ], | |
21 | + ], | |
22 | + ], | |
23 | + ], | |
24 | + 'params' => $params, | |
25 | +]; | ... | ... |
1 | +++ a/console/controllers/.gitkeep | ... | ... |
1 | +++ a/console/migrations/m130524_201442_init.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m130524_201442_init extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $tableOptions = null; | |
10 | + if ($this->db->driverName === 'mysql') { | |
11 | + // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci | |
12 | + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; | |
13 | + } | |
14 | + | |
15 | + $this->createTable('{{%user}}', [ | |
16 | + 'id' => $this->primaryKey(), | |
17 | + 'username' => $this->string()->notNull()->unique(), | |
18 | + 'auth_key' => $this->string(32)->notNull(), | |
19 | + 'password_hash' => $this->string()->notNull(), | |
20 | + 'password_reset_token' => $this->string()->unique(), | |
21 | + 'email' => $this->string()->notNull()->unique(), | |
22 | + | |
23 | + 'status' => $this->smallInteger()->notNull()->defaultValue(10), | |
24 | + 'created_at' => $this->integer()->notNull(), | |
25 | + 'updated_at' => $this->integer()->notNull(), | |
26 | + ], $tableOptions); | |
27 | + } | |
28 | + | |
29 | + public function down() | |
30 | + { | |
31 | + $this->dropTable('{{%user}}'); | |
32 | + } | |
33 | +} | ... | ... |
1 | +++ a/console/migrations/m160714_124817_create_car.php | |
1 | +<?php | |
2 | + | |
3 | + use yii\db\Migration; | |
4 | + | |
5 | + class m160714_124817_create_car extends Migration | |
6 | + { | |
7 | + | |
8 | + public function up() | |
9 | + { | |
10 | + $this->createTable('car', [ | |
11 | + 'car_id' => $this->primaryKey(), | |
12 | + 'model' => $this->string() | |
13 | + ->notNull(), | |
14 | + 'year' => $this->integer() | |
15 | + ->notNull(), | |
16 | + 'image' => $this->string(), | |
17 | + 'color' => $this->string(), | |
18 | + 'mileage' => $this->float(), | |
19 | + 'build' => $this->integer(), | |
20 | + 'option' => $this->text(), | |
21 | + 'price' => $this->float(), | |
22 | + ]); | |
23 | + } | |
24 | + | |
25 | + public function down() | |
26 | + { | |
27 | + $this->dropTable('car'); | |
28 | + } | |
29 | + } | ... | ... |
console/migrations/m160714_132243_change_build_format.php
0 → 100755
1 | +++ a/console/migrations/m160714_132243_change_build_format.php | |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m160714_132243_change_build_format extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + $this->alterColumn('car', 'build', $this->string()); | |
10 | + } | |
11 | + | |
12 | + public function down() | |
13 | + { | |
14 | + $this->alterColumn('car', 'build', $this->integer()); | |
15 | + } | |
16 | +} | ... | ... |
1 | +++ a/environments/dev/backend/config/main-local.php | |
1 | +<?php | |
2 | + | |
3 | +$config = [ | |
4 | + 'components' => [ | |
5 | + 'request' => [ | |
6 | + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation | |
7 | + 'cookieValidationKey' => '', | |
8 | + ], | |
9 | + ], | |
10 | +]; | |
11 | + | |
12 | +if (!YII_ENV_TEST) { | |
13 | + // configuration adjustments for 'dev' environment | |
14 | + $config['bootstrap'][] = 'debug'; | |
15 | + $config['modules']['debug'] = [ | |
16 | + 'class' => 'yii\debug\Module', | |
17 | + ]; | |
18 | + | |
19 | + $config['bootstrap'][] = 'gii'; | |
20 | + $config['modules']['gii'] = [ | |
21 | + 'class' => 'yii\gii\Module', | |
22 | + ]; | |
23 | +} | |
24 | + | |
25 | +return $config; | ... | ... |
1 | +++ a/environments/dev/backend/web/index-test.php | |
1 | +<?php | |
2 | + | |
3 | +// NOTE: Make sure this file is not accessible when deployed to production | |
4 | +if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { | |
5 | + die('You are not allowed to access this file.'); | |
6 | +} | |
7 | + | |
8 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | |
9 | +defined('YII_ENV') or define('YII_ENV', 'test'); | |
10 | + | |
11 | +require(__DIR__ . '/../../vendor/autoload.php'); | |
12 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | |
13 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | |
14 | +require(__DIR__ . '/../config/bootstrap.php'); | |
15 | + | |
16 | + | |
17 | +$config = require(__DIR__ . '/../../tests/codeception/config/backend/acceptance.php'); | |
18 | + | |
19 | +(new yii\web\Application($config))->run(); | ... | ... |
1 | +++ a/environments/dev/backend/web/index.php | |
1 | +<?php | |
2 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | |
3 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | |
4 | + | |
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | |
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | |
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | |
8 | +require(__DIR__ . '/../config/bootstrap.php'); | |
9 | + | |
10 | +$config = yii\helpers\ArrayHelper::merge( | |
11 | + require(__DIR__ . '/../../common/config/main.php'), | |
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | |
13 | + require(__DIR__ . '/../config/main.php'), | |
14 | + require(__DIR__ . '/../config/main-local.php') | |
15 | +); | |
16 | + | |
17 | +$application = new yii\web\Application($config); | |
18 | +$application->run(); | ... | ... |
1 | +++ a/environments/dev/common/config/main-local.php | |
1 | +<?php | |
2 | +return [ | |
3 | + 'components' => [ | |
4 | + 'db' => [ | |
5 | + 'class' => 'yii\db\Connection', | |
6 | + 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', | |
7 | + 'username' => 'root', | |
8 | + 'password' => '', | |
9 | + 'charset' => 'utf8', | |
10 | + ], | |
11 | + 'mailer' => [ | |
12 | + 'class' => 'yii\swiftmailer\Mailer', | |
13 | + 'viewPath' => '@common/mail', | |
14 | + // send all mails to a file by default. You have to set | |
15 | + // 'useFileTransport' to false and configure a transport | |
16 | + // for the mailer to send real emails. | |
17 | + 'useFileTransport' => true, | |
18 | + ], | |
19 | + ], | |
20 | +]; | ... | ... |
1 | +++ a/environments/dev/frontend/config/main-local.php | |
1 | +<?php | |
2 | + | |
3 | +$config = [ | |
4 | + 'components' => [ | |
5 | + 'request' => [ | |
6 | + // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation | |
7 | + 'cookieValidationKey' => '', | |
8 | + ], | |
9 | + ], | |
10 | +]; | |
11 | + | |
12 | +if (!YII_ENV_TEST) { | |
13 | + // configuration adjustments for 'dev' environment | |
14 | + $config['bootstrap'][] = 'debug'; | |
15 | + $config['modules']['debug'] = [ | |
16 | + 'class' => 'yii\debug\Module', | |
17 | + ]; | |
18 | + $config['bootstrap'][] = 'gii'; | |
19 | + $config['modules']['gii'] = [ | |
20 | + 'class' => 'yii\gii\Module', | |
21 | + ]; | |
22 | +} | |
23 | + | |
24 | +return $config; | ... | ... |
1 | +++ a/environments/dev/frontend/web/index-test.php | |
1 | +<?php | |
2 | + | |
3 | +// NOTE: Make sure this file is not accessible when deployed to production | |
4 | +if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) { | |
5 | + die('You are not allowed to access this file.'); | |
6 | +} | |
7 | + | |
8 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | |
9 | +defined('YII_ENV') or define('YII_ENV', 'test'); | |
10 | + | |
11 | +require(__DIR__ . '/../../vendor/autoload.php'); | |
12 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | |
13 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | |
14 | +require(__DIR__ . '/../config/bootstrap.php'); | |
15 | + | |
16 | +$config = require(__DIR__ . '/../../tests/codeception/config/frontend/acceptance.php'); | |
17 | + | |
18 | +(new yii\web\Application($config))->run(); | ... | ... |
1 | +++ a/environments/dev/frontend/web/index.php | |
1 | +<?php | |
2 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | |
3 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | |
4 | + | |
5 | +require(__DIR__ . '/../../vendor/autoload.php'); | |
6 | +require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); | |
7 | +require(__DIR__ . '/../../common/config/bootstrap.php'); | |
8 | +require(__DIR__ . '/../config/bootstrap.php'); | |
9 | + | |
10 | +$config = yii\helpers\ArrayHelper::merge( | |
11 | + require(__DIR__ . '/../../common/config/main.php'), | |
12 | + require(__DIR__ . '/../../common/config/main-local.php'), | |
13 | + require(__DIR__ . '/../config/main.php'), | |
14 | + require(__DIR__ . '/../config/main-local.php') | |
15 | +); | |
16 | + | |
17 | +$application = new yii\web\Application($config); | |
18 | +$application->run(); | ... | ... |
environments/dev/tests/codeception/config/config-local.php
0 → 100755
1 | +++ a/environments/dev/yii | |
1 | +#!/usr/bin/env php | |
2 | +<?php | |
3 | +/** | |
4 | + * Yii console bootstrap file. | |
5 | + * | |
6 | + * @link http://www.yiiframework.com/ | |
7 | + * @copyright Copyright (c) 2008 Yii Software LLC | |
8 | + * @license http://www.yiiframework.com/license/ | |
9 | + */ | |
10 | + | |
11 | +defined('YII_DEBUG') or define('YII_DEBUG', true); | |
12 | +defined('YII_ENV') or define('YII_ENV', 'dev'); | |
13 | + | |
14 | +require(__DIR__ . '/vendor/autoload.php'); | |
15 | +require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); | |
16 | +require(__DIR__ . '/common/config/bootstrap.php'); | |
17 | +require(__DIR__ . '/console/config/bootstrap.php'); | |
18 | + | |
19 | +$config = yii\helpers\ArrayHelper::merge( | |
20 | + require(__DIR__ . '/common/config/main.php'), | |
21 | + require(__DIR__ . '/common/config/main-local.php'), | |
22 | + require(__DIR__ . '/console/config/main.php'), | |
23 | + require(__DIR__ . '/console/config/main-local.php') | |
24 | +); | |
25 | + | |
26 | +$application = new yii\console\Application($config); | |
27 | +$exitCode = $application->run(); | |
28 | +exit($exitCode); | ... | ... |
1 | +++ a/environments/index.php | |
1 | +<?php | |
2 | +/** | |
3 | + * The manifest of files that are local to specific environment. | |
4 | + * This file returns a list of environments that the application | |
5 | + * may be installed under. The returned data must be in the following | |
6 | + * format: | |
7 | + * | |
8 | + * ```php | |
9 | + * return [ | |
10 | + * 'environment name' => [ | |
11 | + * 'path' => 'directory storing the local files', | |
12 | + * 'skipFiles' => [ | |
13 | + * // list of files that should only copied once and skipped if they already exist | |
14 | + * ], | |
15 | + * 'setWritable' => [ | |
16 | + * // list of directories that should be set writable | |
17 | + * ], | |
18 | + * 'setExecutable' => [ | |
19 | + * // list of files that should be set executable | |
20 | + * ], | |
21 | + * 'setCookieValidationKey' => [ | |
22 | + * // list of config files that need to be inserted with automatically generated cookie validation keys | |
23 | + * ], | |
24 | + * 'createSymlink' => [ | |
25 | + * // list of symlinks to be created. Keys are symlinks, and values are the targets. | |
26 | + * ], | |
27 | + * ], | |
28 | + * ]; | |
29 | + * ``` | |
30 | + */ | |
31 | +return [ | |
32 | + 'Development' => [ | |
33 | + 'path' => 'dev', | |
34 | + 'setWritable' => [ | |
35 | + 'backend/runtime', | |
36 | + 'backend/web/assets', | |
37 | + 'frontend/runtime', | |
38 | + 'frontend/web/assets', | |
39 | + ], | |
40 | + 'setExecutable' => [ | |
41 | + 'yii', | |
42 | + 'tests/codeception/bin/yii', | |
43 | + ], | |
44 | + 'setCookieValidationKey' => [ | |
45 | + 'backend/config/main-local.php', | |
46 | + 'frontend/config/main-local.php', | |
47 | + ], | |
48 | + ], | |
49 | + 'Production' => [ | |
50 | + 'path' => 'prod', | |
51 | + 'setWritable' => [ | |
52 | + 'backend/runtime', | |
53 | + 'backend/web/assets', | |
54 | + 'frontend/runtime', | |
55 | + 'frontend/web/assets', | |
56 | + ], | |
57 | + 'setExecutable' => [ | |
58 | + 'yii', | |
59 | + ], | |
60 | + 'setCookieValidationKey' => [ | |
61 | + 'backend/config/main-local.php', | |
62 | + 'frontend/config/main-local.php', | |
63 | + ], | |
64 | + ], | |
65 | +]; | ... | ... |