index.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * @var $topic NewsTopic | NULL
  4. * @var $this \yii\web\View
  5. * @var $news_query \yii\db\ActiveQuery
  6. */
  7. use app\models\base\NewsTopic;
  8. $this->params['breadcrumbs'] = [
  9. [
  10. "text"=>"НОВОСТИ",
  11. "url"=>"/news"
  12. ]
  13. ];
  14. if($topic instanceof NewsTopic){
  15. $this->params['breadcrumbs'][] =
  16. [
  17. "text"=>$topic->title,
  18. "url"=>$topic->url
  19. ];
  20. }
  21. ?>
  22. <div class="archive">
  23. <div class="row">
  24. <div class="col-md-3">
  25. <div class="topics-list">
  26. <div class="topics-continer">
  27. <?php
  28. echo Yii::$app->cache->getOrSet("archive_rubrics-{$topic->id}",function () use($topic){
  29. return \yii\widgets\ListView::widget([
  30. "dataProvider" => new \yii\data\ActiveDataProvider([
  31. "query"=>NewsTopic::find()->andWhere(["show"=>"Y","active"=>1])->orderBy(["order"=>SORT_DESC]),
  32. "pagination" =>[
  33. "pageSize"=>0
  34. ],
  35. ]),
  36. 'options' => [
  37. 'tag' => "ul",
  38. 'class' => 'list-wrapper',
  39. 'id' => 'list-wrapper',
  40. ],
  41. "itemOptions"=>[
  42. "tag"=>"li"
  43. ],
  44. "itemView" => function($model) use($topic) {return \yii\helpers\Html::a($model->title,["news/{$model->url}"],['class'=>$model->id==$topic->id?"active":""]);},
  45. "layout" => "{items}"
  46. ]);
  47. },600);
  48. ?>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="col-md-9">
  53. <div class="news-list">
  54. <?=$this->render("/layouts/breadcrumbs")?>
  55. <?=$this->render("archive/filters")?>
  56. <?php
  57. echo Yii::$app->cache->getOrSet("archive_news-{$topic->id}",function () use($news_query){
  58. return \yii\widgets\ListView::widget([
  59. "dataProvider" => new \yii\data\ActiveDataProvider([
  60. "query"=>$news_query,
  61. "pagination" =>[
  62. "pageSize"=>20
  63. ],
  64. ]),
  65. 'options' => [
  66. 'tag' => "ul",
  67. 'class' => 'list-wrapper',
  68. 'id' => 'list-wrapper',
  69. ],
  70. "itemOptions"=>[
  71. "tag"=>"li"
  72. ],
  73. "itemView" => "archive/_archive_item",
  74. "layout" => "{items}{pager}"
  75. ]);
  76. },1);
  77. ?>
  78. </div>
  79. </div>
  80. </div>
  81. </div>