diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php index 5a51140..872d76d 100755 --- a/backend/controllers/SiteController.php +++ b/backend/controllers/SiteController.php @@ -1,6 +1,7 @@ true, 'roles' => [ '@' ], @@ -49,7 +51,7 @@ ], ]; } - + /** * @inheritdoc */ @@ -61,7 +63,7 @@ ], ]; } - + /** * Displays homepage. * @@ -70,14 +72,14 @@ public function actionIndex() { $settings = Settings::getInstance(); - + if (empty($settings->analytics_key)) { return $this->render('instruction'); } else { return $this->render('index'); } } - + /** * Login action. * @@ -88,7 +90,7 @@ if (!Yii::$app->user->isGuest) { return $this->goHome(); } - + $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); @@ -101,7 +103,7 @@ ); } } - + /** * Logout action. * @@ -110,7 +112,25 @@ public function actionLogout() { Yii::$app->user->logout(); - + return $this->goHome(); } + + public function actionGallery() + { + $model = new Gallery(); + + if (\Yii::$app->request->isPost) { + $model->saveImages(\Yii::$app->request->post('images')); + + return $this->redirect([ 'site/index' ]); + } + + return $this->render( + 'gallery', + [ + 'model' => $model, + ] + ); + } } diff --git a/backend/views/layouts/menu_items.php b/backend/views/layouts/menu_items.php index 886c67e..d99806c 100755 --- a/backend/views/layouts/menu_items.php +++ b/backend/views/layouts/menu_items.php @@ -105,5 +105,10 @@ 'url' => [ '/comment' ], 'icon' => 'comment', ], + [ + 'label' => \Yii::t('app', 'Gallery'), + 'url' => [ 'site/gallery' ], + 'icon' => 'camera', + ], ] ); \ No newline at end of file diff --git a/backend/views/site/gallery.php b/backend/views/site/gallery.php new file mode 100644 index 0000000..a32a185 --- /dev/null +++ b/backend/views/site/gallery.php @@ -0,0 +1,46 @@ + 'Gallery', + ] + ); + + echo Html::beginForm(); +?> + +