Ejemplo n.º 1
0
 public function init()
 {
     $this->name = "Список переходов";
     $this->modelShowAttribute = "phrase";
     $this->modelClassName = CmsSearchPhrase::className();
     parent::init();
 }
Ejemplo n.º 2
0
<?php

/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 01.09.2015
 */
?>

<?php 
echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => (new \yii\db\Query())->select(['id', 'phrase', 'count(*) as count'])->from(\skeeks\cms\models\CmsSearchPhrase::tableName())->groupBy(['phrase'])->orderBy(['count' => SORT_DESC])]), 'columns' => [['attribute' => 'phrase', 'label' => \Yii::t('app', 'Search Phrase')], ['attribute' => 'count', 'label' => \Yii::t('app', 'The number of requests')]]]);
?>
<!--

-->
Ejemplo n.º 3
0
 /**
  * Удаление старых поисковых запросов
  */
 public function actionClearSearchPhrase()
 {
     if (\Yii::$app->cmsSearch->phraseLiveTime) {
         $deleted = CmsSearchPhrase::deleteAll(['<=', 'created_at', \Yii::$app->formatter->asTimestamp(time()) - (int) \Yii::$app->cmsSearch->phraseLiveTime]);
         \Yii::info("Удалено поисковых запросов: " . $deleted);
     }
 }
Ejemplo n.º 4
0
 /**
  * @param ActiveDataProvider $dataProvider
  */
 public function logResult(ActiveDataProvider $dataProvider)
 {
     $pages = 1;
     if ($dataProvider->totalCount > $dataProvider->pagination->pageSize) {
         $pages = round($dataProvider->totalCount / $dataProvider->pagination->pageSize);
     }
     $searchPhrase = new CmsSearchPhrase(['phrase' => $this->searchQuery, 'result_count' => $dataProvider->totalCount, 'pages' => $pages]);
     $searchPhrase->save();
 }