// update tabs stats

This commit is contained in:
Sarah Lorenzini
2013-09-18 17:47:42 +02:00
parent 154658befd
commit 5621a3b039
3 changed files with 446 additions and 275 deletions
+63 -42
View File
@@ -144,60 +144,81 @@ class StatsLive extends Module
$("#calendar").remove();
</script>';
if (!Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
$this->html .= '<div class="warn">'.
$this->l('You must activate the option "pages viewed for each customer" in the "Stats data-mining" module in order to see the pages viewed by your customers.').'
</div>';
$this->html .= '
<div class="alert alert-info">'.
$this->l('You must activate the option "pages viewed for each customer" in the "Stats data-mining" module in order to see the pages viewed by your customers.').'
</div>';
$this->html .= '
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->l('Customers online').'</legend>';
<h4> '.$this->l('Customers online').'</h4>';
if ($totalCustomers)
{
$this->html .= $this->l('Total:').' '.(int)$totalCustomers.'
<table cellpadding="0" cellspacing="0" class="table space">
<tr><th>'.$this->l('ID').'</th><th>'.$this->l('Name').'</th><th>'.$this->l('Current Page').'</th><th>'.$this->l('View').'</th></tr>';
foreach ($customers as $customer)
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('ID').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Name').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Current Page').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('View').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($customers as $customer)
$this->html .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td class="center">'.$customer['id_customer'].'</td>
<td class="center">'.$customer['firstname'].' '.$customer['lastname'].'</td>
<td class="center">'.$customer['page'].'</td>
<td class="center">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id).'"
target="_blank">
<img src="../modules/'.$this->name.'/logo.gif" />
</a>
</td>
</tr>';
$this->html .= '
<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td>'.$customer['id_customer'].'</td>
<td style="width: 200px;">'.$customer['firstname'].' '.$customer['lastname'].'</td>
<td style="width: 200px;">'.$customer['page'].'</td>
<td style="text-align: right; width: 25px;">
<a href="index.php?tab=AdminCustomers&id_customer='.$customer['id_customer'].'&viewcustomer&token='.Tools::getAdminToken('AdminCustomers'.(int)Tab::getIdFromClassName('AdminCustomers').(int)$this->context->employee->id).'"
target="_blank">
<img src="../modules/'.$this->name.'/logo.gif" />
</a>
</td>
</tr>';
$this->html .= '</table>';
</tbody>
</table>';
}
else
$this->html .= $this->l('Currently, there are no customers online.');
$this->html .= '</fieldset>
<br />
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->l('Visitors online').'</legend>';
$this->html .= '<p class="alert alert-warning">'.$this->l('Currently, there are no customers online.').'</p>
<h4> '.$this->l('Visitors online').'</h4>';
if ($totalVisitors)
{
$this->html .= $this->l('Total:').' '.(int)($totalVisitors).'
<div style="overflow-y: scroll; height: 600px;">
<table cellpadding="0" cellspacing="0" class="table space">
<tr><th>'.$this->l('Guest').'</th><th>'.$this->l('IP').'</th><th>'.$this->l('Since').'</th><th>'.$this->l('Current page').'</th><th>'.$this->l('Referrer').'</th></tr>';
foreach ($visitors as $visitor)
$this->html .= '<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td>'.$visitor['id_guest'].'</td>
<td style="width: 80px;">'.long2ip($visitor['ip_address']).'</td>
<td style="width: 100px;">'.substr($visitor['date_add'], 11).'</td>
<td style="width: 200px;">'.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).'</td>
<td style="width: 200px;">'.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'</td>
</tr>';
$this->html .= '</table></div>';
<div>
<table class="table">
<thead>
<tr>
<th class="center"><span class="title_box active">'.$this->l('Guest').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('IP').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Since').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Current page').'</span></th>
<th class="center"><span class="title_box active">'.$this->l('Referrer').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($visitors as $visitor)
$this->html .= '<tr'.($irow++ % 2 ? ' class="alt_row"' : '').'>
<td class="center">'.$visitor['id_guest'].'</td>
<td class="center">'.long2ip($visitor['ip_address']).'</td>
<td class="center">'.substr($visitor['date_add'], 11).'</td>
<td class="center">'.(isset($visitor['page']) ? $visitor['page'] : $this->l('Undefined')).'</td>
<td class="center">'.(empty($visitor['http_referer']) ? $this->l('None') : parse_url($visitor['http_referer'], PHP_URL_HOST)).'</td>
</tr>';
$this->html .= '
</tbody>
</table>
</div>';
}
else
$this->html .= $this->l('There are no visitors online.');
$this->html .= '</fieldset>
<br />
<fieldset><legend>'.$this->l('Notice').'</legend>
'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'<br />
<a href="index.php?controller=AdminMaintenance&token='.Tools::getAdminTokenLite('AdminMaintenance').'">'.$this->l('Add or remove an IP address.').'</a>
</fieldset>';
$this->html .= '<p class="alert alert-warning">'.$this->l('There are no visitors online.').'</p>
<h4>'.$this->l('Notice').'</h4>
<p class="alert alert-info">'.$this->l('Maintenance IP(s) are excluded from the online visitors.').'</p>
<a class="btn btn-default" href="index.php?controller=AdminMaintenance&token='.Tools::getAdminTokenLite('AdminMaintenance').'">
<i class="icon-share-alt"></i> '.$this->l('Add or remove an IP address.').'
</a>
';
return $this->html;
}