Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

164 lines
7.9KB

  1. <?php
  2. use yii\bootstrap\Nav;
  3. use yii\bootstrap\NavBar;
  4. use yii\widgets\Breadcrumbs;
  5. use common\widgets\Alert;
  6. use common\helpers\Url;
  7. \common\assets\CommonAsset::register($this);
  8. \producer\assets\AppAsset::register($this);
  9. $producer = $this->context->getProducer() ;
  10. ?>
  11. <?php $this->beginPage() ?>
  12. <!DOCTYPE html>
  13. <head>
  14. <title><?= Html::encode($producer->nom); ?> &bull; <?= $this->getPageTitle(); ?></title>
  15. <meta charset="utf-8">
  16. <meta name="viewport" content="width=device-width, initial-scale=1">
  17. <meta name="base-url" content="<?= Yii::$app->urlManager->baseUrl ; ?>">
  18. <?= Html::csrfMetaTags() ?>
  19. <link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
  20. <?php $this->head() ?>
  21. </head>
  22. <body class="<?= Yii::$app->controller->id.'-'.Yii::$app->controller->action->id ?>">
  23. <?php $this->beginBody() ?>
  24. <div id="header-bap">
  25. <div class="container">
  26. <a id="logo" href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']); ?>">
  27. <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" />
  28. <span class="text">La boîte à pain</span>
  29. </a>
  30. <?php
  31. echo Nav::widget([
  32. 'encodeLabels' => false,
  33. 'items' => [
  34. [
  35. 'label' => '<span class="glyphicon glyphicon-user"></span> Inscription',
  36. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/signup']),
  37. 'visible' => Yii::$app->user->isGuest
  38. ],
  39. [
  40. 'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion',
  41. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/login','return_url' => Yii::$app->urlManager->createAbsoluteUrl(['site/index'])]),
  42. 'visible' => Yii::$app->user->isGuest
  43. ],
  44. [
  45. 'label' => '<span class="glyphicon glyphicon-user"></span> '.((!Yii::$app->user->isGuest) ? Html::encode(Yii::$app->user->identity->prenom .' '.strtoupper(substr(Yii::$app->user->identity->nom, 0, 1))) : '').'. ',
  46. 'options' => ['id' => 'label1'],
  47. 'url' => '#',
  48. 'items' => [
  49. [
  50. 'label' => 'Profil',
  51. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']),
  52. ],
  53. [
  54. 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
  55. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/logout']),
  56. ]
  57. ],
  58. 'visible' => !Yii::$app->user->isGuest
  59. ],
  60. ],
  61. 'options' => ['id' =>'nav-bap'],
  62. ]);
  63. ?>
  64. </div>
  65. </div>
  66. <header id="header">
  67. <div class="container">
  68. <h1><?= Html::encode($producer->nom); ?></h1>
  69. <h2><?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2>
  70. <?php if(!Yii::$app->user->isGuest): ?>
  71. <?php
  72. $user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ;
  73. if($user_etablissement):
  74. ?>
  75. <div id="credit"><span>Crédit :</span> <?= number_format($user_etablissement->credit, 2); ?> €</div>
  76. <?php endif; ?>
  77. <?php endif; ?>
  78. </div>
  79. </header>
  80. <div id="main">
  81. <div class="container">
  82. <nav id="main-nav">
  83. <?php
  84. echo Nav::widget([
  85. 'encodeLabels' => false,
  86. 'options' => ['class' =>'nav nav-pills'],
  87. 'items' => [
  88. [
  89. 'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil',
  90. 'url' => Yii::$app->urlManager->createUrl(['site/index']),
  91. 'active' => $this->getControllerAction() == 'site/index',
  92. ],
  93. [
  94. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  95. 'url' => Yii::$app->urlManager->createUrl(['commande/create']),
  96. 'visible' => !Yii::$app->user->isGuest,
  97. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  98. ],
  99. [
  100. 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
  101. 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),
  102. 'visible' => !Yii::$app->user->isGuest,
  103. 'active' => $this->getControllerAction() == 'commande/historique',
  104. ],
  105. [
  106. 'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact',
  107. 'url' => Yii::$app->urlManager->createUrl(['site/contact']),
  108. 'active' => $this->getControllerAction() == 'site/contact',
  109. ],
  110. [
  111. 'label' => '<span class="glyphicon glyphicon-cog"></span> Administration',
  112. 'url' => Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']),
  113. 'visible' => isset(Yii::$app->user->identity) && Yii::$app->user->identity->isBoulanger(),
  114. 'options' => ['id' => 'btn-administration']
  115. ],
  116. ],
  117. ]);
  118. ?>
  119. </nav>
  120. <?php if(strlen($this->getTitle())): ?>
  121. <h2 id="page-title"><?= $this->getTitle(); ?></h2>
  122. <?php endif; ?>
  123. <section id="content">
  124. <?php if (Yii::$app->session->hasFlash('error')): ?>
  125. <div class="alert alert-danger" role="alert">
  126. <?= Yii::$app->session->getFlash('error') ?>
  127. </div>
  128. <?php endif; ?>
  129. <?php if (Yii::$app->session->hasFlash('success')): ?>
  130. <div class="alert alert-success" role="alert">
  131. <?= Yii::$app->session->getFlash('success') ?>
  132. </div>
  133. <?php endif; ?>
  134. <?= $content ?>
  135. </section>
  136. </div>
  137. </div>
  138. <footer id="footer">
  139. <div class="container">
  140. <div class="overflow"></div>
  141. <div class="content">
  142. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']) ; ?>">La boîte à pain</a>
  143. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/mentions']) ; ?>">Mentions légales</a>
  144. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/cgv']) ; ?>">CGS</a>
  145. </div>
  146. </div>
  147. </footer>
  148. <?php $this->endBody() ?>
  149. </body>
  150. </html>
  151. <?php $this->endPage() ?>