1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

screen and refers templated

This commit is contained in:
Jimmi08 2018-01-24 22:26:40 +01:00
parent c4e3fdb515
commit 13f11e31a2
3 changed files with 103 additions and 66 deletions

View File

@ -35,7 +35,7 @@ class log_url // plugin-folder + '_url'
$config['others'] = array(
'alias' => 'stats',
'regex' => '^{alias}/\?([\d]*)$', // matched against url, and if true, redirected to 'redirect' below.
'regex' => '^{alias}/\?(.*)$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => '{alias}', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_PLUGIN}log/stats.php?$1', // file-path of what to load when the regex returns true.

View File

@ -876,7 +876,8 @@ class siteStats
{
$percentage = round(($info['ttl']/$totalv) * 100, 2);
$var = array('ITEM_URL' => $info['url'],
$var = array('ITEM_URL' => $info['url'],
'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' /> " : ""),
'ITEM_KEY' => $this->getLabel($key),
'ITEM_BAR' => $this -> bar($percentage, $info['ttl']." [".$info['unq']."]"),
'ITEM_PERC'=> $percentage,
@ -951,7 +952,8 @@ class siteStats
if (!$info['url'] && (($key == 'index') || (strpos($key,':index') !== FALSE))) $info['url'] = e_HTTP.'index.php'; // Avoids empty link
$percentage = round(($info['ttlv']/$total) * 100, 2);
$var = array('ITEM_URL' => $info['url'],
$var = array('ITEM_URL' => $info['url'],
'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' /> " : ""),
'ITEM_KEY' => $this->getLabel($key,true),
'ITEM_TITLE' => $this->getLabel($key),
'ITEM_BAR' => $this->bar($percentage, $info['ttlv']),
@ -1438,17 +1440,12 @@ class siteStats
}
$total = array_sum($screenArray);
$text .= "
<table class='table table-striped fborder' style='width: 100%;'>\n
<tr>
<th class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</th>
</tr>
<tr>
<th class='fcaption' style='width: 20%;'><a title='".($this -> order ? "sort by total" : "sort alphabetically")."' href='".e_SELF."?6".($this -> order ? "" : ".1" )."'>".ADSTAT_L29."</a></th>
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</th>
<th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n";
$var = array('START_CAPTION' => $this->browser_headings[$act].$pars['hdg_extra'],
'START_TITLE' => ($this -> order ? "sort by total" : "sort alphabetically"),
'START_URL' => e_SELF."?6".($this -> order ? "" : ".1" ),
);
$text .= $tp->simpleParse($template['start'], $var);
if (count($screenArray))
{
foreach($screenArray as $key => $info)
@ -1456,20 +1453,24 @@ class siteStats
if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key))
{
$percentage = round(($info/$total) * 100, 2);
$text .= "<tr>
<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN_ABS."log/images/screen.png' alt='' style='vertical-align: middle;' /> ".$key."</td>".
($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")."
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td>
</tr>\n";
$var = array(
'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/screen.png' alt='' style='vertical-align: middle;' /> " : ""),
'ITEM_KEY' => $key,
'ITEM_BAR' => $this -> bar($percentage, $info),
'ITEM_PERC'=> $percentage,
);
$text .= $tp->simpleParse($template['item'], $var);
}
}
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>{$total}</td><td class='forumheader'></td></tr>\n";
//before: $var = array('TOTAL' => $total,
$var = array('TOTAL' => number_format($total));
$text .= $tp->simpleParse($template['end'], $var);
}
else
{
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
$text .= $tp->simpleParse($template['nostatistic']);
}
$text .= "</table><br />";
}
return $text;
}
@ -1525,17 +1526,13 @@ class siteStats
{
$total += $info['ttl'];
}
$text .= "
<table class='table table-striped fborder' style='width: 100%;'>\n
<tr>
<th class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</th>
</tr>
<tr>
<th class='fcaption' style='width: 40%;'><a title='".($this -> order ? "show cropped url" : "show full url")."' href='".e_SELF."?7".($this -> order ? "" : ".1" )."'>".ADSTAT_L30."</a></th>
<th class='fcaption' style='width: 50%;' colspan='2'>".ADSTAT_L21."</th>
<th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n";
$var = array('START_CAPTION' => $this->browser_headings[$act].$pars['hdg_extra'],
'START_TITLE' => $this -> order ? "show cropped url" : "show full url",
'START_URL' => e_SELF."?7".($this -> order ? "" : ".1" ),
);
$text .= $tp->simpleParse($template['start'], $var);
$count = 0;
if (count($statArray))
{
@ -1546,24 +1543,30 @@ class siteStats
{
$key = substr($key, 0, 50)." ...";
}
$text .= "<tr>
<td class='forumheader3'><img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' /> <a href='".$info['url']."' rel='external'>".$key."</a></td>
<td class='forumheader3'>".$this -> bar($percentage, $info['ttl'])."</td>
<td class='forumheader3' style='text-align: center;'>".$percentage."%</td>
</tr>\n";
$var = array(
'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' /> " : ""),
'ITEM_URL' => $info['url'],
'ITEM_KEY' => $key,
'ITEM_BAR' => $this -> bar($percentage, $info['ttl']),
'ITEM_PERC'=> $percentage,
);
$text .= $tp->simpleParse($template['item'], $var);
$count++;
if($count == e107::getPref('statDisplayNumber'))
{
break;
}
}
$text .= "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td><td class='forumheader' style='text-align: center;'>{$total}</td><td class='forumheader'></td></tr>\n";
//before: $var = array('TOTAL' => $total,
$var = array('TOTAL' => number_format($total));
$text .= $tp->simpleParse($template['end'], $var);
}
else
{
$text .= "<tr><td class='fcaption' colspan='4' style='text-align:center'>".ADSTAT_L25."</td></tr>\n";
$text .= $tp->simpleParse($template['nostatistic']);
}
$text .= "</table><br />";
}
return $text;
}

View File

@ -17,18 +17,22 @@ $LOG_TEMPLATE['todaysvisits']['start'] =
<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";
</tr>";
$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";
"<tr>
<td class='forumheader3' style='width: 20%;text-align:left'><img src='{ITEM_IMAGE}' alt='' style='vertical-align: middle;' /><a href='{ITEM_URL}'>{ITEM_KEY}</a></td>
<td class='forumheader3' style='width: 70%;'>{ITEM_BAR}</td>
<td class='forumheader3' style='width: 10%; text-align: center;'>{ITEM_PERC}%</td>
</tr>";
$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>
"<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>";
@ -48,17 +52,19 @@ $LOG_TEMPLATE['alltimevisits_total']['start'] = "
</tr>\n";
$LOG_TEMPLATE['alltimevisits_total']['item'] = "
<tr>
<td class='forumheader3' >
{ITEM_DELETE}
<img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' />
<a href='{ITEM_URL}' title='{ITEM_TITLE}' >{ITEM_KEY}</a>
</td>
<td class='forumheader3' >{ITEM_BAR}</td>
<td class='forumheader3' style='text-align: center;'>{ITEM_PERC}%</td>
</tr>\n
<td class='forumheader3' >{ITEM_DELETE}{ITEM_IMAGE}
<a href='{ITEM_URL}' title='{ITEM_TITLE}' >{ITEM_KEY}</a></td>
<td class='forumheader3' >{ITEM_BAR}</td>
<td class='forumheader3' style='text-align: center;'>{ITEM_PERC}%</td>
</tr>
";
$LOG_TEMPLATE['alltimevisits_total']['end'] = "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td>
<td class='forumheader' style='text-align: center;'>{TOTAL}</td><td class='forumheader'></td></tr>\n</table></div>";
$LOG_TEMPLATE['alltimevisits_total']['end'] = "
<tr>
<td class='forumheader' colspan='2'>".ADSTAT_L21."</td>
<td class='forumheader' style='text-align: center;'>{TOTAL}</td><td class='forumheader'></td>
</tr>
</table>
</div>";
$LOG_TEMPLATE['alltimevisits_unique']['start'] = "<br />
<div class='table-responsive' id='alltimevisits_unique'>
@ -131,7 +137,7 @@ $LOG_TEMPLATE['oses']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['domains']['start'] = "
<div class='table-responsive' id='oses'>
<div class='table-responsive' id='domains'>
<table class='table table-striped fborder' style='width: 100%;'>
<tr><td class='fcaption' colspan='4' style='text-align:center'>{START_CAPTION}</td></tr>
<tr><td class='fcaption' style='width: 20%;'>
@ -155,13 +161,41 @@ $LOG_TEMPLATE['domains']['end'] = "
$LOG_TEMPLATE['domains']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['screens']['start'] = "";
$LOG_TEMPLATE['screens']['item'] = "";
$LOG_TEMPLATE['screens']['end'] = "";
$LOG_TEMPLATE['screens']['start'] =
"<div class='table-responsive' id='screens'>
<table class='table table-striped fborder' style='width: 100%;'>\n
<tr>
<th class='fcaption' colspan='4' style='text-align:center'>{START_CAPTION}</th>
</tr>\n
<tr>
<th class='fcaption' style='width: 20%;'>
<a title='{START_TITLE}' href='{START_URL}'>".ADSTAT_L26."</a>
</th>
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L21."</th>\n
<th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n";
$LOG_TEMPLATE['screens']['item'] = $LOG_TEMPLATE['browsers']['item'];
$LOG_TEMPLATE['screens']['end'] = $LOG_TEMPLATE['browsers']['end'];
$LOG_TEMPLATE['screens']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['refers']['start'] = $LOG_TEMPLATE['browsers']['start'];
$LOG_TEMPLATE['refers']['item'] = "
<tr>
<td class='forumheader3'><img src='{ITEM_IMAGE}' alt='' style='vertical-align: middle;' />
<a href='{ITEM_URL}' rel='external'>{ITEM_KEY}</a></td>
<td class='forumheader3'>{ITEM_BAR}</td>
<td class='forumheader3' style='text-align: center;'>{ITEM_PERC}%</td>
</tr>";
$LOG_TEMPLATE['refers']['end'] = "
<tr>
<td class='forumheader' colspan='2'>".ADSTAT_L21."</td>
<td class='forumheader' style='text-align: center;'>{TOTAL}</td>
<td class='forumheader'>&nbsp;</td>
</tr>
</table><br /></div>";
$LOG_TEMPLATE['refers']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['refers']['start'] = "";
$LOG_TEMPLATE['refers']['item'] = "";
$LOG_TEMPLATE['refers']['end'] = "";
$LOG_TEMPLATE['queries']['start'] = "";
$LOG_TEMPLATE['queries']['item'] = "";