main.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /* @var $this \yii\web\View */
  3. /* @var $content string */
  4. use app\widgets\Alert;
  5. use yii\helpers\Html;
  6. use yii\bootstrap4\Nav;
  7. use yii\bootstrap4\NavBar;
  8. use yii\widgets\Breadcrumbs;
  9. use app\assets\AppAsset;
  10. use app\assets\AdminLteAsset;
  11. AppAsset::register($this);
  12. AdminLteAsset::register($this);
  13. ?>
  14. <?php $this->beginPage() ?>
  15. <!DOCTYPE html>
  16. <html lang="<?= Yii::$app->language ?>">
  17. <head>
  18. <meta charset="<?= Yii::$app->charset ?>">
  19. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  20. <meta name="viewport" content="width=device-width, initial-scale=1">
  21. <?php $this->registerCsrfMetaTags() ?>
  22. <title><?= Html::encode($this->title) ?></title>
  23. <?php $this->head() ?>
  24. </head>
  25. <body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed">
  26. <?php $this->beginBody() ?>
  27. <div class="wrapper">
  28. <?php
  29. NavBar::begin([
  30. //'brandLabel' => Yii::$app->name,
  31. //'brandUrl' => Yii::$app->homeUrl,
  32. 'renderInnerContainer' => false,
  33. 'options' => [
  34. 'class' => 'main-header navbar navbar-expand navbar-white navbar-light',
  35. ],
  36. ]);
  37. //foreach ($this->params['actionButtons'] as $button)
  38. //$as = [['label' => 'Home', 'url' => ['/site/index']], $this->params['actionButtons']];
  39. echo Nav::widget([
  40. 'encodeLabels' => false,
  41. 'options' => ['class' => 'navbar-nav w-100'],
  42. 'items' => array_merge(
  43. [
  44. ['label' => '<i class="fas fa-bars"></i>', 'url' => '#', 'options' =>['data-widget' => 'pushmenu']],
  45. //['label' => 'Home', 'url' => ['/site/index'], 'options' =>['class' => 'ml-auto']],
  46. /*['label' => 'About', 'url' => ['/site/about']],
  47. ['label' => 'Contact', 'url' => ['/site/contact']],
  48. Yii::$app->user->isGuest ? (
  49. ['label' => 'Login', 'url' => ['/site/login']]
  50. ) : (
  51. '<li>'
  52. . Html::beginForm(['/site/logout'], 'post')
  53. . Html::submitButton(
  54. 'Logout (' . Yii::$app->user->identity->username . ')',
  55. ['class' => 'btn btn-link logout']
  56. )
  57. . Html::endForm()
  58. . '</li>'
  59. )*/
  60. ],
  61. isset($this->params['actionButtons']) ? $this->params['actionButtons'] : [],
  62. [
  63. ['label' => 'Logout (' . Yii::$app->user->identity->username . ') <i class="fas fa-sign-out-alt"></i>', 'url' => ['/site/logout'], 'options' => ['class'=>'ml-auto']]
  64. ]
  65. )
  66. ]);
  67. /*echo Nav::widget([
  68. 'encodeLabels' => false,
  69. 'options' => ['class' => 'navbar-nav ml-auto'],
  70. 'items' => [
  71. ],
  72. ]);*/
  73. NavBar::end();
  74. ?>
  75. <aside class="main-sidebar sidebar-dark-primary elevation-4">
  76. <!-- Brand Logo -->
  77. <a href="<?= Yii::$app->homeUrl; ?>" class="brand-link text-center text-uppercase">
  78. <span class="brand-text font-weight-light"><?= Yii::$app->name; ?></span>
  79. </a>
  80. <!-- Sidebar -->
  81. <div class="sidebar">
  82. <!-- Sidebar user (optional) -->
  83. <div class="user-panel mt-3 pb-3 mb-3 d-flex">
  84. <div class="image">
  85. <img src="<?= \yii\helpers\Url::to('@web/img/avatar.png'); ?>" class="img-circle elevation-2" alt="User Image">
  86. </div>
  87. <div class="info d-flex w-100">
  88. <a href="#" class="d-block"><?= Yii::$app->user->identity->username; ?></a>
  89. </div>
  90. </div>
  91. <!-- Sidebar Menu -->
  92. <nav class="mt-2">
  93. <?php
  94. echo Nav::widget([
  95. 'activateParents' => true,
  96. 'encodeLabels' => false,
  97. 'options' => ['class' => 'nav nav-pills nav-sidebar flex-column', 'data-widget' => 'treeview', 'data-accordion' => 'false', 'role' => 'menu'],
  98. 'items' => [
  99. ['label' => '<i class="nav-icon fas fa-tachometer-alt"></i> <p>Dashboard</p>', 'url' => ['/dashboard']], //'active' => $this->context->route;
  100. ['label' => '<i class="nav-icon fas fa-file-invoice"></i> <p>Bills</p>', 'url' => ['/bills']],
  101. ['label' => '<i class="nav-icon fas fa-building"></i> <p>Organizations</p>', 'url' => ['/organizations'], 'active' => Yii::$app->controller->id == 'organizations'],
  102. ['label' => '<i class="nav-icon fas fa-address-book"></i> <p>Our contacts</p>', 'url' => ['/contacts']],
  103. ['label' => '<i class="nav-icon fas fa-cogs"></i> <p>Settings</p>', 'url' => ['settings/'], 'active' => Yii::$app->controller->id == 'settings'],
  104. ],
  105. ]);
  106. ?>
  107. </nav>
  108. <!-- /.sidebar-menu -->
  109. </div>
  110. <!-- /.sidebar -->
  111. </aside>
  112. <!-- Content Wrapper. Contains page content -->
  113. <div class="content-wrapper">
  114. <!-- Content Header (Page header) -->
  115. <section class="content-header">
  116. <div class="container-fluid">
  117. <div class="row mb-2">
  118. <div class="col-sm-6">
  119. <h1><?= $this->title; ?></h1>
  120. </div>
  121. <div class="col-sm-6">
  122. <?= Breadcrumbs::widget([
  123. 'tag' => 'ol',
  124. 'itemTemplate' => "<li class=\"breadcrumb-item\">{link}</li>\n",
  125. 'activeItemTemplate' => "<li class=\"breadcrumb-item active\">{link}</li>\n",
  126. 'options' => ['class'=>'breadcrumb float-sm-right'],
  127. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  128. ]) ?>
  129. </div>
  130. </div>
  131. </div><!-- /.container-fluid -->
  132. </section>
  133. <section class="content">
  134. <div class="container-fluid">
  135. <?= Alert::widget() ?>
  136. <?= $content ?>
  137. </div>
  138. </section>
  139. </div>
  140. <footer class="main-footer">
  141. <div class="float-right d-none d-sm-block">
  142. <p class="pull-right">v: <?= Yii::$app->version; ?></p>
  143. </div>
  144. <p class="pull-left m-0">&copy; <?= Yii::$app->name; ?> <?= date('Y') ?></p>
  145. </footer>
  146. </div>
  147. <?php $this->endBody() ?>
  148. </body>
  149. </html>
  150. <?php $this->endPage() ?>