main.php 1.89 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
	<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 {
44 45 46 47 48
				$menuItems[] = [
					'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
					'url' => ['/site/logout'],
					'linkOptions' => ['data-method' => 'post']
				];
49 50 51 52 53 54 55
			}
			echo Nav::widget([
				'options' => ['class' => 'navbar-nav navbar-right'],
				'items' => $menuItems,
			]);
			NavBar::end();
		?>
56

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

73
	<?php $this->endBody() ?>
74 75
</body>
</html>
76
<?php $this->endPage() ?>