index.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* @var $this yii\web\View */
  3. use yii\helpers\Html;
  4. use yii\grid\GridView;
  5. $this->title = Yii::t('app', 'BiddingBegin ID');
  6. $this->params['breadcrumbs'][] = $this->title;
  7. ?>
  8. <div class="lots-index">
  9. <div class="panel panel-primary">
  10. <div class="panel-heading"><span class="glyphicon glyphicon-flag"></span><strong> <?= Html::encode($this->title) ?></strong></div>
  11. <div class="panel-body">
  12. <?= GridView::widget([
  13. 'dataProvider' => $dataProvider,
  14. 'columns' => [
  15. ['class' => 'yii\grid\SerialColumn'],
  16. 'name',
  17. [
  18. 'attribute' => 'lot_id',
  19. 'header' => Yii::t('app','Lots ID'),
  20. 'value' => function($model)
  21. {
  22. $sql = Yii::$app->db->createCommand("SELECT id, name from lots WHERE aukname=:name");
  23. $sql->bindValues([':name' => $model->name]);
  24. $result = $sql->queryAll();
  25. $arr = array();
  26. foreach ($result as $key=>$value)
  27. {
  28. $arr[] = $value['name'].", ";
  29. }
  30. return implode(",",$arr);
  31. }
  32. ],
  33. //'date_start',
  34. //'date_stop',
  35. [
  36. 'class' => 'yii\grid\ActionColumn',
  37. 'template' => '{view}',
  38. 'buttons' => [
  39. 'view' => function ($url,$model,$key) {
  40. return Html::a('', '/auctions/index?AuctionsSearch[name]='.$model->name,['class' => 'glyphicon glyphicon-eye-open']);
  41. },
  42. ],
  43. ],
  44. ],
  45. ]);
  46. ?>
  47. </div></div>