main.php 1.48 KB
Newer Older
1
<?php
2
use backend\assets\AppAsset;
3
use yii\helpers\Html;
Alexander Makarov committed
4 5
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
6 7 8
use yii\widgets\Breadcrumbs;

/**
9 10
 * @var \yii\web\View $this
 * @var string $content
11
 */
12
AppAsset::register($this);
13
?>
14
<?php $this->beginPage() ?>
15
<!DOCTYPE html>
16
<html lang="<?= Yii::$app->language ?>">
17
<head>
Alexander Makarov committed
18 19
	<meta charset="<?= Yii::$app->charset ?>"/>
	<title><?= Html::encode($this->title) ?></title>
20
	<?php $this->head() ?>
21 22
</head>
<body>
23
	<?php $this->beginBody() ?>
Alexander Makarov committed
24
	<?php
25
		NavBar::begin([
Alexander Makarov committed
26 27
			'brandLabel' => 'My Company',
			'brandUrl' => Yii::$app->homeUrl,
28
			'options' => [
Alexander Makarov committed
29
				'class' => 'navbar-inverse navbar-fixed-top',
30 31 32 33 34
			],
		]);
		$menuItems = [
			['label' => 'Home', 'url' => ['/site/index']],
		];
Alexander Makarov committed
35
		if (Yii::$app->user->isGuest) {
36
			$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
Alexander Makarov committed
37
		} else {
38
			$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']];
Alexander Makarov committed
39
		}
40
		echo Nav::widget([
Qiang Xue committed
41
			'options' => ['class' => 'navbar-nav navbar-right'],
Alexander Makarov committed
42
			'items' => $menuItems,
43
		]);
Alexander Makarov committed
44 45
		NavBar::end();
	?>
46

Alexander Makarov committed
47
	<div class="container">
48
	<?= Breadcrumbs::widget([
49
		'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
50
	]) ?>
Alexander Makarov committed
51
	<?= $content ?>
Alexander Makarov committed
52
	</div>
53

Alexander Makarov committed
54 55
	<footer class="footer">
		<div class="container">
Alexander Makarov committed
56 57
		<p class="pull-left">&copy; My Company <?= date('Y') ?></p>
		<p class="pull-right"><?= Yii::powered() ?></p>
Alexander Makarov committed
58 59
		</div>
	</footer>
60

61
	<?php $this->endBody() ?>
62 63
</body>
</html>
64
<?php $this->endPage() ?>