123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- $this->title="Сюжеты";
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>\app\models\base\Story::find()->orderBy(["order"=>SORT_ASC])->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);
- //return;
- $strbage = '<span class="badge badge-success">норма</span><br>';
- $mark = '';
- if( $item->show == 'N' ){
- $mark = ' class="table-dark"';
- $strbage .= '<span class="badge badge-dark">Не показывать на сайте</span><br>';
- }
- if( $item->active == 0 ){
- $mark = ' class="table-secondary"';
- $strbage .= '<span class="badge badge-secondary">Не видно ни кому(del)</span><br>';
- }
- ?>
- <tr<?=$mark?>>
- <th scope="row" class="text-nowrap"><?=$item->id?></th>
- <td><img src="/story-images/<?=$item->id?>_size2.jpg" class="img-thumbnail" onerror="this.src='/images/topics/36_size2.jpg'"></td>
- <td><?=$item->title?><br><small><?=$item->description?></small></td>
- <td><?=$strbage?></td>
- <td><div class="btn-group btn-group-toggle" data-toggle="a" role="group">
- <a href="storyupdate?id=<?=$item->id?>" title="Править" role="button" class="btn btn-secondary btn-sm"><i class="far fa-edit"></i></a>
- <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>
- <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>
- <?
- if( Yii::$app->user->can('admin') ){
- ?>
- <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>
- <?
- }
- ?>
- <a href="/story/<?=$item->url?>" title="открыть на сайте" role="button" class="btn btn-secondary btn-sm"><i class="far fa-window-restore"></i></a>
- </div></td>
- </tr>
- <?
- // <pre>
- // print_r($item);
- // </pre>
- ?>
- <?
- }
- ?>
- </tbody>
- </table>
- </div>
- <?php
- //print_r($newsDataProvider->getModels());
|