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.

index.php 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. $producer = $this->context->getProducer() ;
  3. $this->setPageTitle(Html::encode($producer->type.' à '.$producer->ville)) ;
  4. ?>
  5. <?php if(strlen($producer->description) || strlen($producer->photo)): ?>
  6. <?php
  7. if(strlen($producer->description) && strlen($producer->photo))
  8. $col_size = 'col-md-6' ;
  9. else
  10. $col_size = 'col-md-12' ;
  11. ?>
  12. <section id="commander">
  13. <a class="btn btn-primary btn-lg" href="<?php if(Yii::$app->user->isGuest): echo 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])]); else: echo Yii::$app->urlManager->createUrl(['commande/create']); endif; ?>"><span class="glyphicon glyphicon-plus"></span> Passer une commande</a>
  14. </section>
  15. <section id="presentation">
  16. <?php if(strlen($producer->photo)): ?>
  17. <div class="photo <?= $col_size ?>">
  18. <img class="img-photo" src="<?= Yii::$app->urlManager->baseUrl; ?>/uploads/<?= $producer->photo; ?>" alt="Photo <?= Html::encode($producer->nom) ?>" />
  19. </div>
  20. <?php endif; ?>
  21. <?php if(strlen($producer->description)): ?>
  22. <div class="description <?= $col_size ?>">
  23. <?= nl2br(Html::encode($producer->description)); ?>
  24. </div>
  25. <?php endif; ?>
  26. <div class="clr"></div>
  27. </section>
  28. <?php endif; ?>
  29. <section id="points-vente">
  30. <h3><span>Points de vente</span></h3>
  31. <?= GridView::widget([
  32. 'dataProvider' => $data_provider_points_vente,
  33. 'summary' => '',
  34. 'columns' => [
  35. 'nom',
  36. 'localite',
  37. [
  38. 'label' => 'Jours de livraison',
  39. 'value' => function($model) {
  40. return $model->strJoursLivraison() ;
  41. }
  42. ]
  43. ],
  44. ]); ?>
  45. </section>
  46. <section id="produits">
  47. <h3><span>Produits</span></h3>
  48. <?= GridView::widget([
  49. 'dataProvider' => $data_provider_produits,
  50. 'summary' => '',
  51. 'columns' => [
  52. [
  53. 'attribute' => 'photo',
  54. 'format' => 'raw',
  55. 'headerOptions' => ['class' => 'td-photo'],
  56. 'value' => function($model) {
  57. if(strlen($model->photo)) {
  58. return '<img class="photo-produit" src="'.Yii::$app->urlManagerProducer->baseUrl.'/uploads/'.$model->photo.'" />' ;
  59. }
  60. return '' ;
  61. }
  62. ],
  63. 'nom',
  64. 'description',
  65. [
  66. 'attribute' => 'poids',
  67. 'value' => function($model) {
  68. if(strlen($model->poids)) {
  69. return $model->poids.'g' ;
  70. }
  71. return '' ;
  72. }
  73. ],
  74. ],
  75. ]); ?>
  76. </section>