1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

TodaysVisits templated

This commit is contained in:
Jimmi08 2018-01-19 22:59:49 +01:00
parent 3c41e83227
commit 9f8c6ce698
2 changed files with 54 additions and 11 deletions

View File

@ -24,6 +24,7 @@ e107::includeLan(e_PLUGIN.'log/languages/'.e_LANGUAGE.'.php');
$bar = (file_exists(THEME.'images/bar.png') ? THEME_ABS.'images/bar.png' : e_IMAGE_ABS.'generic/bar.png');
$mes = e107::getMessage();
e107::css('inline', "
/* Site Stats */
@ -840,7 +841,10 @@ class siteStats
*/
function renderTodaysVisits($do_errors = FALSE)
{
$do_errors = $do_errors && ADMIN && getperms('P'); // Only admins can see page errors
$tp = e107::getParser();
$template = e107::getTemplate('log', 'log', 'todaysvisits', true, true);
$do_errors = $do_errors && ADMIN && getperms('P'); // Only admins can see page errors
// Now run through and keep either the non-error pages, or the error pages, according to $do_errors
$totalArray = array();
@ -864,23 +868,29 @@ class siteStats
$totalu += $info['unq'];
}
$text = "<table class='table table-striped fborder' style='width: 100%;'>
<tr>
<th class='fcaption' style='width: 20%;'>".ADSTAT_L19."</th>
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</th>
<th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n";
$text = $template['start'];
foreach($totalArray as $key => $info)
{
if($info['ttl'])
{
{
$percentage = round(($info['ttl']/$totalv) * 100, 2);
$text .= "<tr>\n<td class='forumheader3' style='width: 20%;text-align:left'><img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."'>".$this->getLabel($key)."</a>
</td>\n<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info['ttl']." [".$info['unq']."]")."</td>\n<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>\n</tr>\n";
$var = array('ITEM_URL' => $info['url'],
'ITEM_KEY' => $this->getLabel($key),
'ITEM_BAR' => $this -> bar($percentage, $info['ttl']." [".$info['unq']."]"),
'ITEM_PERC'=> $percentage,
);
$text .= $tp->simpleParse($template['item'], $var);
}
}
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>{$totalv} [{$totalu}]</td><td class='forumheader'></td></tr></table>";
$var = array('TOTALV' => $totalv,
'TOTALU' => $totalu,
);
$text .= $tp->simpleParse($template['end'], $var);
return $text;
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* News menus templates
*/
if (!defined('e107_INIT')) exit;
$LOG_TEMPLATE['todaysvisits']['start'] =
"<div class='table-responsive' id='log-todaysvisits'>
<table class='table table-striped fborder' style='width: 100%;'>
<tr>
<th class='fcaption' style='width: 20%;'>".ADSTAT_L19."</th>
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</th>
<th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n";
$LOG_TEMPLATE['todaysvisits']['item'] =
"<tr>\n<td class='forumheader3' style='width: 20%;text-align:left'>
<img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' />
<a href='{ITEM_URL}'>{ITEM_KEY}</a>
</td>\n<td class='forumheader3' style='width: 70%;'>{ITEM_BAR}</td>
<td class='forumheader3' style='width: 10%; text-align: center;'>{ITEM_PERC}%</td>\n</tr>\n";
$LOG_TEMPLATE['todaysvisits']['end'] =
"<tr><td class='forumheader' colspan='2'>".ADSTAT_L21." [".ADSTAT_L22."]</td><td class='forumheader' style='text-align: center;'>{TOTALV} [{TOTALU}]</td>
<td class='forumheader'></td></tr></table>
</div>";