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

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

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

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

	<?php $this->endBody(); ?>
</body>
</html>
<?php $this->endPage(); ?>