您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

66 行
2.3KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\grid\GridView;
  4. /* @var $this yii\web\View */
  5. /* @var $dataProvider yii\data\ActiveDataProvider */
  6. $this->title = 'Produits';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <div class="produit-index">
  10. <h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>
  11. <?= GridView::widget([
  12. 'dataProvider' => $dataProvider,
  13. 'columns' => [
  14. [
  15. 'attribute' => 'order',
  16. 'headerOptions' => ['class' => 'order'],
  17. 'format' => 'raw',
  18. 'value' => function($model) {
  19. return '<a class="btn-order btn btn-default" href="javascript:void(0);"><span class="glyphicon glyphicon-resize-vertical"></span></a>' ;
  20. }
  21. ],
  22. 'diminutif',
  23. 'nom',
  24. [
  25. 'attribute' => 'actif',
  26. 'headerOptions' => ['class' => 'actif'],
  27. 'contentOptions' => ['class' => 'center'],
  28. 'format' => 'raw',
  29. 'value' => function($model) {
  30. if($model->actif)
  31. {
  32. return '<span class="label label-success">oui</span>' ;
  33. }
  34. else {
  35. return '<span class="label label-danger">non</span>' ;
  36. }
  37. }
  38. ],
  39. [
  40. 'class' => 'yii\grid\ActionColumn',
  41. 'template' => '{update} {delete}',
  42. 'headerOptions' => ['class' => 'actions'],
  43. 'buttons' => [
  44. 'update' => function ($url, $model) {
  45. return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
  46. 'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
  47. ]);
  48. },
  49. 'delete' => function ($url, $model) {
  50. return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
  51. 'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
  52. ]);
  53. }
  54. ],
  55. ],
  56. ],
  57. ]); ?>
  58. </div>