[*] 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:
@@ -30,29 +30,29 @@ if (!defined('_PS_VERSION_'))
|
||||
|
||||
class StatsEquipment extends ModuleGraph
|
||||
{
|
||||
private $_html = '';
|
||||
private $_query = '';
|
||||
private $_query2 = '';
|
||||
private $html = '';
|
||||
private $_query = '';
|
||||
private $_query2 = '';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->name = 'statsequipment';
|
||||
$this->tab = 'analytics_stats';
|
||||
$this->version = 1.0;
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'statsequipment';
|
||||
$this->tab = 'analytics_stats';
|
||||
$this->version = 1.0;
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Software');
|
||||
$this->description = $this->l('Display the software used by your visitors.');
|
||||
|
||||
$this->displayName = $this->l('Software');
|
||||
$this->description = $this->l('Display the software used by your visitors.');
|
||||
}
|
||||
|
||||
|
||||
public function install()
|
||||
{
|
||||
return (parent::install() AND $this->registerHook('AdminStatsModules'));
|
||||
return (parent::install() && $this->registerHook('AdminStatsModules'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array Get list of browser "plugins" (javascript, media player, etc.)
|
||||
*/
|
||||
@@ -64,8 +64,23 @@ class StatsEquipment extends ModuleGraph
|
||||
WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(false, 'c');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, false);
|
||||
|
||||
$calcArray = array('jsOK' => 0, 'jsKO' => 0, 'javaOK' => 0, 'javaKO' => 0, 'wmpOK' => 0, 'wmpKO' => 0, 'qtOK' => 0, 'qtKO' => 0, 'realOK' => 0, 'realKO' => 0, 'flashOK' => 0, 'flashKO' => 0, 'directorOK' => 0, 'directorKO' => 0);
|
||||
|
||||
$calcArray = array(
|
||||
'jsOK' => 0,
|
||||
'jsKO' => 0,
|
||||
'javaOK' => 0,
|
||||
'javaKO' => 0,
|
||||
'wmpOK' => 0,
|
||||
'wmpKO' => 0,
|
||||
'qtOK' => 0,
|
||||
'qtKO' => 0,
|
||||
'realOK' => 0,
|
||||
'realKO' => 0,
|
||||
'flashOK' => 0,
|
||||
'flashKO' => 0,
|
||||
'directorOK' => 0,
|
||||
'directorKO' => 0
|
||||
);
|
||||
while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($result))
|
||||
{
|
||||
if (!$row['javascript'])
|
||||
@@ -81,10 +96,10 @@ class StatsEquipment extends ModuleGraph
|
||||
($row['sun_java']) ? ++$calcArray['javaOK'] : ++$calcArray['javaKO'];
|
||||
($row['apple_quicktime']) ? ++$calcArray['qtOK'] : ++$calcArray['qtKO'];
|
||||
}
|
||||
|
||||
|
||||
if (!$calcArray['jsOK'])
|
||||
return false;
|
||||
|
||||
|
||||
$equip = array(
|
||||
'Windows Media Player' => $calcArray['wmpOK'] / ($calcArray['wmpOK'] + $calcArray['wmpKO']),
|
||||
'Real Player' => $calcArray['realOK'] / ($calcArray['realOK'] + $calcArray['realKO']),
|
||||
@@ -96,50 +111,52 @@ class StatsEquipment extends ModuleGraph
|
||||
arsort($equip);
|
||||
return $equip;
|
||||
}
|
||||
|
||||
|
||||
public function hookAdminStatsModules($params)
|
||||
{
|
||||
if (Tools::getValue('export'))
|
||||
if (Tools::getValue('exportType') == 'browser')
|
||||
$this->csvExport(array('type' => 'pie', 'option' => 'wb'));
|
||||
elseif (Tools::getValue('exportType') == 'os')
|
||||
else if (Tools::getValue('exportType') == 'os')
|
||||
$this->csvExport(array('type' => 'pie', 'option' => 'os'));
|
||||
|
||||
|
||||
$equipment = $this->getEquipment();
|
||||
$this->_html = '
|
||||
<fieldset class="width3"><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
|
||||
<center>
|
||||
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of web browsers used by your customers.').'</p>
|
||||
'.$this->engine(array('type' => 'pie', 'option' => 'wb')).'<br /><br />
|
||||
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=browser"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>
|
||||
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of operating systems used by your customers.').'</p>
|
||||
'.$this->engine(array('type' => 'pie', 'option' => 'os')).'
|
||||
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=os"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>';
|
||||
|
||||
if ($equipment)
|
||||
{
|
||||
$this->_html .= '<table class="table space" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr><th style="width: 200px">'.$this->l('Plug-ins').'</th><th></th></tr>';
|
||||
foreach ($equipment as $name => $value)
|
||||
$this->_html .= '<tr><td>'.$name.'</td><td>'.number_format(100 * $value, 2).'%</td></tr>';
|
||||
$this->_html .= '</table>';
|
||||
}
|
||||
$this->_html .= '
|
||||
</center>
|
||||
</fieldset><br />
|
||||
<fieldset class="width3"><legend><img src="../img/admin/comment.gif" /> '.$this->l('Guide').'</legend>
|
||||
$this->html = '
|
||||
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
|
||||
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of web browsers used by your customers.').'</p>
|
||||
'.$this->engine(array('type' => 'pie', 'option' => 'wb')).'<br /><br />
|
||||
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=browser"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>
|
||||
<p><img src="../img/admin/down.gif" />'.$this->l('Determine the percentage of operating systems used by your customers.').'</p>
|
||||
'.$this->engine(array('type' => 'pie', 'option' => 'os')).'
|
||||
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1&exportType=os"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>';
|
||||
|
||||
if ($equipment)
|
||||
{
|
||||
$this->html .= '<table class="table space" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr><th style="width: 200px">'.$this->l('Plug-ins').'</th><th></th></tr>';
|
||||
foreach ($equipment as $name => $value)
|
||||
$this->html .= '<tr><td>'.$name.'</td><td>'.number_format(100 * $value, 2).'%</td></tr>';
|
||||
$this->html .= '</table>';
|
||||
}
|
||||
$this->html .= '
|
||||
</fieldset>
|
||||
<br />
|
||||
<fieldset><legend><img src="../img/admin/comment.gif" /> '.$this->l('Guide').'</legend>
|
||||
<h2>'.$this->l('Ensure that your website is accessible to all.').'</h2>
|
||||
<p>
|
||||
'.$this->l('When managing Websites, it is important to keep track of software used by visitors in order to be sure that the site displays the same way for everyone. PrestaShop was built in order to be compatible with most recent Web browsers and computer operating systems (OS). However, because you may end up adding advanced features to your Website or even modify the core PrestaShop code, these additions may not be accessible by everyone. That is why it is a good idea to keep tabs on the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').'
|
||||
'.$this->l('When managing Websites, it is important to keep track of software used by visitors in order to be sure that the site displays the same way for everyone.
|
||||
PrestaShop was built in order to be compatible with most recent Web browsers and computer operating systems (OS).
|
||||
However, because you may end up adding advanced features to your Website or even modify the core PrestaShop code, these additions may not be accessible by everyone.
|
||||
That is why it is a good idea to keep tabs on the percentage of users for each type of software before adding or changing something that only a limited number of users will be able to access.').'
|
||||
</p><br />
|
||||
|
||||
</fieldset>';
|
||||
return $this->_html;
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
public function setOption($option, $layers = 1)
|
||||
{
|
||||
switch($option)
|
||||
switch ($option)
|
||||
{
|
||||
case 'wb':
|
||||
$this->_titles['main'] = $this->l('Web browser use');
|
||||
@@ -166,7 +183,7 @@ class StatsEquipment extends ModuleGraph
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getData($layers)
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query.$this->getDate().$this->_query2);
|
||||
@@ -174,8 +191,8 @@ class StatsEquipment extends ModuleGraph
|
||||
$i = 0;
|
||||
foreach ($result as $row)
|
||||
{
|
||||
$this->_values[$i] = $row['total'];
|
||||
$this->_legend[$i++] = $row['name'];
|
||||
$this->_values[$i] = $row['total'];
|
||||
$this->_legend[$i++] = $row['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user