12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- $this->title="Новости";
- //тест (заменить на новостьи дня и по календарику)
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\News::getMainView()->orderBy(["dt_pub"=>SORT_DESC])->limit(50),
- "pagination" =>[
- "pageSize"=>50
- ],
- ]
- );
- /*
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\base\News::find()->orderBy(["dt_pub"=>SORT_DESC])->limit(50),
- "pagination" =>[
- "pageSize"=>50
- ],
- ]
- );
- */
- /**** ****/
- ?>
- <div class="table-responsive-sm custom-range-badge">
- <table class="table table-hover table-Light">
- <thead class="bg-gray table-sm">
- <tr>
- <th scope="col" class="col-md-1 col-sm-2 col-xs-5">время</th>
- <th scope="col" class="col-md-1 col-sm-2 col-xs-5">фото</th>
- <th scope="col">заголовок</th>
- <th scope="col">статусы</th>
- <th scope="col">управление</th>
- </tr>
- </thead>
- <tbody>
- <?
- foreach( $newsDataProvider->getModels() as $item ){
- // print_r($item->getTopics());
- $strTopics = '';
- foreach( $item->getTopics()->primaryModel->topics as $topic ){
- $strTopics = $strTopics." [".$topic->title."]";
- }
- $strbage = '';
- if( $item->verifed == 'Y' ) $strbage .= '<span class="badge badge-success font-weight-normal">проверено</span><br>';
- if( $item->top == 'Y' ) $strbage .= '<span class="badge badge-primary font-weight-normal">важная</span><br>';
- if( $item->NH == 'Y' ) $strbage .= '<span class="badge badge-info font-weight-normal">НЧ</span><br>';
- ?>
- <tr>
- <th scope="row" class="text-nowrap"><?=date("h:i d-m-Y",strtotime($item->dt_pub))?></th>
- <td><img src="/images/news/news/<?=$item->id?>.jpg"></td>
- <td><?=$item->title?><br><small><?=$strTopics?><br><?=$item->editors?></small></td>
- <td><?=$strbage?></td>
- <td><div class="btn-group btn-group-toggle" data-toggle="a" role="group"><a href="new?id=<?=$item->id?>" title="Править" role="button" class="btn btn-secondary btn-sm"><i class="far fa-edit"></i></a><a href="" title="спрятать" role="button" class="btn btn-secondary btn-sm"><i class="far fa-eye-slash"></i></a><a href="" role="button" class="btn btn-secondary btn-sm">в топ</a><a href="/news/<?=$item->id?>" title="открыть на сайте" role="button" class="btn btn-secondary btn-sm" target="_blank"><i class="far fa-window-restore"></i></a></div></td>
- </tr>
- <?
- // <pre>
- // print_r($item);
- // </pre>
- ?>
- <?
- }
- ?>
- </tbody>
- </table>
- </div>
- <?php
- //print_r($newsDataProvider->getModels());
|