You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 line
10KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\bootstrap\Nav;
  4. use yii\bootstrap\NavBar;
  5. use yii\widgets\Breadcrumbs;
  6. use common\widgets\Alert;
  7. use common\helpers\Url ;
  8. /* @var $this \yii\web\View */
  9. /* @var $content string */
  10. $is_home = (Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'index') ;
  11. \common\assets\CommonAsset::register($this);
  12. \frontend\assets\AppAsset::register($this);
  13. ?>
  14. <?php $this->beginPage() ?>
  15. <!DOCTYPE html>
  16. <head>
  17. <title><?php if($is_home): ?>La boîte à pain &bull; <?= Html::encode($this->title) ?> <?php else: ?><?= Html::encode($this->title) ?> &bull; La boîte à pain<?php endif; ?></title>
  18. <meta charset="utf-8">
  19. <meta name="viewport" content="width=device-width, initial-scale=1">
  20. <?= Html::csrfMetaTags() ?>
  21. <link rel="icon" type="image/png" href="<?= Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
  22. <!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="<?= Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon.ico" /><![endif]-->
  23. <?php $this->head() ?>
  24. <!--[if lt IE 9]>
  25. <script src="<?= Yii::$app->urlManager->getBaseUrl(); ?>/js/html5shiv.min.js"></script>
  26. <link href="<?= Yii::$app->urlManager->getBaseUrl(); ?>/css/ie.css" rel="stylesheet">
  27. <![endif]-->
  28. <!--[if IE 7]>
  29. <link href="<?= Yii::$app->urlManager->getBaseUrl(); ?>/css/ie7.css" rel="stylesheet">
  30. <![endif]-->
  31. </head>
  32. <body class="<?php if($is_home): echo 'home' ; endif; ?><?php if(!Yii::$app->user->isGuest): ?> connected<?php endif; ?>">
  33. <?php $this->beginBody() ?>
  34. <div id="back"></div>
  35. <?php if(YII_ENV == 'demo'): ?>
  36. <div id="block-demo">
  37. <div class="container">
  38. <span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
  39. Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
  40. </div>
  41. </div>
  42. <?php endif; ?>
  43. <header id="header">
  44. <div id="the-header" class="container">
  45. <a id="link-home" href="<?= Yii::$app->urlManager->createUrl('site/index') ; ?>">
  46. <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" />
  47. <div class="text">
  48. <div class="bap">La boîte à pain</div>
  49. <div class="plateforme">Plateforme de réservation
  50. <?php if(YII_ENV == 'dev' || YII_ENV == 'demo'): ?><?php if(YII_ENV == 'dev'): ?>(dév)<?php elseif(YII_ENV == 'demo'): ?>(démo)<?php endif; ?><?php endif; ?></div>
  51. </div>
  52. </a>
  53. <nav>
  54. <?php
  55. echo Nav::widget([
  56. 'encodeLabels' => false,
  57. 'options' => ['class' =>'nav nav-pills'],
  58. 'items' => [
  59. [
  60. 'label' => '<span class="glyphicon glyphicon-th-list"></span> Accueil',
  61. 'url' => Yii::$app->urlManager->createUrl(['site/index']),
  62. 'active' => $this->getControllerAction() == 'site/index'
  63. ],
  64. [
  65. 'label' => '<span class="glyphicon glyphicon-grain"></span> Producteurs',
  66. 'url' => Yii::$app->urlManager->createUrl(['site/producers']),
  67. 'active' => $this->getControllerAction() == 'site/producers',
  68. 'options' => ['id' => 'link-producteurs']
  69. ],
  70. [
  71. 'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion',
  72. 'url' => Yii::$app->urlManager->createUrl(['site/login']),
  73. 'visible' => Yii::$app->user->isGuest,
  74. 'active' => $this->getControllerAction() == 'site/login'
  75. ],
  76. [
  77. 'label' => '<span class="glyphicon glyphicon-user"></span> Inscription',
  78. 'url' => Yii::$app->urlManager->createUrl(['site/signup']),
  79. 'visible' => Yii::$app->user->isGuest,
  80. 'active' => $this->getControllerAction() == 'site/signup'
  81. ],
  82. [
  83. '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))) : '').'. ',
  84. 'options' => ['id' => 'label1'],
  85. 'url' => '#',
  86. 'items' => [
  87. [
  88. 'label' => 'Profil',
  89. 'url' => Yii::$app->urlManager->createUrl(['user/update']),
  90. ],
  91. [
  92. 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
  93. 'url' => Yii::$app->urlManager->createUrl(['site/logout']),
  94. ]
  95. ],
  96. 'visible' => !Yii::$app->user->isGuest
  97. ],
  98. ]
  99. ]);
  100. ?>
  101. </nav>
  102. </div>
  103. </header>
  104. <?php if(!Yii::$app->user->isGuest): ?>
  105. <section id="favorite-producers">
  106. <div class="container">
  107. <?php
  108. $producers = Etablissement::find()
  109. ->joinWith(['userEtablissement user_etablissement'])
  110. ->where([
  111. 'user_etablissement.id_user' => Yii::$app->user->id,
  112. 'user_etablissement.favoris' => 1,
  113. 'etablissement.actif' => 1
  114. ])
  115. ->all() ;
  116. ?>
  117. <?php if(count($producers)): ?>
  118. <h2>Mes producteurs</h2>
  119. <?php foreach($producers as $producer): ?>
  120. <div class="col-md-<?php if(count($producers) == 1): ?>6<?php elseif(count($producers) == 2): ?>6<?php else: ?>3<?php endif; ?>">
  121. <div class="producer" style="background-image:url('<?= Yii::$app->urlManagerProducer->getHostInfo().'/'.Yii::$app->urlManagerProducer->baseUrl ; ?>/uploads/<?= $producer->photo ?>');">
  122. <a class="btn btn-primary" href="<?= Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]); ?>"><?= Html::encode($producer->nom); ?></a>
  123. </div>
  124. </div>
  125. <?php endforeach;?>
  126. <?php else: ?>
  127. <div id="discover">
  128. <p>Vous n'avez aucun producteur dans vos favoris : </p>
  129. <a class="btn btn-default btn-lg" href="<?= Yii::$app->urlManager->createUrl(['site/producers']); ?>"><span class="glyphicon glyphicon-grain"></span> Découvrez les producteurs</a>
  130. </div>
  131. <?php endif; ?>
  132. <div class="clr"></div>
  133. </div>
  134. </section>
  135. <?php endif; ?>
  136. <div id="main">
  137. <section class="container" id="content">
  138. <?php if(Yii::$app->session->hasFlash('error')): ?>
  139. <div class="alert alert-danger" role="alert">
  140. <?= Yii::$app->session->getFlash('error') ?>
  141. </div>
  142. <?php endif; ?>
  143. <?php if(Yii::$app->session->hasFlash('success')): ?>
  144. <div class="alert alert-success" role="alert">
  145. <?= Yii::$app->session->getFlash('success') ?>
  146. </div>
  147. <?php endif; ?>
  148. <?= $content ?>
  149. </section>
  150. </div>
  151. <footer id="footer">
  152. <div class="container">
  153. <a href="<?php echo Yii::$app->urlManager->createUrl('site/contact') ; ?>">Contact</a> &bull;
  154. <a href="<?php echo Yii::$app->urlManager->createUrl('site/mentions') ; ?>">Mentions légales</a> &bull;
  155. <a href="<?php echo Yii::$app->urlManager->createUrl('site/cgv') ; ?>">CGS</a>
  156. </div>
  157. </footer>
  158. <?php $this->endBody() ?>
  159. <!-- analytics -->
  160. <script>
  161. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  162. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  163. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  164. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  165. ga('create', 'UA-86917043-1', 'auto');
  166. ga('send', 'pageview');
  167. </script>
  168. </body>
  169. </html>
  170. <?php $this->endPage() ?>