Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

190 Zeilen
11KB

  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. <meta name="slug-producer" content="<?= $producer->slug ; ?>">
  19. <?= Html::csrfMetaTags() ?>
  20. <link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
  21. <?php $this->head() ?>
  22. </head>
  23. <body class="<?= Yii::$app->controller->id.'-'.Yii::$app->controller->action->id ?>">
  24. <?php $this->beginBody() ?>
  25. <div id="header-bap">
  26. <div class="container">
  27. <a id="logo" href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']); ?>">
  28. <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" />
  29. <span class="text">La boîte à pain</span>
  30. </a>
  31. <?php
  32. echo Nav::widget([
  33. 'encodeLabels' => false,
  34. 'items' => [
  35. [
  36. 'label' => '<span class="glyphicon glyphicon-user"></span> Inscription',
  37. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/signup']),
  38. 'visible' => Yii::$app->user->isGuest
  39. ],
  40. [
  41. 'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion',
  42. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/login','return_url' => Yii::$app->urlManager->createAbsoluteUrl(['site/index'])]),
  43. 'visible' => Yii::$app->user->isGuest
  44. ],
  45. [
  46. '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))) : '').'. ',
  47. 'options' => ['id' => 'label1'],
  48. 'url' => '#',
  49. 'items' => [
  50. [
  51. 'label' => 'Profil',
  52. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']),
  53. ],
  54. [
  55. 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
  56. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/logout']),
  57. ]
  58. ],
  59. 'visible' => !Yii::$app->user->isGuest
  60. ],
  61. ],
  62. 'options' => ['id' =>'nav-bap'],
  63. ]);
  64. ?>
  65. </div>
  66. </div>
  67. <header id="header">
  68. <div class="container">
  69. <h1><?= Html::encode($producer->nom); ?> <span>/ <?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</span></h1>
  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">
  76. <span class="info"><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl('site/creditpain'); ?>"><span class="text">Crédit </span><span class="glyphicon glyphicon-info-sign"></span></a></span>
  77. <span id="the-credit"><?= number_format($user_etablissement->credit, 2); ?> €</span>
  78. </div>
  79. <?php endif; ?>
  80. <?php endif; ?>
  81. <div id="infos">
  82. <span data-toggle="tooltip" data-placement="bottom" title="Heure limite de commande">
  83. <span class="glyphicon glyphicon-time"></span> Commande avant
  84. <strong><?php echo Html::encode($producer->heure_limite_commande) ?> h</strong></span>,
  85. <span data-toggle="tooltip" data-placement="bottom" title="Exemple : commande le lundi pour le <?php if($producer->delai_commande == 1): ?>mardi<?php elseif($producer->delai_commande == 2): ?>mercredi<?php elseif($producer->delai_commande == 3): ?>jeudi<?php elseif($producer->delai_commande == 4): ?>vendredi<?php elseif($producer->delai_commande == 5): ?>samedi<?php elseif($producer->delai_commande == 6): ?>dimanche<?php elseif($producer->delai_commande == 7): ?>lundi d'après<?php endif; ?>"><strong><?= Html::encode($producer->delai_commande) ?> jour<?php if($producer->delai_commande > 1): ?>s<?php endif; ?></strong> à l'avance</span>
  86. <?php if(!Yii::$app->user->isGuest): ?>
  87. <span class="favorite">
  88. <?php if($user_etablissement && $user_etablissement->favoris): ?>
  89. <span class="glyphicon glyphicon-star"></span> <a href="<?= Yii::$app->urlManagerProducer->createUrl(['site/favorite','action' => 'delete']); ?>" data-toggle="tooltip" data-placement="bottom" title="Supprimer de mes favoris">Favoris</a>
  90. <?php else: ?>
  91. <span class="glyphicon glyphicon glyphicon-star-empty"></span> <a href="<?= Yii::$app->urlManagerProducer->createUrl(['site/favorite','action' => 'add']); ?>" data-toggle="tooltip" data-placement="bottom" title="Ajouter à mes favoris">Favoris</a>
  92. <?php endif; ?>
  93. </span>
  94. <?php endif; ?>
  95. <div class="clr"></div>
  96. </div>
  97. </div>
  98. </header>
  99. <div id="main">
  100. <div class="container">
  101. <nav id="main-nav">
  102. <?php
  103. echo Nav::widget([
  104. 'encodeLabels' => false,
  105. 'options' => ['class' =>'nav nav-pills'],
  106. 'items' => [
  107. [
  108. 'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil',
  109. 'url' => Yii::$app->urlManager->createUrl(['site/index']),
  110. 'active' => $this->getControllerAction() == 'site/index',
  111. ],
  112. [
  113. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  114. 'url' => Yii::$app->urlManager->createUrl(['commande/create']),
  115. 'visible' => !Yii::$app->user->isGuest,
  116. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  117. ],
  118. [
  119. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  120. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer','id' => $this->context->getProducer()->id,'return_url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['commande/create','slug_producer' => $this->context->getProducer()->slug])]),
  121. 'visible' => Yii::$app->user->isGuest,
  122. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  123. ],
  124. [
  125. 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
  126. 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),
  127. 'visible' => !Yii::$app->user->isGuest,
  128. 'active' => $this->getControllerAction() == 'commande/historique',
  129. ],
  130. [
  131. 'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact',
  132. 'url' => Yii::$app->urlManager->createUrl(['site/contact']),
  133. 'active' => $this->getControllerAction() == 'site/contact',
  134. ],
  135. [
  136. 'label' => '<span class="glyphicon glyphicon-cog"></span> Administration',
  137. 'url' => Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']),
  138. 'visible' => isset(Yii::$app->user->identity) && Yii::$app->user->identity->isBoulanger(),
  139. 'options' => ['id' => 'btn-administration']
  140. ],
  141. ],
  142. ]);
  143. ?>
  144. </nav>
  145. <?php if(strlen($this->getTitle())): ?>
  146. <h2 id="page-title"><?= $this->getTitle(); ?></h2>
  147. <?php endif; ?>
  148. <section id="content">
  149. <?php if (Yii::$app->session->hasFlash('error')): ?>
  150. <div class="alert alert-danger" role="alert">
  151. <?= Yii::$app->session->getFlash('error') ?>
  152. </div>
  153. <?php endif; ?>
  154. <?php if (Yii::$app->session->hasFlash('success')): ?>
  155. <div class="alert alert-success" role="alert">
  156. <?= Yii::$app->session->getFlash('success') ?>
  157. </div>
  158. <?php endif; ?>
  159. <?= $content ?>
  160. </section>
  161. </div>
  162. </div>
  163. <footer id="footer">
  164. <div class="container">
  165. <div class="overflow"></div>
  166. <div class="content">
  167. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']) ; ?>">La boîte à pain</a>
  168. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/mentions']) ; ?>">Mentions légales</a>
  169. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/cgv']) ; ?>">CGS</a>
  170. </div>
  171. </div>
  172. </footer>
  173. <?php $this->endBody() ?>
  174. </body>
  175. </html>
  176. <?php $this->endPage() ?>