main.php 1.6 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() ?>
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
	<div class="wrap">
		<?php
			NavBar::begin([
				'brandLabel' => 'My Company',
				'brandUrl' => Yii::$app->homeUrl,
				'options' => [
					'class' => 'navbar-inverse navbar-fixed-top',
				],
			]);
			$menuItems = [
				['label' => 'Home', 'url' => ['/site/index']],
			];
			if (Yii::$app->user->isGuest) {
				$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
			} else {
				$menuItems[] = ['label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => ['/site/logout']];
			}
			echo Nav::widget([
				'options' => ['class' => 'navbar-nav navbar-right'],
				'items' => $menuItems,
			]);
			NavBar::end();
		?>
48

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

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

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