123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- use app\models\Inquirer;
- use yii\helpers\Html;
- use yii\helpers\Url;
- use yii\grid\ActionColumn;
- use yii\grid\GridView;
- use yii\widgets\LinkPager;
- use yii\data\Pagination;
- $this->title = 'Опросник';
- $this->params['breadcrumbs'][] = $this->title;
- $query = Inquirer::find()->orderBy([ 'id' => SORT_DESC]);
- $count = $query->count();
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>$query,
- "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">заголовок</th>
- <th scope="col">URL</th>
- <th scope="col">статусы</th>
- <th scope="col">управление</th>
- </tr>
- </thead>
- <tbody>
- <?
- $key = 'Inquirer_list';
- // if ($this->beginCache($key, ['duration' => 60*1])) {
- foreach( $newsDataProvider->getModels() as $item ){
- $strbage = '';
- $mark = '';
- if( $item->show == 'Y' ){
- $mark = ' class="table-success"';
- $strbage .= '<span class="badge badge-warning">голосование</span><br>';
- }
- if( $item->active == 'N' ){
- $mark = ' class="table-secondary"';
- $strbage .= '<span class="badge badge-secondary">спрятан</span><br>';
- }
- ?>
- <tr<?=$mark?>>
- <th scope="row" class="text-nowrap"><?=$item->id?></th>
- <td><?=$item->text?><br></td>
- <td><code class="language-plaintext highlighter-rouge nowrap">https://www.amic.ru/inquirer/<?=$item->id?></code></td>
- <td><?=$strbage?></td>
- <td><div class="btn-group btn-group-toggle" data-toggle="a" role="group">
- <a href="/manager/inquirer/update?id=<?=$item->id?>" title="Править" role="button" class="btn btn-secondary btn-sm"><i class="far fa-edit"></i></a>
- <a href="/manager/inquirer/show?id=<?=$item->id?>" title="голосовать" role="button" class="btn btn-secondary btn-sm"><i class="fa <?=($item->show == 'N')?'fa-hourglass-end':'fa-hourglass-start'?>"></i></a>
- <a href="/manager/inquirer/active?id=<?=$item->id?>" title="спрятать" role="button" class="btn btn-secondary btn-sm"><i class="fa <?=($item->active == 'Y')?'fa-play':'fa fa-stop'?>"></i></a>
- </div></td>
- </tr>
- <?
- // <pre>
- // print_r($item);
- // </pre>
- ?>
- <?
- }
- // $this->endCache();
- // }
- ?>
- </tbody>
- </table>
- </div>
- <?php
- $pagination = new Pagination(['totalCount' => $count, 'defaultPageSize' => 50]);
- echo "<nav>";
- echo LinkPager::widget([
- 'pagination' => $pagination,
- // 'class' => 'yii\bootstrap4\LinkPager',
- 'pageCssClass' => 'page-item',
- 'linkOptions' => [ 'class'=>'page-link'],
- 'prevPageCssClass' => 'page-item',
- 'disabledListItemSubTagOptions' => ['tag' => 'a', 'class' => 'page-link'],
- ]);
- //print_r($newsDataProvider->getModels());
- echo "</nav>";
|