You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

83 line
2.2 KiB

  1. <?php
  2. /* @var $this \yii\web\View */
  3. /* @var $content string */
  4. use yii\helpers\Html;
  5. use yii\bootstrap\Nav;
  6. use yii\bootstrap\NavBar;
  7. use yii\widgets\Breadcrumbs;
  8. use frontend\assets\AppAsset;
  9. use common\widgets\Alert;
  10. AppAsset::register($this);
  11. ?>
  12. <?php $this->beginPage() ?>
  13. <!DOCTYPE html>
  14. <html lang="<?= Yii::$app->language ?>">
  15. <head>
  16. <meta charset="<?= Yii::$app->charset ?>">
  17. <meta name="viewport" content="width=device-width, initial-scale=1">
  18. <?= Html::csrfMetaTags() ?>
  19. <title><?= Html::encode($this->title) ?></title>
  20. <?php $this->head() ?>
  21. </head>
  22. <body>
  23. <?php $this->beginBody() ?>
  24. <div class="wrap">
  25. <?php
  26. NavBar::begin([
  27. 'brandLabel' => 'My Company',
  28. 'brandUrl' => Yii::$app->homeUrl,
  29. 'options' => [
  30. 'class' => 'navbar-inverse navbar-fixed-top',
  31. ],
  32. ]);
  33. $menuItems = [
  34. ['label' => 'Home', 'url' => ['/site/index']],
  35. ['label' => 'About', 'url' => ['/site/about']],
  36. ['label' => 'Contact', 'url' => ['/site/contact']],
  37. ];
  38. if (Yii::$app->user->isGuest) {
  39. $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
  40. $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
  41. } else {
  42. $menuItems[] = '<li>'
  43. . Html::beginForm(['/site/logout'], 'post')
  44. . Html::submitButton(
  45. 'Logout (' . Yii::$app->user->identity->username . ')',
  46. ['class' => 'btn btn-link logout']
  47. )
  48. . Html::endForm()
  49. . '</li>';
  50. }
  51. echo Nav::widget([
  52. 'options' => ['class' => 'navbar-nav navbar-right'],
  53. 'items' => $menuItems,
  54. ]);
  55. NavBar::end();
  56. ?>
  57. <div class="container">
  58. <?= Breadcrumbs::widget([
  59. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  60. ]) ?>
  61. <?= Alert::widget() ?>
  62. <?= $content ?>
  63. </div>
  64. </div>
  65. <footer class="footer">
  66. <div class="container">
  67. <p class="pull-left">&copy; My Company <?= date('Y') ?></p>
  68. <p class="pull-right"><?= Yii::powered() ?></p>
  69. </div>
  70. </footer>
  71. <?php $this->endBody() ?>
  72. </body>
  73. </html>
  74. <?php $this->endPage() ?>