diff --git a/apps/advanced/backend/config/AppAsset.php b/apps/advanced/backend/config/AppAsset.php index 90a850d..267e48c 100644 --- a/apps/advanced/backend/config/AppAsset.php +++ b/apps/advanced/backend/config/AppAsset.php @@ -6,6 +6,7 @@ */ namespace backend\config; + use yii\web\AssetBundle; /** diff --git a/apps/advanced/backend/config/params.php b/apps/advanced/backend/config/params.php index 1e197d0..1643a70 100644 --- a/apps/advanced/backend/config/params.php +++ b/apps/advanced/backend/config/params.php @@ -1,5 +1,4 @@ 'admin@example.com', -); \ No newline at end of file +); diff --git a/apps/advanced/backend/controllers/SiteController.php b/apps/advanced/backend/controllers/SiteController.php index 09052d2..480406a 100644 --- a/apps/advanced/backend/controllers/SiteController.php +++ b/apps/advanced/backend/controllers/SiteController.php @@ -17,7 +17,7 @@ class SiteController extends Controller { $model = new LoginForm(); if ($model->load($_POST) && $model->login()) { - return $this->redirect(array('site/index')); + return $this->goHome(); } else { return $this->render('login', array( 'model' => $model, @@ -28,6 +28,6 @@ class SiteController extends Controller public function actionLogout() { Yii::$app->user->logout(); - return $this->redirect(array('site/index')); + return $this->goHome(); } } diff --git a/apps/advanced/backend/views/layouts/main.php b/apps/advanced/backend/views/layouts/main.php index 9f66a11..928f990 100644 --- a/apps/advanced/backend/views/layouts/main.php +++ b/apps/advanced/backend/views/layouts/main.php @@ -1,7 +1,8 @@ - + <?php echo Html::encode($this->title); ?> head(); ?> -
beginBody(); ?> -
-

My Company

- - - -
+ 'My Company', + 'brandUrl' => Yii::$app->homeUrl, + 'options' => array( + 'class' => 'navbar-inverse navbar-fixed-top', + ), + )); + $menuItems = array( + array('label' => 'Home', 'url' => array('/site/index')), + ); + if (Yii::$app->user->isGuest) { + $menuItems[] = array('label' => 'Login', 'url' => array('/site/login')); + } else { + $menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')); + } + echo Nav::widget(array( + 'options' => array('class' => 'navbar-nav pull-right'), + 'items' => $menuItems, + )); + NavBar::end(); + ?> +
isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(), )); ?> +
-
+ - endBody(); ?> -
endPage(); ?> diff --git a/apps/advanced/backend/views/site/index.php b/apps/advanced/backend/views/site/index.php index 158b61c..f2e6d5e 100644 --- a/apps/advanced/backend/views/site/index.php +++ b/apps/advanced/backend/views/site/index.php @@ -2,46 +2,52 @@ /** * @var yii\base\View $this */ -$this->title = 'Welcome'; +$this->title = 'My Yii Application'; ?> -
-

Welcome!

+
-

Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus - commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

- Get started with Yii -
+
+

Congratulations!

-
+

You have successfully created your Yii-powered application.

- -
-
-

Heading

+

Get started with Yii

+
-

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.

+ -
-

Heading

+
+
+

Heading

-

Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris - condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. - Donec sed odio dui.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

-

View details »

-
-
-

Heading

+

Yii Documentation »

+
+
+

Heading

-

Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta - felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum - massa.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

+ +

Yii Forum »

+
+
+

Heading

+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur.

+ +

Yii Extensions »

+
+
-

View details »

- diff --git a/apps/advanced/backend/views/site/login.php b/apps/advanced/backend/views/site/login.php index ea9f456..0c16570 100644 --- a/apps/advanced/backend/views/site/login.php +++ b/apps/advanced/backend/views/site/login.php @@ -10,15 +10,21 @@ use yii\widgets\ActiveForm; $this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title; ?> -

title); ?>

+