Вход Регистрация
Файл: wapxl.ru/top/day/24.php
Строк: 81
<?php

// Определяем текущуую дату
$date = isset ($_REQUEST['date']) ? func::checkin($_REQUEST['date']) : date("Y-m-d",core::$realtime);

$daten date("Y-m-d",(strtotime($date)-3600*24));

$datup date("Y-m-d",(strtotime($date)+3600*24));


if(
$datestart<=$daten$datens '<a href="?stat='.$stat.'&amp;order='.$order.'&amp;date='.$daten.'"><< '.$daten.'</a> | ';


if(
$date<date("Y-m-d",core::$realtime)) $dateup '| <a href="?stat='.$stat.'&amp;order='.$order.'&amp;date='.$datup.'">'.$datup.' >></a>';

echo 
'<div class="col-md-12 col-sm-12 col-xs-12"><div class="panel panel-default">
<b>отчет:</b> Количество посетителей и просмотров за час
<div class="panel-heading">'
.$datens.'<b>'.$date.'</b> '.$dateup.'</div>';

// Проверяем есть ли в базе выбранная дата
$dates core:: $db -> queryFetch("SELECT * FROM `top_count_hour` WHERE `url`=? and date =? LIMIT 1;", array($url,$date));
if(!isset(
$dates['id'])){
echo 
"<br /><b>Статистики за выбранный вами периoд не найдено.</b><br />";

}else{


echo 
'<div class="col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-blu">
<div class="panel-heading"><b>График</b>'
;

/*?>
<form action="index.php?act=1" method="POST" onsubmit="window.open('','from_form','width=600,height=500,scrollbars=yes')" action="index.php" target="from_form">
    <input type="submit" value="Посетители" />
</form>
<?*/

echo '</div>
'
;


?>
 <script>

var chart;


AmCharts.monthNames = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'];

AmCharts.shortMonthNames = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'];

  // load the data
  var chartData = AmCharts.loadJSON('/top/day/24_graph.php?date=<?=$date;?>&url=<?=$url;?>');

var chart = AmCharts.makeChart("graph_dey", {
    "type": "serial",
    "theme": "light",
    "marginRight": 80,
    "dataProvider": chartData,
    "valueAxes": [{
        "position": "left",
        "title": "<?=$date;?>"
    }],
    "graphs": [{
        "id": "g1",
        "fillAlphas": 0.4,
        "valueField": "host",
        "balloonText": "<div style='margin:5px; font-size:19px;'>Посетителей:<b>[[value]]</b></div>",
        "title": "Посетители",
        "lineColor": "#008000",
          "bullet": "round",
        "bulletBorderAlpha": 1,
        "bulletColor": "#008000",
        "bulletSize": 5,
        "hideBulletsCount": 50,
        "fillAlphas": 0
    },{
        "id": "g2",
        "fillAlphas": 0.4,
        "valueField": "hit",
        "balloonText": "<div style='margin:5px; font-size:19px;'>Просмотров:<b>[[value]]</b></div>",
        "title": "Просмотры",
        "lineColor": "#8d1cc6",
          "bullet": "round",
        "bulletBorderAlpha": 1,
        "bulletColor": "#8d1cc6",
        "bulletSize": 5,
        "hideBulletsCount": 50,
        "fillAlphas": 0
    }],
    "chartCursor": {
        "categoryBalloonDateFormat": "JJ:NN",
        "cursorPosition": "mouse"
    },
    "categoryField": "hour",
    "categoryAxis": {
        "minPeriod": "hh",
        "parseDates": true
    },
    "export": {
        "enabled": true,
         "dateFormat": "YYYY-MM-DD HH:NN"
    }
});



// LEGEND
    var legend = new AmCharts.AmLegend();
    chart.addLegend(legend, "legenddiv");



  </script>
   <!-- chart container -->
  <div id="graph_dey" style="width: auto; height: 300px;"></div>
  <div id="legenddiv" style="width: auto; height: auto;">  </div>

<?php

echo '</div></div>';



echo 
'<div class="col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-blu">'
;


echo 
'<div class="panel-heading"><b>Статистика посещений</b></div>
 <div class="table-responsive">
 <table class="table"><thead><tr><th>Время</th><th>Посетители</th><th>Просмотры</th><th>С начала дня</th></tr></thead>
 <tbody> '
;


$r core:: $db -> query("SELECT hour, host, hit FROM `top_count_hour` WHERE url = '".$url."' and date = '".$date."'
  ORDER BY hour asc;"
);

$count_hours 0;


// Получаем количество хостов и хитов
$top_count core:: $db -> queryFetch("SELECT host, hit FROM `top_count` WHERE `url`=? and `date`=? LIMIT 1;", array($url,$date));


while (
$row$r -> fetch()) {

$count_hours++;
// определяем периуд времени
$dat date("H",(strtotime($row['hour'])));
$dat0 date("H",(strtotime($row['hour'])-3600));

// ищем кол-во хостов и хитов с начала дня
$rowhost += $row['host'];
$rowhit += $row['hit'];

// высчитываем процент за текущий час


$hostpr round(($row['host'] / $top_count['host']) * 100);
$hitpr round(($row['hit'] / $top_count['hit']) * 100);

 echo 
'<tr class="success"><td>C '.$dat0.' до '.$dat.'</td><td>'.$row['host'].' <i style = "color:#8C8C8C;">('.$hostpr.'%)</i></td><td>'.$row['hit'].' <i style = "color:#8C8C8C;">('.$hitpr.'%)</i></td><td>'.$rowhost.'/'.$rowhit.'</td></tr> ';
 
//echo '<tr class="info"><td>Просмотры</td><td>0</td><td>@0</td><td>0</td><td>0</td><td>0</td></tr> ';





}

echo 
'<thead><tr><th>Всего</th><th>'.$top_count['host'].' <i style = "color:#8C8C8C;">(100%)</i></th><th>'.$top_count['hit'].' <i style = "color:#8C8C8C;">(100%)</i></th><th>-</th></tr></thead>';
echo 
'<thead><tr><th>В среднем</th><th>'.round($top_count['host']/$count_hours).'</th><th>'.round($top_count['hit']/$count_hours).'</th><th>-</th></tr></thead>';


  echo 
'</tbody>
 </table>
 </div>
'
;
echo 
'</div></div>';
}

?>
Онлайн: 0
Реклама