選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

174 行
8.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. <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); ?></h1>
  70. <h2><?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2>
  71. <?php if(!Yii::$app->user->isGuest): ?>
  72. <?php
  73. $user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ;
  74. if($user_etablissement):
  75. ?>
  76. <div id="credit">
  77. <div class="info"><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl('site/creditpain'); ?>"><span class="text">Crédit </span><span class="glyphicon glyphicon-info-sign"></span></a></div>
  78. <div id="the-credit"><?= number_format($user_etablissement->credit, 2); ?> €</div>
  79. </div>
  80. <?php endif; ?>
  81. <?php endif; ?>
  82. </div>
  83. </header>
  84. <div id="main">
  85. <div class="container">
  86. <nav id="main-nav">
  87. <?php
  88. echo Nav::widget([
  89. 'encodeLabels' => false,
  90. 'options' => ['class' =>'nav nav-pills'],
  91. 'items' => [
  92. [
  93. 'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil',
  94. 'url' => Yii::$app->urlManager->createUrl(['site/index']),
  95. 'active' => $this->getControllerAction() == 'site/index',
  96. ],
  97. [
  98. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  99. 'url' => Yii::$app->urlManager->createUrl(['commande/create']),
  100. 'visible' => !Yii::$app->user->isGuest,
  101. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  102. ],
  103. [
  104. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  105. 'url' => Yii::$app->urlManagerFrontend->createUrl(['site/producer','id' => $this->context->getProducer()->id,'return_url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['commande/create','slug_producer' => $this->context->getProducer()->slug])]),
  106. 'visible' => Yii::$app->user->isGuest,
  107. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  108. ],
  109. [
  110. 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
  111. 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),
  112. 'visible' => !Yii::$app->user->isGuest,
  113. 'active' => $this->getControllerAction() == 'commande/historique',
  114. ],
  115. [
  116. 'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact',
  117. 'url' => Yii::$app->urlManager->createUrl(['site/contact']),
  118. 'active' => $this->getControllerAction() == 'site/contact',
  119. ],
  120. [
  121. 'label' => '<span class="glyphicon glyphicon-cog"></span> Administration',
  122. 'url' => Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']),
  123. 'visible' => isset(Yii::$app->user->identity) && Yii::$app->user->identity->isBoulanger(),
  124. 'options' => ['id' => 'btn-administration']
  125. ],
  126. ],
  127. ]);
  128. ?>
  129. </nav>
  130. <?php if(strlen($this->getTitle())): ?>
  131. <h2 id="page-title"><?= $this->getTitle(); ?></h2>
  132. <?php endif; ?>
  133. <section id="content">
  134. <?php if (Yii::$app->session->hasFlash('error')): ?>
  135. <div class="alert alert-danger" role="alert">
  136. <?= Yii::$app->session->getFlash('error') ?>
  137. </div>
  138. <?php endif; ?>
  139. <?php if (Yii::$app->session->hasFlash('success')): ?>
  140. <div class="alert alert-success" role="alert">
  141. <?= Yii::$app->session->getFlash('success') ?>
  142. </div>
  143. <?php endif; ?>
  144. <?= $content ?>
  145. </section>
  146. </div>
  147. </div>
  148. <footer id="footer">
  149. <div class="container">
  150. <div class="overflow"></div>
  151. <div class="content">
  152. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']) ; ?>">La boîte à pain</a>
  153. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/mentions']) ; ?>">Mentions légales</a>
  154. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/cgv']) ; ?>">CGS</a>
  155. </div>
  156. </div>
  157. </footer>
  158. <?php $this->endBody() ?>
  159. </body>
  160. </html>
  161. <?php $this->endPage() ?>