Commit 09796a79de9ebf8898b423ffe836d27a9aec6fb3
Merge remote-tracking branch 'origin/master'
Showing
8 changed files
with
255 additions
and
25 deletions
Show diff stats
1 | +<?php | |
2 | + /** | |
3 | + * Created by PhpStorm. | |
4 | + * User: stes | |
5 | + * Date: 12.09.18 | |
6 | + * Time: 16:39 | |
7 | + */ | |
8 | + | |
9 | + namespace backend\controllers; | |
10 | + | |
11 | + use artbox\core\admin\actions\Delete; | |
12 | + use artbox\core\admin\actions\Index; | |
13 | + use artbox\core\admin\actions\View; | |
14 | + use artbox\core\admin\interfaces\ControllerInterface; | |
15 | + use backend\actions\Create; | |
16 | + use backend\actions\Update; | |
17 | + use backend\widgets\Form; | |
18 | + use common\models\Logo; | |
19 | + use yii\filters\AccessControl; | |
20 | + use yii\filters\VerbFilter; | |
21 | + use yii\web\Controller; | |
22 | + use yii\web\NotFoundHttpException; | |
23 | + | |
24 | + class LogoController extends Controller implements ControllerInterface | |
25 | + { | |
26 | + public function behaviors() | |
27 | + { | |
28 | + return [ | |
29 | + 'verbs' => [ | |
30 | + 'class' => VerbFilter::className(), | |
31 | + 'actions' => [ | |
32 | + 'delete' => [ 'POST' ], | |
33 | + ], | |
34 | + ], | |
35 | + 'access' => [ | |
36 | + 'class' => AccessControl::className(), | |
37 | + 'rules' => [ | |
38 | + [ | |
39 | + 'allow' => true, | |
40 | + 'roles' => [ '@' ], | |
41 | + ], | |
42 | + ], | |
43 | + ], | |
44 | + ]; | |
45 | + } | |
46 | + public function actions() | |
47 | + { | |
48 | + return [ | |
49 | + 'index' => [ | |
50 | + 'class' => Index::className(), | |
51 | + 'columns' => [ | |
52 | + 'link' => [ | |
53 | + 'type' => Index::ACTION_COL, | |
54 | + ], | |
55 | + 'sort' => [ | |
56 | + 'type' => Index::POSITION_COL, | |
57 | + ], | |
58 | + ], | |
59 | + 'model' => Logo::className(), | |
60 | + 'hasLanguage' => false, | |
61 | + 'enableMassDelete' => true, | |
62 | + 'modelPrimaryKey' => 'id', | |
63 | + ], | |
64 | + 'create' => array_merge([ 'class' => Create::className() ], self::fieldsConfig()), | |
65 | + 'update' => array_merge([ 'class' => Update::className() ], self::fieldsConfig()), | |
66 | + 'view' => [ | |
67 | + 'class' => View::className(), | |
68 | + 'model' => Logo::className(), | |
69 | + 'hasAlias' => true, | |
70 | + 'hasGallery' => true, | |
71 | + 'fields' => [ | |
72 | + [ | |
73 | + 'name' => 'image_id', | |
74 | + 'type' => Form::IMAGE, | |
75 | + ], | |
76 | + ], | |
77 | + ], | |
78 | + 'delete' => [ | |
79 | + 'class' => Delete::className(), | |
80 | + ], | |
81 | + ]; | |
82 | + } | |
83 | + | |
84 | + public function findModel($id) | |
85 | + { | |
86 | + $model = Logo::find() | |
87 | + ->where([ 'id' => $id ]) | |
88 | + ->one(); | |
89 | + if ($model !== null) { | |
90 | + return $model; | |
91 | + } else { | |
92 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
93 | + } | |
94 | + } | |
95 | + | |
96 | + public function newModel() | |
97 | + { | |
98 | + return new Logo(); | |
99 | + } | |
100 | + | |
101 | + public function deleteModel($id) | |
102 | + { | |
103 | + $page = Logo::find() | |
104 | + ->where( | |
105 | + [ | |
106 | + 'id' => $id, | |
107 | + ] | |
108 | + ) | |
109 | + ->one(); | |
110 | + | |
111 | + return $page->delete(); | |
112 | + } | |
113 | + | |
114 | + protected static function fieldsConfig() | |
115 | + { | |
116 | + return [ | |
117 | + 'model' => Logo::className(), | |
118 | + 'hasAlias' => false, | |
119 | + 'hasGallery' => false, | |
120 | + 'languageFields' => [ | |
121 | + ], | |
122 | + 'fields' => [ | |
123 | + | |
124 | + [ | |
125 | + 'name' => 'image_id', | |
126 | + 'type' => Form::IMAGE, | |
127 | + ], | |
128 | + [ | |
129 | + 'name' => 'sort', | |
130 | + 'type' => Form::NUMBER, | |
131 | + ], | |
132 | + [ | |
133 | + 'name' => 'link', | |
134 | + 'type' => Form::STRING, | |
135 | + ], | |
136 | + ], | |
137 | + ]; | |
138 | + } | |
139 | + } | |
0 | 140 | \ No newline at end of file | ... | ... |
backend/views/layouts/menu_items.php
common/messages/en/app.php
... | ... | @@ -21,7 +21,7 @@ return [ |
21 | 21 | 'Gere' => 'Group of Experts on Renewal Energetics (GERE)', |
22 | 22 | |
23 | 23 | 'Register!' => 'REGISTRATION', |
24 | - '12-18' => 'November 12-15, 2018 Kyiv, Ukraine', | |
24 | + '12-18' => '12-15 November 2018 Kyiv, Ukraine', | |
25 | 25 | 'About' => 'About the event', |
26 | 26 | |
27 | 27 | 'Orgs' => 'Organizers', | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "logo". | |
9 | + * | |
10 | + * @property int $id | |
11 | + * @property int $image_id | |
12 | + * @property string $link | |
13 | + * @property int $sort | |
14 | + */ | |
15 | +class Logo extends \yii\db\ActiveRecord | |
16 | +{ | |
17 | + /** | |
18 | + * {@inheritdoc} | |
19 | + */ | |
20 | + public static function tableName() | |
21 | + { | |
22 | + return 'logo'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * {@inheritdoc} | |
27 | + */ | |
28 | + public function rules() | |
29 | + { | |
30 | + return [ | |
31 | + [['image_id', 'sort'], 'default', 'value' => null], | |
32 | + [['image_id', 'sort'], 'integer'], | |
33 | + [['link'], 'string'], | |
34 | + ]; | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * {@inheritdoc} | |
39 | + */ | |
40 | + public function attributeLabels() | |
41 | + { | |
42 | + return [ | |
43 | + 'id' => Yii::t('app', 'ID'), | |
44 | + 'image_id' => Yii::t('app', 'Image ID'), | |
45 | + 'link' => Yii::t('app', 'Link'), | |
46 | + 'sort' => Yii::t('app', 'Sort'), | |
47 | + ]; | |
48 | + } | |
49 | +} | ... | ... |
console/migrations/m180912_134138_create_logo_table.php
0 โ 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Handles the creation of table `logo`. | |
7 | + */ | |
8 | +class m180912_134138_create_logo_table extends Migration | |
9 | +{ | |
10 | + /** | |
11 | + * {@inheritdoc} | |
12 | + */ | |
13 | + public function safeUp() | |
14 | + { | |
15 | + $this->createTable('logo', [ | |
16 | + 'id' => $this->primaryKey(), | |
17 | + 'image_id' => $this->integer(), | |
18 | + 'link' => $this->text(), | |
19 | + 'sort' => $this->integer() | |
20 | + ]); | |
21 | + } | |
22 | + | |
23 | + /** | |
24 | + * {@inheritdoc} | |
25 | + */ | |
26 | + public function safeDown() | |
27 | + { | |
28 | + $this->dropTable('logo'); | |
29 | + } | |
30 | +} | ... | ... |
frontend/views/site/index.php
... | ... | @@ -171,33 +171,9 @@ |
171 | 171 | <!-- </a>--> |
172 | 172 | <!-- </div>--> |
173 | 173 | <!-- </div>--> |
174 | -<!-- <div class="partners-wr col-xs-12 col-sm-2">--> | |
175 | -<!-- <div>--> | |
176 | -<!-- <a href="https://www.unenvironment.org/" target="_blank">--> | |
177 | -<!-- <img src="/images/partners/img-5.png" alt="">--> | |
178 | -<!-- </a>--> | |
179 | -<!-- </div>--> | |
180 | -<!-- </div>--> | |
181 | - | |
182 | - | |
183 | - | |
184 | - | |
185 | - | |
186 | - | |
187 | - | |
188 | - | |
189 | - | |
190 | - | |
191 | 174 | |
192 | 175 | <!-- <div class="partners-wr col-xs-12 col-sm-2">--> |
193 | 176 | <!-- <div>--> |
194 | -<!-- <a href="http://www.ua.undp.org/" target="_blank">--> | |
195 | -<!-- <img src="/images/partners/img-3-2.png" alt="">--> | |
196 | -<!-- </a>--> | |
197 | -<!-- </div>--> | |
198 | -<!-- </div>--> | |
199 | -<!-- <div class="partners-wr col-xs-12 col-sm-2">--> | |
200 | -<!-- <div>--> | |
201 | 177 | <!-- <a href="https://www.unescap.org/" target="_blank">--> |
202 | 178 | <!-- <img src="/images/partners/img-4-2.png" alt="">--> |
203 | 179 | <!-- </a>--> |
... | ... | @@ -327,6 +303,38 @@ |
327 | 303 | </div> |
328 | 304 | </div> |
329 | 305 | |
306 | + <div class="partners-wr col-xs-12 col-sm-2"> | |
307 | + <div> | |
308 | + <a href="https://www.unenvironment.org/" target="_blank"> | |
309 | + <img src="/images/partners/img-5.png" alt=""> | |
310 | + </a> | |
311 | + </div> | |
312 | + </div> | |
313 | + | |
314 | + <div class="partners-wr col-xs-12 col-sm-2"> | |
315 | + <div> | |
316 | + <a href="http://www.ua.undp.org/" target="_blank"> | |
317 | + <img src="/images/partners/img-3-2.png" alt=""> | |
318 | + </a> | |
319 | + </div> | |
320 | + </div> | |
321 | + | |
322 | + <div class="partners-wr col-xs-12 col-sm-2"> | |
323 | + <div> | |
324 | + <span> | |
325 | + <img src="/images/partners/img-30.png" alt=""> | |
326 | + </span> | |
327 | + </div> | |
328 | + </div> | |
329 | + | |
330 | + <div class="partners-wr col-xs-12 col-sm-2"> | |
331 | + <div> | |
332 | + <span> | |
333 | + <img src="/images/partners/img-31.png" alt=""> | |
334 | + </span> | |
335 | + </div> | |
336 | + </div> | |
337 | + | |
330 | 338 | <!-- <div class="partners-wr col-xs-12 col-sm-2">--> |
331 | 339 | <!-- <div>--> |
332 | 340 | <!-- <a href="https://www.uneca.org/" target="_blank">--> | ... | ... |
2.73 KB
3.85 KB