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

/**
10 11
 * @var \yii\web\View $this
 * @var string $content
12
 */
13
AppAsset::register($this);
14
?>
15
<?php $this->beginPage() ?>
16
<!DOCTYPE html>
17
<html lang="<?= Yii::$app->language ?>">
18
<head>
Alexander Makarov committed
19
	<meta charset="<?= Yii::$app->charset ?>"/>
20
	<meta name="viewport" content="width=device-width, initial-scale=1">
Alexander Makarov committed
21
	<title><?= Html::encode($this->title) ?></title>
22
	<?php $this->head() ?>
23 24
</head>
<body>
25
	<?php $this->beginBody() ?>
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
	<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']],
				['label' => 'About', 'url' => ['/site/about']],
				['label' => 'Contact', 'url' => ['/site/contact']],
			];
			if (Yii::$app->user->isGuest) {
				$menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
				$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();
		?>
52

53 54 55 56 57 58 59
		<div class="container">
		<?= Breadcrumbs::widget([
			'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
		]) ?>
		<?= Alert::widget() ?>
		<?= $content ?>
		</div>
Alexander Makarov committed
60
	</div>
61
	
Alexander Makarov committed
62 63
	<footer class="footer">
		<div class="container">
Alexander Makarov committed
64 65
		<p class="pull-left">&copy; My Company <?= date('Y') ?></p>
		<p class="pull-right"><?= Yii::powered() ?></p>
Alexander Makarov committed
66 67
		</div>
	</footer>
68

69
	<?php $this->endBody() ?>
70 71
</body>
</html>
72
<?php $this->endPage() ?>