[*] BO #PSFV-94 : Added AdminStatsController && AdminStatsTabController && norm of statistic modules

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10004 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-09 15:48:15 +00:00
parent 42bfc372da
commit dc716baa05
28 changed files with 980 additions and 891 deletions
+14 -14
View File
@@ -37,20 +37,20 @@ class StatsBestProducts extends ModuleGrid
private $_defaultSortDirection = null;
private $_emptyMessage = null;
private $_pagingMessage = null;
function __construct()
public function __construct()
{
$this->name = 'statsbestproducts';
$this->tab = 'analytics_stats';
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->_defaultSortColumn = 'totalPriceSold';
$this->_defaultSortDirection = 'DESC';
$this->_emptyMessage = $this->l('Empty recordset returned');
$this->_pagingMessage = $this->l('Displaying').' {0} - {1} '.$this->l('of').' {2}';
$this->_columns = array(
array(
'id' => 'reference',
@@ -109,18 +109,18 @@ class StatsBestProducts extends ModuleGrid
'align' => 'right'
)
);
parent::__construct();
$this->displayName = $this->l('Best products');
$this->description = $this->l('A list of the best products');
}
public function install()
{
return (parent::install() AND $this->registerHook('AdminStatsModules'));
return (parent::install() && $this->registerHook('AdminStatsModules'));
}
public function hookAdminStatsModules($params)
{
$engineParams = array(
@@ -135,15 +135,15 @@ class StatsBestProducts extends ModuleGrid
if (Tools::getValue('export'))
$this->csvExport($engineParams);
$this->_html = '
<fieldset class="width3"><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
'.$this->engine($engineParams).'
<p><a href="'.htmlentities($_SERVER['REQUEST_URI']).'&export=1"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>
</fieldset>';
return $this->_html;
}
public function getData()
{
$dateBetween = $this->getDate();
@@ -176,11 +176,11 @@ class StatsBestProducts extends ModuleGrid
if (Validate::IsName($this->_sort))
{
$this->_query .= ' ORDER BY `'.$this->_sort.'`';
if (isset($this->_direction) AND Validate::IsSortDirection($this->_direction))
if (isset($this->_direction) && Validate::IsSortDirection($this->_direction))
$this->_query .= ' '.$this->_direction;
}
if (($this->_start === 0 OR Validate::IsUnsignedInt($this->_start)) AND Validate::IsUnsignedInt($this->_limit))
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit))
$this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit);
$this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query);
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');