Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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