setTitle('Produits') ;
$this->addBreadcrumb($this->getTitle()) ;
$this->addButton(['label' => '+', 'url' => 'product/create', 'class' => 'btn btn-primary']) ;
?>
= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'order',
'headerOptions' => ['class' => 'order'],
'format' => 'raw',
'filter' => '',
'value' => function($model) {
return '
' ;
}
],
[
'attribute' => 'photo',
'format' => 'raw',
'headerOptions' => ['class' => 'td-photo'],
'filter' => '',
'value' => function($model) {
if(strlen($model->photo)) {
$url = Yii::$app->urlManagerProducer->getBaseUrl() ;
return '
' ;
}
return '' ;
}
],
'name',
'description',
[
'attribute' => 'active',
'headerOptions' => ['class' => 'active'],
'contentOptions' => ['class' => 'center'],
'format' => 'raw',
'filter' => [0 => 'Non', 1 => 'Oui'],
'value' => function($model) {
if($model->active)
{
return '
oui' ;
}
else {
return '
non' ;
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('
', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('
', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
],
],
],
]); ?>