main.php 1.86 KB
Newer Older
1
<?php
2
use frontend\config\AppAsset;
3 4 5
use yii\helpers\Html;
use yii\widgets\Menu;
use yii\widgets\Breadcrumbs;
6
use frontend\widgets\Alert;
7 8 9 10 11

/**
 * @var $this \yii\base\View
 * @var $content string
 */
12
AppAsset::register($this);
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
?>
<?php $this->beginPage(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<title><?php echo Html::encode($this->title); ?></title>
	<?php $this->head(); ?>
</head>
<body>
<div class="container">
	<?php $this->beginBody(); ?>
	<div class="masthead">
		<h3 class="muted">My Company</h3>

Alexander Makarov committed
28
		<div class="navbar fullwidth">
29 30
			<div class="navbar-inner">
				<div class="container">
31 32
					<?php
						$menuItems = array(
33 34 35
							array('label' => 'Home', 'url' => array('/site/index')),
							array('label' => 'About', 'url' => array('/site/about')),
							array('label' => 'Contact', 'url' => array('/site/contact')),
36 37 38 39 40 41 42 43 44 45 46 47 48
						);
						if (Yii::$app->user->isGuest) {
							$menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup'));
							$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
						}
						else {
							$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
						}
						echo Menu::widget(array(
							'options' => array('class' => 'nav'),
							'items' => $menuItems,
						));
					?>
49 50 51 52 53 54 55 56 57
				</div>
			</div>
		</div>
		<!-- /.navbar -->
	</div>

	<?php echo Breadcrumbs::widget(array(
		'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : array(),
	)); ?>
58 59 60

	<?php echo Alert::widget()?>

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
	<?php echo $content; ?>

	<hr>

	<div class="footer">
		<p>&copy; My Company <?php echo date('Y'); ?></p>
		<p>
			<?php echo Yii::powered(); ?>
			Template by <a href="http://twitter.github.io/bootstrap/">Twitter Bootstrap</a>
		</p>
	</div>
	<?php $this->endBody(); ?>
</div>
</body>
</html>
<?php $this->endPage(); ?>