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.

main.php 8.1KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 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. <div id="main">
  105. <section class="container" id="content">
  106. <?php if(Yii::$app->session->hasFlash('error')): ?>
  107. <div class="alert alert-danger" role="alert">
  108. <?= Yii::$app->session->getFlash('error') ?>
  109. </div>
  110. <?php endif; ?>
  111. <?php if(Yii::$app->session->hasFlash('success')): ?>
  112. <div class="alert alert-success" role="alert">
  113. <?= Yii::$app->session->getFlash('success') ?>
  114. </div>
  115. <?php endif; ?>
  116. <?= $content ?>
  117. </section>
  118. </div>
  119. <footer id="footer">
  120. <div class="container">
  121. <a href="<?php echo Yii::$app->urlManager->createUrl('site/contact') ; ?>">Contact</a>
  122. <a href="<?php echo Yii::$app->urlManager->createUrl('site/mentions') ; ?>">Mentions légales</a>
  123. <a href="<?php echo Yii::$app->urlManager->createUrl('site/cgv') ; ?>">CGS</a>
  124. </div>
  125. </footer>
  126. <?php $this->endBody() ?>
  127. <!-- analytics -->
  128. <script>
  129. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  130. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  131. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  132. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  133. ga('create', 'UA-86917043-1', 'auto');
  134. ga('send', 'pageview');
  135. </script>
  136. </body>
  137. </html>
  138. <?php $this->endPage() ?>