main.php 1.54 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
	<meta charset="<?= Yii::$app->charset ?>"/>
19
	<meta name="viewport" content="width=device-width, initial-scale=1">
Alexander Makarov committed
20
	<title><?= Html::encode($this->title) ?></title>
21
	<?php $this->head() ?>
22 23
</head>
<body>
24
	<?php $this->beginBody() ?>
Alexander Makarov committed
25
	<?php
26
		NavBar::begin([
Alexander Makarov committed
27 28
			'brandLabel' => 'My Company',
			'brandUrl' => Yii::$app->homeUrl,
29
			'options' => [
Alexander Makarov committed
30
				'class' => 'navbar-inverse navbar-fixed-top',
31 32 33 34 35
			],
		]);
		$menuItems = [
			['label' => 'Home', 'url' => ['/site/index']],
		];
Alexander Makarov committed
36
		if (Yii::$app->user->isGuest) {
37
			$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
Alexander Makarov committed
38
		} else {
39
			$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']];
Alexander Makarov committed
40
		}
41
		echo Nav::widget([
Qiang Xue committed
42
			'options' => ['class' => 'navbar-nav navbar-right'],
Alexander Makarov committed
43
			'items' => $menuItems,
44
		]);
Alexander Makarov committed
45 46
		NavBar::end();
	?>
47

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

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

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