1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02: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( $config['others'] = array(
'alias' => 'stats', '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. '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. 'redirect' => '{e_PLUGIN}log/stats.php?$1', // file-path of what to load when the regex returns true.

View File

@@ -877,6 +877,7 @@ class siteStats
$percentage = round(($info['ttl']/$totalv) * 100, 2); $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_KEY' => $this->getLabel($key),
'ITEM_BAR' => $this -> bar($percentage, $info['ttl']." [".$info['unq']."]"), 'ITEM_BAR' => $this -> bar($percentage, $info['ttl']." [".$info['unq']."]"),
'ITEM_PERC'=> $percentage, 'ITEM_PERC'=> $percentage,
@@ -952,6 +953,7 @@ class siteStats
$percentage = round(($info['ttlv']/$total) * 100, 2); $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_KEY' => $this->getLabel($key,true),
'ITEM_TITLE' => $this->getLabel($key), 'ITEM_TITLE' => $this->getLabel($key),
'ITEM_BAR' => $this->bar($percentage, $info['ttlv']), 'ITEM_BAR' => $this->bar($percentage, $info['ttlv']),
@@ -1438,16 +1440,11 @@ class siteStats
} }
$total = array_sum($screenArray); $total = array_sum($screenArray);
$text .= " $var = array('START_CAPTION' => $this->browser_headings[$act].$pars['hdg_extra'],
<table class='table table-striped fborder' style='width: 100%;'>\n 'START_TITLE' => ($this -> order ? "sort by total" : "sort alphabetically"),
<tr> 'START_URL' => e_SELF."?6".($this -> order ? "" : ".1" ),
<th class='fcaption' colspan='4' style='text-align:center'>".$this->browser_headings[$act].$pars['hdg_extra']."</th> );
</tr> $text .= $tp->simpleParse($template['start'], $var);
<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";
if (count($screenArray)) if (count($screenArray))
{ {
@@ -1456,20 +1453,24 @@ class siteStats
if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key)) if(strstr($key, "@") && !strstr($key, "undefined") && preg_match("/(\d+)x(\d+)@(\d+)/", $key))
{ {
$percentage = round(($info/$total) * 100, 2); $percentage = round(($info/$total) * 100, 2);
$text .= "<tr> $var = array(
<td class='forumheader3' style='width: 20%;'><img src='".e_PLUGIN_ABS."log/images/screen.png' alt='' style='vertical-align: middle;' /> ".$key."</td>". 'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/screen.png' alt='' style='vertical-align: middle;' /> " : ""),
($entries == 1 ? "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>" : "<td class='forumheader3' style='width: 70%;'>".$this -> bar($percentage, $info)."</td>")." 'ITEM_KEY' => $key,
<td class='forumheader3' style='width: 10%; text-align: center;'>".$percentage."%</td> 'ITEM_BAR' => $this -> bar($percentage, $info),
</tr>\n"; '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 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; return $text;
} }
@@ -1525,17 +1526,13 @@ class siteStats
{ {
$total += $info['ttl']; $total += $info['ttl'];
} }
$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);
$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";
$count = 0; $count = 0;
if (count($statArray)) if (count($statArray))
{ {
@@ -1546,24 +1543,30 @@ class siteStats
{ {
$key = substr($key, 0, 50)." ..."; $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> $var = array(
<td class='forumheader3'>".$this -> bar($percentage, $info['ttl'])."</td> 'ITEM_IMAGE' => ($image ? "<img src='".e_PLUGIN_ABS."log/images/html.png' alt='' style='vertical-align: middle;' /> " : ""),
<td class='forumheader3' style='text-align: center;'>".$percentage."%</td> 'ITEM_URL' => $info['url'],
</tr>\n"; 'ITEM_KEY' => $key,
'ITEM_BAR' => $this -> bar($percentage, $info['ttl']),
'ITEM_PERC'=> $percentage,
);
$text .= $tp->simpleParse($template['item'], $var);
$count++; $count++;
if($count == e107::getPref('statDisplayNumber')) if($count == e107::getPref('statDisplayNumber'))
{ {
break; 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 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; 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: 20%;'>".ADSTAT_L19."</th>
<th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</th> <th class='fcaption' style='width: 70%;' colspan='2'>".ADSTAT_L20."</th>
<th class='fcaption' style='width: 10%; text-align: center;'>%</th> <th class='fcaption' style='width: 10%; text-align: center;'>%</th>
</tr>\n"; </tr>";
$LOG_TEMPLATE['todaysvisits']['item'] = $LOG_TEMPLATE['todaysvisits']['item'] =
"<tr>\n<td class='forumheader3' style='width: 20%;text-align:left'> "<tr>
<img src='".e_PLUGIN."log/images/html.png' alt='' style='vertical-align: middle;' /> <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>
<a href='{ITEM_URL}'>{ITEM_KEY}</a> <td class='forumheader3' style='width: 70%;'>{ITEM_BAR}</td>
</td>\n<td class='forumheader3' style='width: 70%;'>{ITEM_BAR}</td> <td class='forumheader3' style='width: 10%; text-align: center;'>{ITEM_PERC}%</td>
<td class='forumheader3' style='width: 10%; text-align: center;'>{ITEM_PERC}%</td>\n</tr>\n"; </tr>";
$LOG_TEMPLATE['todaysvisits']['end'] = $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> "<tr>
<td class='forumheader'></td></tr></table> <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>"; </div>";
@@ -48,17 +52,19 @@ $LOG_TEMPLATE['alltimevisits_total']['start'] = "
</tr>\n"; </tr>\n";
$LOG_TEMPLATE['alltimevisits_total']['item'] = " $LOG_TEMPLATE['alltimevisits_total']['item'] = "
<tr> <tr>
<td class='forumheader3' > <td class='forumheader3' >{ITEM_DELETE}{ITEM_IMAGE}
{ITEM_DELETE} <a href='{ITEM_URL}' title='{ITEM_TITLE}' >{ITEM_KEY}</a></td>
<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' >{ITEM_BAR}</td>
<td class='forumheader3' style='text-align: center;'>{ITEM_PERC}%</td> <td class='forumheader3' style='text-align: center;'>{ITEM_PERC}%</td>
</tr>\n </tr>
"; ";
$LOG_TEMPLATE['alltimevisits_total']['end'] = "<tr><td class='forumheader' colspan='2'>".ADSTAT_L21."</td> $LOG_TEMPLATE['alltimevisits_total']['end'] = "
<td class='forumheader' style='text-align: center;'>{TOTAL}</td><td class='forumheader'></td></tr>\n</table></div>"; <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 /> $LOG_TEMPLATE['alltimevisits_unique']['start'] = "<br />
<div class='table-responsive' id='alltimevisits_unique'> <div class='table-responsive' id='alltimevisits_unique'>
@@ -131,7 +137,7 @@ $LOG_TEMPLATE['oses']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['domains']['start'] = " $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%;'> <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' colspan='4' style='text-align:center'>{START_CAPTION}</td></tr>
<tr><td class='fcaption' style='width: 20%;'> <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['domains']['nostatistic'] = $LOG_TEMPLATE['browsers']['nostatistic'];
$LOG_TEMPLATE['screens']['start'] = ""; $LOG_TEMPLATE['screens']['start'] =
$LOG_TEMPLATE['screens']['item'] = ""; "<div class='table-responsive' id='screens'>
$LOG_TEMPLATE['screens']['end'] = ""; <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']['start'] = "";
$LOG_TEMPLATE['queries']['item'] = ""; $LOG_TEMPLATE['queries']['item'] = "";