index.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. /* @var $this yii\web\View */
  5. /* @var $dataProvider yii\data\ActiveDataProvider */
  6. $this->title = Yii::t('common', 'Spiders');
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <?php $this->beginBlock('content-header') ?>
  10. <?= $this->title . ' ' . Html::a(Yii::t('common', 'Create Spider'), ['create'], ['class' => 'btn btn-success']) ?>
  11. <?php $this->endBlock() ?>
  12. <div class="box box-success">
  13. <div class="box-body">
  14. <?= GridView::widget([
  15. 'dataProvider' => $dataProvider,
  16. 'columns' => [
  17. 'id',
  18. 'name',
  19. 'title',
  20. 'domain',
  21. 'target_category',
  22. // 'target_category_url',
  23. [
  24. 'class' => 'common\helpers\DiyActionColumn',
  25. 'template' => '{view} {update} {delete} {crawl}',
  26. 'buttons' => [
  27. 'crawl' => function($url, $model, $key) {
  28. return Html::a('采集', $url, ['data-method' => 'post', 'data-ajax' => 1, 'class' => 'btn btn-default btn-xs']);
  29. }
  30. ]
  31. ],
  32. ],
  33. ]); ?>
  34. </div>
  35. </div>