storyList.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. $this->title="Сюжеты";
  3. $newsDataProvider = new \yii\data\ActiveDataProvider(
  4. [
  5. "query"=>\app\models\base\Story::find()->orderBy(["order"=>SORT_ASC])->limit(50),
  6. "pagination" =>[
  7. "pageSize"=>50
  8. ],
  9. ]
  10. );
  11. ?>
  12. <div class="table-responsive-sm custom-range-badge">
  13. <table class="table table-hover table-Light">
  14. <thead class="bg-gray table-sm">
  15. <tr>
  16. <th scope="col" class="col-md-1 col-sm-2 col-xs-5">#</th>
  17. <th scope="col" class="col-md-1 col-sm-2 col-xs-5">фото</th>
  18. <th scope="col">заголовок</th>
  19. <th scope="col">статусы</th>
  20. <th scope="col">управление</th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. <?
  25. foreach( $newsDataProvider->getModels() as $item ){
  26. // print_r($item);
  27. //return;
  28. $strbage = '<span class="badge badge-success">норма</span><br>';
  29. $mark = '';
  30. if( $item->show == 'N' ){
  31. $mark = ' class="table-dark"';
  32. $strbage .= '<span class="badge badge-dark">Не показывать на сайте</span><br>';
  33. }
  34. if( $item->active == 0 ){
  35. $mark = ' class="table-secondary"';
  36. $strbage .= '<span class="badge badge-secondary">Не видно ни кому(del)</span><br>';
  37. }
  38. ?>
  39. <tr<?=$mark?>>
  40. <th scope="row" class="text-nowrap"><?=$item->id?></th>
  41. <td><img src="/story-images/<?=$item->id?>_size2.jpg" class="img-thumbnail" onerror="this.src='/images/topics/36_size2.jpg'"></td>
  42. <td><?=$item->title?><br><small><?=$item->description?></small></td>
  43. <td><?=$strbage?></td>
  44. <td><div class="btn-group btn-group-toggle" data-toggle="a" role="group">
  45. <a href="storyupdate?id=<?=$item->id?>" title="Править" role="button" class="btn btn-secondary btn-sm"><i class="far fa-edit"></i></a>
  46. <a href="storyshow?id=<?=$item->id?>" title="спрятать в меню" role="button" class="btn btn-secondary btn-sm"><i class="fa <?=($item->show == 'N')?'fa-eye-slash':'fa fa-eye'?>"></i></a>
  47. <a href="storyactive?id=<?=$item->id?>" title="не видно ни кому" role="button" class="btn btn-secondary btn-sm"><i class="fa <?=($item->active)?'fa-play':'fa fa-stop'?>"></i></a>
  48. <?
  49. if( Yii::$app->user->can('admin') ){
  50. ?>
  51. <a href="storydel?id=<?=$item->id?>" role="button" class="btn btn-secondary btn-sm" onClick="return confirm('Удалить?')" title="удалить"><i class="fa fa-trash"></i></a>
  52. <?
  53. }
  54. ?>
  55. <a href="/story/<?=$item->url?>" title="открыть на сайте" role="button" class="btn btn-secondary btn-sm"><i class="far fa-window-restore"></i></a>
  56. </div></td>
  57. </tr>
  58. <?
  59. // <pre>
  60. // print_r($item);
  61. // </pre>
  62. ?>
  63. <?
  64. }
  65. ?>
  66. </tbody>
  67. </table>
  68. </div>
  69. <?php
  70. //print_r($newsDataProvider->getModels());