beginCache("dashestats", ['duration' => 60*2])) { $this->title="Статистика"; $this->params['breadcrumbs'][] = ['label' => 'Статистика', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $y = date("Y")*1; $m = date("m"); // $d = cal_days_in_month(CAL_GREGORIAN, $m, $y); $d = date("d"); $m = $m<10?"0$m":$m; $d = $d<10?"0$d":$d; $b_date = date("Y-".$m."-01 00:00:00"); $e_date = date("Y-".$m."-".$d." H:i:59"); //$newsonmath $cmd = Yii::$app->db->createCommand("select count(id) as c, DATE_FORMAT(dt_pub, '%d') as day from news where `dt_pub` BETWEEN '".$b_date."' AND '".$e_date."' and active = 'Y' group by day")->queryAll(); $newsonday = ''; $mathday = ''; $min = 100000; $max = 0; $i = 0; $maxd = ''; $mind = ''; $sum = 0; $a= []; foreach( $cmd as $item ){ $i++; $sum += $item['c']*1; $newsonday .= $item['c'].','; $mathday .= '"'.$item['day'].'"'.','; $max = ( $item['c'] > $max )?$item['c']:$max; $maxd = ( $item['c'] > $max )?$item['d']:$maxd; if( date("d") != $item['day'] ) $min = ( $item['c'] < $min )?$item['c']:$min; if( date("d") != $item['day'] ) $mind = ( $item['c'] < $min )?$item['d']:$mind; $a[] = $item['c']; } sort($a); $count = sizeof($a); // cache the count $index = floor($count/2); // cache the index if (!$count) { $mid = ($max+$min)/2; } elseif ($count & 1) { // count is odd $mid = $a[$index]; } else { // count is even $mid = ($a[$index-1] + $a[$index]) / 2; } $authors = Yii::$app->db->createCommand("select e, count(e) as c from (SELECT SUBSTRING_INDEX(`editors`,',',1) as e FROM `news` WHERE `dt_pub` BETWEEN '".$b_date."' AND '".$e_date."' and active = 'Y') t where 1 group by e order by e")->queryAll(); $old_author_name = ['kondakov' => 'Вячеслав Кондаков*','bers'=>'Евгений Берсенёв','kuznecov' =>'Артём Кузнецов*', 'katya'=>'Екатерина Смолихина*', 'elena'=>'Елена Лепезина*', 'cherdanceva'=>'Александра Черданцева*']; // рубрики заполнены $rubric = Yii::$app->db->createCommand("select count(tr.topic_id) as c, nt.title as t from news as n, news_topic_relation as tr, news_topic as nt where `dt_pub` BETWEEN '".$b_date."' AND '".$e_date."' and n.active = 'Y' and n.id = tr.news_id and tr.topic_id = nt.id and nt.`active`=1 and nt.`show`='Y' group by tr.topic_id")->queryAll(); // количество рубрик $crubric = Yii::$app->db->createCommand("select count(id) as c from news_topic where `active`=1 and `show`='Y'")->queryOne(); $sumr = $crubric['c']; $cnews = Yii::$app->db->createCommand("select count(id) as c from news where `dt_pub` BETWEEN '".$b_date."' AND '".$e_date."' and active = 'Y'")->queryOne(); $cntnews = $cnews['c']; $cnewsp = Yii::$app->db->createCommand("select count(id) as c from news where `dt_pub` BETWEEN DATE_SUB('".$b_date."', INTERVAL 1 MONTH) AND DATE_SUB('".$e_date."', INTERVAL 1 MONTH) and active = 'Y'")->queryOne(); $cntnewsp = $cnewsp['c']; $cnewsy = Yii::$app->db->createCommand("select count(id) as c from news where `dt_pub` BETWEEN '".$y."-01-01 00:00:00' AND '".$e_date."' and active = 'Y'")->queryOne(); $cntnewsy = $cnewsy['c']; $cnewsyy = Yii::$app->db->createCommand("select count(id) as c from news where `dt_pub` BETWEEN DATE_SUB('".$b_date."', INTERVAL 1 YEAR) AND '".$e_date."' and active = 'Y'")->queryOne(); $cntnewsyy = $cnewsyy['c']; $now = time(); $ndate = strtotime( $y."-01-01"); $datediff = $now - $ndate; $daysp = round($datediff / (60 * 60 * 24)); $edate = strtotime( $y."-12-31"); $datediff = $now - $edate; $dayso = -round($datediff / (60 * 60 * 24)); $newsinterpolite = round($cntnewsy*$dayso/$daysp); $rate = Yii::$app->db->createCommand("select counter from reaction_button limit ".$cntnews)->queryAll(); $cnt = [0,0,0,0,0,0]; $sumrb = 0; foreach( $rate as $item ){ $a = json_decode( $item['counter'] ); $cnt[0] += $a[0]; $cnt[1] += $a[1]; $cnt[2] += $a[2]; $cnt[3] += $a[3]; $cnt[4] += $a[4]; $cnt[5] += $a[5]; $sumrb += array_sum( $a ); } $cntcomment = Yii::$app->db->createCommand("select count(id) as c from comments where `created_at` BETWEEN '".$b_date."' AND '".$e_date."' and visible = 'Y'")->queryOne(); $cnt_comment = $cntcomment['c']; $cntcomment = Yii::$app->db->createCommand("select count(id) as c from comments where `created_at` BETWEEN '".$b_date."' AND '".$e_date."' and visible = 'N'")->queryOne(); $cnt_commenth = $cntcomment['c']; ?>
CPU нагрузка %
Запросов в секунду
Наибольшее число новостей
Минимум новостей
Выпуск новостей по месяцу

выпуски с по

Дни

Лучший день /
Худший день /
среднее число новостей /
Медианное значение /

Активность авторов

# Автор Progress Label количество
%

Активность рубрик

# Рубрика Progress Label количество
%

Рубрики

Реакция посетителей на статьи

  • Product Image

Всего комментариев

More info

Опубликованных комментариев

More info

Заблоченных комментариев

More info
endCache(); }