Browse Source

Refactoring/traduction vues producer/views/site

refactoring
Guillaume Bourgeois 6 years ago
parent
commit
2a4ab2e3ab
1 changed files with 17 additions and 17 deletions
  1. +17
    -17
      producer/views/site/index.php

+ 17
- 17
producer/views/site/index.php View File

*/ */


$producer = $this->context->getProducer() ; $producer = $this->context->getProducer() ;
$this->setPageTitle(Html::encode($producer->type.' à '.$producer->ville)) ;
$this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;
?> ?>


<?php if(strlen($producer->description) || strlen($producer->photo)): ?> <?php if(strlen($producer->description) || strlen($producer->photo)): ?>
<?php <?php
if(strlen($producer->description) && strlen($producer->photo)) if(strlen($producer->description) && strlen($producer->photo))
$col_size = 'col-md-6' ;
$colSize = 'col-md-6' ;
else else
$col_size = 'col-md-12' ;
$colSize = 'col-md-12' ;
?> ?>


<section id="commander"> <section id="commander">
<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>
<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(['order/create','slug_producer' => $this->context->getProducer()->slug])]); else: echo Yii::$app->urlManager->createUrl(['order/create']); endif; ?>"><span class="glyphicon glyphicon-plus"></span> Passer une commande</a>
</section> </section>


<section id="presentation"> <section id="presentation">
<?php if(strlen($producer->photo)): ?> <?php if(strlen($producer->photo)): ?>
<div class="photo <?= $col_size ?>">
<img class="img-photo" src="<?= Yii::$app->urlManager->baseUrl; ?>/uploads/<?= $producer->photo; ?>" alt="Photo <?= Html::encode($producer->nom) ?>" />
<div class="photo <?= $colSize ?>">
<img class="img-photo" src="<?= Yii::$app->urlManager->baseUrl; ?>/uploads/<?= $producer->photo; ?>" alt="Photo <?= Html::encode($producer->name) ?>" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if(strlen($producer->description)): ?> <?php if(strlen($producer->description)): ?>
<div class="description <?= $col_size ?>">
<div class="description <?= $colSize ?>">
<?= nl2br(Html::encode($producer->description)); ?> <?= nl2br(Html::encode($producer->description)); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</section> </section>
<?php endif; ?> <?php endif; ?>


<section id="points-vente">
<section id="points-sale">
<h3><span>Points de vente</span></h3> <h3><span>Points de vente</span></h3>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $data_provider_points_vente,
'dataProvider' => $dataProviderPointsSale,
'summary' => '', 'summary' => '',
'columns' => [ 'columns' => [
'nom', 'nom',
[ [
'label' => 'Jours de livraison', 'label' => 'Jours de livraison',
'value' => function($model) { 'value' => function($model) {
return $model->strJoursLivraison() ;
return $model->getStrDeliveryDays() ;
} }
] ]
], ],
</section> </section>




<section id="produits">
<section id="products">
<h3><span>Produits</span></h3> <h3><span>Produits</span></h3>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $data_provider_produits,
'dataProvider' => $dataProviderProducts,
'summary' => '', 'summary' => '',
'columns' => [ 'columns' => [
[ [
'headerOptions' => ['class' => 'td-photo'], 'headerOptions' => ['class' => 'td-photo'],
'value' => function($model) { 'value' => function($model) {
if(strlen($model->photo)) { if(strlen($model->photo)) {
return '<img class="photo-produit" src="'.Yii::$app->urlManagerProducer->baseUrl.'/uploads/'.$model->photo.'" />' ;
return '<img class="photo-product" src="'.Yii::$app->urlManagerProducer->baseUrl.'/uploads/'.$model->photo.'" />' ;
} }
return '' ; return '' ;
} }
], ],
'nom',
'name',
'description', 'description',
[ [
'attribute' => 'poids',
'attribute' => 'weight',
'value' => function($model) { 'value' => function($model) {
if(strlen($model->poids)) {
return $model->poids.'g' ;
if(strlen($model->weight)) {
return $model->weight.'g' ;
} }
return '' ; return '' ;
} }

Loading…
Cancel
Save