12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- use app\models\news;
- use yii\helpers\Html;
- use yii\helpers\Url;
- use yii\grid\ActionColumn;
- use yii\widgets\ListView;
- use yii\widgets\ActiveForm;
- use yii\web\View;
- use yii\data\SqlDataProvider;
- /** @var yii\web\View $this */
- /** @var app\models\photoSearch $searchModel */
- /** @var yii\data\ActiveDataProvider $dataProvider */
- $this->title = 'Подписи фото';
- $this->params['breadcrumbs'][] = ['label' => 'Новости', 'url' => ['list']];
- $this->params['breadcrumbs'][] = $this->title;
- $page = trim(Yii::$app->request->get('page'));
- //SELECT DISTINCT SUBSTRING_INDEX(LOWER(`photo_title`),':', -1) as `ph`, count(*) FROM `news` WHERE `photo_title` != '' && `photo_title` != "''" group by ph
- $sql ="SELECT DISTINCT SUBSTRING_INDEX(LOWER(`photo_title`),':', -1) as `ph`, count(*) as c FROM `news` WHERE `photo_title` != '' and `photo_title` != '\'\'' and `dt_pub` > '".Yii::$app->params['delPhotoE']."' group by ph order by c DESC";
- //$query = ActiveRecord::findBySql($sql);
- // print_r($query->asArray()->All());
- //$countSql = 'select count(*) ' . $sql;
- $dataProvider = new SqlDataProvider([
- 'sql' => $sql,
- // 'totalCount' => Yii::$app->db->createCommand($countSql)->queryScalar(),
- 'pagination' => [
- 'pageSize' => 30,
- ],
- ]);
- if ($this->beginCache('fdfsdtf_'.$page, ['duration' => 3600])) {
- ?>
- <div class="content">
- <div class="btn-group" role="group" aria-label="Basic example">
- <button type="button" class="btn btn-success"> </button>
- <button type="button" class="btn btn-primary" name="addalbums"> </button>
- <button type="button" name="del" class="btn btn-dark" value="yes" > </button>
- </div>
- <div class="card-body">
- <table class="table m-0 table-hover table-striped dataTable dtr-inline">
- <thead>
- <tr>
- <th>Заголовки</th>
- <th>Материалов</th>
- </tr>
- </thead>
- <tbody>
- <?= ListView::widget([
- 'dataProvider' => $dataProvider,
- 'options' => [
- 'tag' => "div",
- 'class' => 'list-wrapper',
- 'id' => 'list-wrapper',
- ],
- "itemOptions"=>[
- "tag"=>"tr",'class' => 'dtr-control',
- ],
- "itemView" => "_itemtitle",
- "layout" => "\n{items}\n{pager}\n{summary}",
- 'pager' => [
- 'prevPageCssClass' => 'page-item',
- 'firstPageLabel' => 'Начало',
- 'lastPageLabel' => 'Конец',
- 'linkOptions' => [ 'class'=>'page-link'],
- 'pageCssClass' => 'page-item',
- 'disabledListItemSubTagOptions' => ['tag' => 'a', 'class' => 'page-link'],
- ]
- ]) ?>
- </tbody>
- </table>
- </div>
- </div>
- <?
- $this->endCache();
- }
|