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 lines
2.8 KiB

8 months ago
  1. <?php
  2. /** @var yii\web\View $this */
  3. /** @var string $content */
  4. use app\assets\AppAsset;
  5. use app\widgets\Alert;
  6. use yii\bootstrap5\Breadcrumbs;
  7. use yii\bootstrap5\Html;
  8. use yii\bootstrap5\Nav;
  9. use yii\bootstrap5\NavBar;
  10. AppAsset::register($this);
  11. $this->registerCsrfMetaTags();
  12. $this->registerMetaTag(['charset' => Yii::$app->charset], 'charset');
  13. $this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
  14. $this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']);
  15. $this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']);
  16. $this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii::getAlias('@web/favicon.ico')]);
  17. ?>
  18. <?php $this->beginPage() ?>
  19. <!DOCTYPE html>
  20. <html lang="<?= Yii::$app->language ?>" class="h-100">
  21. <head>
  22. <title><?= Html::encode($this->title) ?></title>
  23. <?php $this->head() ?>
  24. </head>
  25. <body class="d-flex flex-column h-100">
  26. <?php $this->beginBody() ?>
  27. <header id="header">
  28. <?php
  29. NavBar::begin([
  30. 'brandLabel' => Yii::$app->name,
  31. 'brandUrl' => Yii::$app->homeUrl,
  32. 'options' => ['class' => 'navbar-expand-md navbar-dark bg-dark fixed-top']
  33. ]);
  34. echo Nav::widget([
  35. 'options' => ['class' => 'navbar-nav'],
  36. 'items' => [
  37. ['label' => 'Home', 'url' => ['/site/index']],
  38. ['label' => 'About', 'url' => ['/site/about']],
  39. ['label' => 'Contact', 'url' => ['/site/contact']],
  40. Yii::$app->user->isGuest
  41. ? ['label' => 'Login', 'url' => ['/site/login']]
  42. : '<li class="nav-item">'
  43. . Html::beginForm(['/site/logout'])
  44. . Html::submitButton(
  45. 'Logout (' . Yii::$app->user->identity->username . ')',
  46. ['class' => 'nav-link btn btn-link logout']
  47. )
  48. . Html::endForm()
  49. . '</li>'
  50. ]
  51. ]);
  52. NavBar::end();
  53. ?>
  54. </header>
  55. <main id="main" class="flex-shrink-0" role="main">
  56. <div class="container">
  57. <?php if (!empty($this->params['breadcrumbs'])): ?>
  58. <?= Breadcrumbs::widget(['links' => $this->params['breadcrumbs']]) ?>
  59. <?php endif ?>
  60. <?= Alert::widget() ?>
  61. <?= $content ?>
  62. </div>
  63. </main>
  64. <footer id="footer" class="mt-auto py-3 bg-light">
  65. <div class="container">
  66. <div class="row text-muted">
  67. <div class="col-md-6 text-center text-md-start">&copy; My Company <?= date('Y') ?></div>
  68. <div class="col-md-6 text-center text-md-end"><?= Yii::powered() ?></div>
  69. </div>
  70. </div>
  71. </footer>
  72. <?php $this->endBody() ?>
  73. </body>
  74. </html>
  75. <?php $this->endPage() ?>