// update tabs stats

This commit is contained in:
Sarah Lorenzini
2013-09-17 17:49:49 +02:00
parent 8f10a0e32f
commit bdb797a66c
18 changed files with 691 additions and 458 deletions
+46 -32
View File
@@ -96,30 +96,54 @@ class Pagesnotfound extends Module
if (Tools::isSubmit('submitTruncatePNF'))
{
Db::getInstance()->execute('TRUNCATE `'._DB_PREFIX_.'pagenotfound`');
$this->_html .= '<div class="conf confirm"> '.$this->l('The pages not found cache has been emptied.').'</div>';
$this->_html .= '<div class="alert alert-warning"> '.$this->l('The pages not found cache has been emptied.').'</div>';
}
else if (Tools::isSubmit('submitDeletePNF'))
{
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'pagenotfound`
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween());
$this->_html .= '<div class="conf confirm"> '.$this->l('Pages not found have been deleted.').'</div>';
$this->_html .= '<div class="alert alert-warning"> '.$this->l('Pages not found have been deleted.').'</div>';
}
$this->_html .= '<div class="blocStats"><h2 class="icon-'.$this->name.'"><span></span>'.$this->displayName.'</h2>';
$this->_html .= '
<div class="panel-heading">
'.$this->displayName.'
</div>
<h4>'.$this->l('Guide').'</h4>
<div class="alert alert-warning">
<h4>'.$this->l('404 errors').'</h4>
<p>'
.$this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found.
In your case it means that one of your visitors entered a wrong URL in the address bar or that you or another website has a dead link.
When it is available, the referrer is shown so you can find the page which contains the dead link.
If not, it means generally that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.').'
</p>
<p>&nbsp;</p>
<h4>'.$this->l('How to catch these errors?').'</h4>
<p>'
.$this->l('If your webhost supports .htaccess files, you can create one in the root directory of PrestaShop and insert the following line inside:').'
<i>ErrorDocument 404 '.__PS_BASE_URI__.'404.php</i>. '.
$this->l('A user requesting a page which doesn\'t exist will be redirected to the following page.').' <i>'.__PS_BASE_URI__.'404.php</i>. '.
$this->l('This module logs access to this page.').'
</p>
</div>';
if (!file_exists(dirname(__FILE__).'/../../.htaccess'))
$this->_html .= '<br/><div class="warning warn">'.$this->l('You must use a .htaccess file to redirect 404 errors to the page "404.php"').'</div>';
$this->_html .= '<div class="alert alert-warning">'.$this->l('You must use a .htaccess file to redirect 404 errors to the page "404.php"').'</div>';
$pages = $this->getPages();
if (count($pages))
{
$this->_html .= '
<table class="table" cellpadding="0" cellspacing="0">
<tr>
<th width="200">'.$this->l('Page').'</th>
<th width="500">'.$this->l('Referrer').'</th>
<th>'.$this->l('Counter').'</th>
</tr>';
<table class="table">
<thead>
<tr>
<th><span class="title_box active">'.$this->l('Page').'</span></th>
<th><span class="title_box active">'.$this->l('Referrer').'</span></th>
<th><span class="title_box active">'.$this->l('Counter').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($pages as $ru => $hrs)
foreach ($hrs as $hr => $counter)
if ($hr != 'nb')
@@ -127,36 +151,26 @@ class Pagesnotfound extends Module
<tr>
<td><a href="'.$ru.'-admin404">'.wordwrap($ru, 30, '<br />', true).'</a></td>
<td><a href="'.Tools::getProtocol().$hr.'">'.wordwrap($hr, 40, '<br />', true).'</a></td>
<td align="right">'.$counter.'</td>
<td>'.$counter.'</td>
</tr>';
$this->_html .= '
</tbody>
</table>';
}
else
$this->_html .= '<div class="conf confirm"> '.$this->l('No pages registered').'</div>';
$this->_html .= '<div class="alert alert-warning"> '.$this->l('No pages registered').'</div>';
$this->_html .= '</div>';
if (count($pages))
$this->_html .= '<div class="clear">&nbsp;</div>
<div class="blocStats"><h2 class="icon-'.$this->name.'">'.$this->l('Empty database').'</h2>
$this->_html .= '
<h4>'.$this->l('Empty database').'</h4>
<form action="'.Tools::htmlEntitiesUtf8($_SERVER['REQUEST_URI']).'" method="post">
<input type="submit" class="button" name="submitDeletePNF" value="'.$this->l('Empty ALL pages not found for this period').'">
<input type="submit" class="button" name="submitTruncatePNF" value="'.$this->l('Empty ALL pages not found').'">
</form>
</div>';
$this->_html .= '<br />
<div class="blocStats"><h2 class="icon-guide"><span></span>'.$this->l('Guide').'</h2>
<h2>'.$this->l('404 errors').'</h2>
<p>'.$this->l('A 404 error is an HTTP error code which means that the file requested by the user cannot be found.
In your case it means that one of your visitors entered a wrong URL in the address bar or that you or another website has a dead link.
When it is available, the referrer is shown so you can find the page which contains the dead link.
If not, it means generally that it is a direct access, so someone may have bookmarked a link which doesn\'t exist anymore.').'</p>
<h3>'.$this->l('How to catch these errors?').'</h3>
<p>'.$this->l('If your webhost supports .htaccess files, you can create one in the root directory of PrestaShop and insert the following line inside:').'
<i>ErrorDocument 404 '.__PS_BASE_URI__.'404.php</i>. '.
$this->l('A user requesting a page which doesn\'t exist will be redirected to the following page.').' <i>'.__PS_BASE_URI__.'404.php</i>. '.
$this->l('This module logs access to this page.').'</p><br />
</div>';
<button type="submit" class="btn btn-default" name="submitDeletePNF">
<i class="icon-remove"></i> '.$this->l('Empty ALL pages not found for this period').'
</button>
<button type="submit" class="btn btn-default" name="submitTruncatePNF">
<i class="icon-remove"></i> '.$this->l('Empty ALL pages not found').'
</button>
</form>';
return $this->_html;
}