Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# Stats Dashboard
## About
This is the main module for the Stats dashboard. It displays a summary of all your current statistics.
## Contributing
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
### Requirements
Contributors **must** follow the following rules:
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
* Do not update the module's version number.
* Follow [the coding standards][1].
### Process in details
Contributors wishing to edit a module's files should follow the following process:
1. Create your GitHub account, if you do not have one already.
2. Fork the statsforecast project to your GitHub account.
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
4. Create a branch in your local clone of the module for your changes.
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
6. Push your changed branch to your fork in your GitHub account.
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
That's it: you have contributed to this open-source project! Congratulations!
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
[3]: https://help.github.com/articles/using-pull-requests

View File

@@ -0,0 +1,19 @@
{
"name": "prestashop/statsforecast",
"description": "PrestaShop module statsforecast",
"homepage": "https://github.com/PrestaShop/statsforecast",
"license": "AFL-3.0",
"authors": [
{
"name": "PrestaShop SA",
"email": "contact@prestashop.com"
}
],
"require": {
"php": ">=5.4"
},
"config": {
"preferred-install": "dist"
},
"type": "prestashop-module"
}

19
web/modules/statsforecast/composer.lock generated Normal file
View File

@@ -0,0 +1,19 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8c2f8cca9d0af11602310191ed63c47c",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.4"
},
"platform-dev": []
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>statsforecast</name>
<displayName><![CDATA[Stats Dashboard]]></displayName>
<version><![CDATA[2.0.3]]></version>
<description><![CDATA[This is the main module for the Stats dashboard. It displays a summary of all your current statistics.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>statsforecast</name>
<displayName><![CDATA[Tableau de bord statistiques]]></displayName>
<version><![CDATA[2.0.3]]></version>
<description><![CDATA[Module principal du tableau de bord de statistiques. Affiche un r&eacute;sum&eacute; de toutes vos statistiques.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
<is_configurable>1</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View File

@@ -0,0 +1,749 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class statsforecast extends Module
{
private $html = '';
private $t1 = 0;
private $t2 = 0;
private $t3 = 0;
private $t4 = 0;
private $t5 = 0;
private $t6 = 0;
private $t7 = 0;
private $t8 = 0;
public function __construct()
{
$this->name = 'statsforecast';
$this->tab = 'analytics_stats';
$this->version = '2.0.1';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->trans('Stats Dashboard', array(), 'Modules.Statsforecast.Admin');
$this->description = $this->trans('This is the main module for the Stats dashboard. It displays a summary of all your current statistics.', array(), 'Modules.Statsforecast.Admin');
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
}
public function install()
{
return (parent::install() && $this->registerHook('AdminStatsModules'));
}
public function getContent()
{
Tools::redirectAdmin('index.php?controller=AdminStats&module=statsforecast&token='.Tools::getAdminTokenLite('AdminStats'));
}
public function hookAdminStatsModules()
{
$ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token');
$db = Db::getInstance();
if (!isset($this->context->cookie->stats_granularity)) {
$this->context->cookie->stats_granularity = 10;
}
if (Tools::isSubmit('submitIdZone')) {
$this->context->cookie->stats_id_zone = (int)Tools::getValue('stats_id_zone');
}
if (Tools::isSubmit('submitGranularity')) {
$this->context->cookie->stats_granularity = Tools::getValue('stats_granularity');
}
$currency = $this->context->currency;
$employee = $this->context->employee;
$from = max(strtotime(_PS_CREATION_DATE_.' 00:00:00'), strtotime($employee->stats_date_from.' 00:00:00'));
$to = strtotime($employee->stats_date_to.' 23:59:59');
$to2 = min(time(), $to);
$interval = ($to - $from) / 60 / 60 / 24;
$interval2 = ($to2 - $from) / 60 / 60 / 24;
$prop30 = $interval / $interval2;
if ($this->context->cookie->stats_granularity == 7) {
$interval_avg = $interval2 / 30;
}
if ($this->context->cookie->stats_granularity == 4) {
$interval_avg = $interval2 / 365;
}
if ($this->context->cookie->stats_granularity == 10) {
$interval_avg = $interval2;
}
if ($this->context->cookie->stats_granularity == 42) {
$interval_avg = $interval2 / 7;
}
$data_table = array();
if ($this->context->cookie->stats_granularity == 10) {
for ($i = $from; $i <= $to2; $i = strtotime('+1 day', $i)) {
$data_table[date('Y-m-d', $i)] = array(
'fix_date' => date('Y-m-d', $i),
'countOrders' => 0,
'countProducts' => 0,
'totalSales' => 0
);
}
}
$date_from_gadd = ($this->context->cookie->stats_granularity != 42
? 'LEFT(date_add, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(date_add),DAYOFYEAR(date_add)-WEEKDAY(date_add)), CONCAT(YEAR(date_add),"-01-01*"))');
$date_from_ginvoice = ($this->context->cookie->stats_granularity != 42
? 'LEFT(invoice_date, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(invoice_date),DAYOFYEAR(invoice_date)-WEEKDAY(invoice_date)), CONCAT(YEAR(invoice_date),"-01-01*"))');
$result = $db->query('
SELECT
'.$date_from_ginvoice.' as fix_date,
COUNT(*) as countOrders,
SUM((SELECT SUM(od.product_quantity) FROM '._DB_PREFIX_.'order_detail od WHERE o.id_order = od.id_order)) as countProducts,
SUM(o.total_paid_tax_excl / o.conversion_rate) as totalSales
FROM '._DB_PREFIX_.'orders o
WHERE o.valid = 1
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY '.$date_from_ginvoice);
while ($row = $db->nextRow($result)) {
$data_table[$row['fix_date']] = $row;
}
$this->html .= '<div>
<div class="panel-heading"><i class="icon-dashboard"></i> '.$this->displayName.'</div>
<div class="alert alert-info">'.$this->trans('The listed amounts do not include tax.', array(), 'Modules.Statsforecast.Admin').'</div>
<form id="granularity" action="'.Tools::safeOutput($ru).'#granularity" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Time frame', array(), 'Modules.Statsforecast.Admin').'
</label>
<div class="col-lg-2">
<input type="hidden" name="submitGranularity" value="1" />
<select name="stats_granularity" onchange="this.form.submit();">
<option value="10">'.$this->trans('Daily', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="42" '.($this->context->cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->trans('Weekly', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="7" '.($this->context->cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->trans('Monthly', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="4" '.($this->context->cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->trans('Yearly', array(), 'Modules.Statsforecast.Admin').'</option>
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Visits', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Registrations', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Placed orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Bought items', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of registrations', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Revenue', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>';
$visit_array = array();
$sql = 'SELECT '.$date_from_gadd.' as fix_date, COUNT(*) as visits
FROM '._DB_PREFIX_.'connections c
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c').'
GROUP BY '.$date_from_gadd;
$visits = Db::getInstance()->query($sql);
while ($row = $db->nextRow($visits)) {
$visit_array[$row['fix_date']] = $row['visits'];
}
foreach ($data_table as $row) {
$visits_today = (int)(isset($visit_array[$row['fix_date']]) ? $visit_array[$row['fix_date']] : 0);
$date_from_greg = ($this->context->cookie->stats_granularity != 42
? 'LIKE \''.$row['fix_date'].'%\''
: 'BETWEEN \''.Tools::substr($row['fix_date'], 0, 10).' 00:00:00\' AND DATE_ADD(\''.Tools::substr($row['fix_date'], 0, 8).Tools::substr($row['fix_date'], 8, 2).' 23:59:59\', INTERVAL 7 DAY)');
$row['registrations'] = Db::getInstance()->getValue('
SELECT COUNT(*) FROM '._DB_PREFIX_.'customer
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween().'
AND date_add '.$date_from_greg
.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER));
$this->html .= '
<tr>
<td>'.$row['fix_date'].'</td>
<td class="text-center">'.$visits_today.'</td>
<td class="text-center">'.(int)$row['registrations'].'</td>
<td class="text-center">'.(int)$row['countOrders'].'</td>
<td class="text-center">'.(int)$row['countProducts'].'</td>
<td class="text-center">'.($visits_today ? round(100 * (int)$row['registrations'] / $visits_today, 2).' %' : '-').'</td>
<td class="text-center">'.($visits_today ? round(100 * (int)$row['countOrders'] / $visits_today, 2).' %' : '-').'</td>
<td class="text-right">'.Tools::displayPrice($row['totalSales'], $currency).'</td>
</tr>';
$this->t1 += $visits_today;
$this->t2 += (int)$row['registrations'];
$this->t3 += (int)$row['countOrders'];
$this->t4 += (int)$row['countProducts'];
$this->t8 += $row['totalSales'];
}
$this->html .= '
<tr>
<th></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Visits', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Registrations', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Placed orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Bought items', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of registrations', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Revenue', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
<tr>
<td>'.$this->trans('Total', array(), 'Admin.Global').'</td>
<td class="text-center">'.(int)$this->t1.'</td>
<td class="text-center">'.(int)$this->t2.'</td>
<td class="text-center">'.(int)$this->t3.'</td>
<td class="text-center">'.(int)$this->t4.'</td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-right">'.Tools::displayPrice($this->t8, $currency).'</td>
</tr>
<tr>
<td>'.$this->trans('Average', array(), 'Modules.Statsforecast.Admin').'</td>
<td class="text-center">'.(int)($this->t1 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t2 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t3 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t4 / $interval_avg).'</td>
<td class="text-center">'.($this->t1 ? round(100 * $this->t2 / $this->t1, 2).' %' : '-').'</td>
<td class="text-center">'.($this->t1 ? round(100 * $this->t3 / $this->t1, 2).' %' : '-').'</td>
<td class="text-right">'.Tools::displayPrice($this->t8 / $interval_avg, $currency).'</td>
</tr>
<tr>
<td>'.$this->trans('Forecast', array(), 'Modules.Statsforecast.Admin').'</td>
<td class="text-center">'.(int)($this->t1 * $prop30).'</td>
<td class="text-center">'.(int)($this->t2 * $prop30).'</td>
<td class="text-center">'.(int)($this->t3 * $prop30).'</td>
<td class="text-center">'.(int)($this->t4 * $prop30).'</td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-right">'.Tools::displayPrice($this->t8 * $prop30, $currency).'</td>
</tr>
</table>
</div>';
$ca = $this->getRealCA();
$sql = 'SELECT COUNT(DISTINCT c.id_guest)
FROM '._DB_PREFIX_.'connections c
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c');
$visitors = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT g.id_customer)
FROM '._DB_PREFIX_.'connections c
INNER JOIN '._DB_PREFIX_.'guest g ON c.id_guest = g.id_guest
WHERE g.id_customer != 0
AND c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c');
$customers = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT c.id_cart)
FROM '._DB_PREFIX_.'cart c
INNER JOIN '._DB_PREFIX_.'cart_product cp on c.id_cart = cp.id_cart
WHERE (c.date_add BETWEEN '.ModuleGraph::getDateBetween().' OR c.date_upd BETWEEN '.ModuleGraph::getDateBetween().')
'.Shop::addSqlRestriction(false, 'c');
$carts = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT c.id_cart)
FROM '._DB_PREFIX_.'cart c
INNER JOIN '._DB_PREFIX_.'cart_product cp on c.id_cart = cp.id_cart
WHERE (c.date_add BETWEEN '.ModuleGraph::getDateBetween().' OR c.date_upd BETWEEN '.ModuleGraph::getDateBetween().')
AND id_address_invoice != 0
'.Shop::addSqlRestriction(false, 'c');
$fullcarts = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'orders o
WHERE o.valid = 1
AND o.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$orders = Db::getInstance()->getValue($sql);
$this->html .= '
<div class="row row-margin-bottom">
<h4><i class="icon-filter"></i> '.$this->trans('Conversion', array(), 'Modules.Statsforecast.Admin').'</h4>
</div>
<div class="row row-margin-bottom">
<table class="table">
<tbody>
<tr>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Visitors', array(), 'Admin.Shopparameters.Feature').'</p>
<p>'.$visitors.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $customers / max(1, $visitors), 2).' %</p>
</td>
<td class="text-center">
<p>'.$this->trans('Accounts', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$customers.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $customers), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Full carts', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$fullcarts.'</p>
</td>
<td rowspan="2" class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $orders / max(1, $fullcarts), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
<p>'.$orders.'</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Registered visitors', array(), 'Modules.Statsforecast.Admin').'</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.round(100 * $orders / max(1, $customers), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Visitors', array(), 'Admin.Shopparameters.Feature').'</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.round(100 * $orders / max(1, $visitors), 2).' %</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
</td>
</tr>
<tr>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $carts / max(1, $visitors)).' %</p>
</td>
<td class="text-center">
<p>'.$this->trans('Carts', array(), 'Admin.Global').'</p>
<p>'.$carts.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $carts)).' %</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-info">
<p>'.$this->trans('A simple statistical calculation lets you know the monetary value of your visitors:', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$this->trans('On average, each visitor places an order for this amount:', array(), 'Modules.Statsforecast.Admin').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'.</b></p>
<p>'.$this->trans('On average, each registered visitor places an order for this amount:', array(), 'Modules.Statsforecast.Admin').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'</b>.</p>
</div>';
$from = strtotime($employee->stats_date_from.' 00:00:00');
$to = strtotime($employee->stats_date_to.' 23:59:59');
$interval = ($to - $from) / 60 / 60 / 24;
$this->html .= '
<div class="row row-margin-bottom">
<h4><i class="icon-money"></i> '.$this->trans('Payment distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<div class="alert alert-info">'
.$this->trans('The amounts include taxes, so you can get an estimation of the commission due to the payment method.', array(), 'Modules.Statsforecast.Admin').'
</div>
<form id="cat" action="'.Tools::safeOutput($ru).'#payment" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Module', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Average cart value', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['payment'] as $payment) {
$this->html .= '
<tr>
<td class="text-center">'.$payment['payment_method'].'</td>
<td class="text-center">'.(int)$payment['nb'].'</td>
<td class="text-right">'.Tools::displayPrice($payment['total'], $currency).'</td>
<td class="text-right">'.Tools::displayPrice($payment['total'] / (int)$payment['nb'], $currency).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-sitemap"></i> '.$this->trans('Category distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<form id="cat_1" action="'.Tools::safeOutput($ru).'#cat" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Category', array(), 'Admin.Catalog.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Average price', array(), 'Admin.Global').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['cat'] as $catrow) {
$this->html .= '
<tr>
<td class="text-center">'.(empty($catrow['name']) ? $this->trans('Unknown', array(), 'Admin.Shopparameters.Feature') : $catrow['name']).'</td>
<td class="text-center">'.$catrow['orderQty'].'</td>
<td class="text-right">'.Tools::displayPrice($catrow['orderSum'], $currency).'</td>
<td class="text-center">'.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
<td class="text-right">'.Tools::displayPrice($catrow['priveAvg'], $currency).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-flag"></i> '.$this->trans('Language distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Language', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage', array(), 'Admin.Global').'</span></th>
<th class="text-center" colspan="2"><span class="title_box active">'.$this->trans('Growth', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['lang'] as $ophone => $amount) {
$percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '&#x221e;';
$this->html .= '
<tr '.(($percent < 0) ? 'class="alt_row"' : '').'>
<td class="text-center">'.$ophone.'</td>
<td class="text-right">'.Tools::displayPrice($amount, $currency).'</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').'</td>
<td class="text-center">'.(($percent > 0 || $percent == '&#x221e;') ? '<img src="../img/admin/arrow_up.png" alt="" />' : '<img src="../img/admin/arrow_down.png" alt="" /> ').'</td>
<td class="text-center">'.(($percent > 0 || $percent == '&#x221e;') ? '+' : '').$percent.'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-map-marker"></i> '.$this->trans('Zone distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Zone', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['zones'] as $zone) {
$this->html .= '
<tr>
<td class="text-center">'.(isset($zone['name']) ? $zone['name'] : $this->trans('Undefined', array(), 'Admin.Shopparameters.Feature')).'</td>
<td class="text-center">'.(int)($zone['nb']).'</td>
<td class="text-right">'.Tools::displayPrice($zone['total'], $currency).'</td>
<td class="text-center">'.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-money"></i> '.$this->trans('Currency distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<form id="cat_2" action="'.Tools::safeOutput($ru).'#currencies" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Currency', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-right"><span class="title_box active">'.$this->trans('Sales (converted)', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['currencies'] as $currency_row) {
$this->html .= '
<tr>
<td class="text-center">'.$currency_row['name'].'</td>
<td class="text-center">'.(int)($currency_row['nb']).'</td>
<td class="text-right">'.Tools::displayPrice($currency_row['total'], $currency).'</td>
<td class="text-center">'.($ca['ventil']['nb'] ? number_format((100 * $currency_row['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $currency_row['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-ticket"></i> '.$this->trans('Attribute distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Group', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Attribute', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Quantity of products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['attributes'] as $attribut) {
$this->html .= '
<tr>
<td class="text-center">'.$attribut['gname'].'</td>
<td class="text-center">'.$attribut['aname'].'</td>
<td class="text-center">'.(int)($attribut['total']).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>';
return $this->html;
}
private function getRealCA()
{
$employee = $this->context->employee;
$ca = array();
$where = $join = '';
if ((int)$this->context->cookie->stats_id_zone) {
$join = ' LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address LEFT JOIN `'._DB_PREFIX_.'country` co ON co.id_country = a.id_country';
$where = ' AND co.id_zone = '.(int)$this->context->cookie->stats_id_zone.' ';
}
$sql = 'SELECT SUM(od.`product_price` * od.`product_quantity` / o.conversion_rate) as orderSum, SUM(od.product_quantity) as orderQty, cl.name, AVG(od.`product_price` / o.conversion_rate) as priveAvg
FROM `'._DB_PREFIX_.'orders` o
STRAIGHT_JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (product_shop.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
'.$join.'
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY product_shop.id_category_default';
$ca['cat'] = Db::getInstance()->executeS($sql);
uasort($ca['cat'], 'statsforecast_sort');
$lang_values = '';
$sql = 'SELECT l.id_lang, l.iso_code
FROM `'._DB_PREFIX_.'lang` l
'.Shop::addSqlAssociation('lang', 'l').'
WHERE l.active = 1';
$languages = Db::getInstance()->executeS($sql);
foreach ($languages as $language) {
$lang_values .= 'SUM(IF(o.id_lang = '.(int)$language['id_lang'].', total_paid_tax_excl / o.conversion_rate, 0)) as '.pSQL($language['iso_code']).',';
}
$lang_values = rtrim($lang_values, ',');
if ($lang_values) {
$sql = 'SELECT '.$lang_values.'
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['lang'] = Db::getInstance()->getRow($sql);
arsort($ca['lang']);
$sql = 'SELECT '.$lang_values.'
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND ADDDATE(o.`invoice_date`, interval 30 day) BETWEEN \''.$employee->stats_date_from.' 00:00:00\' AND \''.min(date('Y-m-d H:i:s'), $employee->stats_date_to.' 23:59:59').'\'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['langprev'] = Db::getInstance()->getRow($sql);
} else {
$ca['lang'] = array();
$ca['langprev'] = array();
}
$sql = 'SELECT reference
FROM `'._DB_PREFIX_.'orders` o
'.$join.'
WHERE o.valid
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'';
$result = Db::getInstance()->executeS($sql);
if (count($result)) {
$references = array();
foreach ($result as $r) {
$references[] = $r['reference'];
}
$sql = 'SELECT op.payment_method, SUM(op.amount / op.conversion_rate) as total, COUNT(DISTINCT op.order_reference) as nb
FROM `'._DB_PREFIX_.'order_payment` op
WHERE op.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
AND op.order_reference IN (
"'.implode('","', $references).'"
)
GROUP BY op.payment_method
ORDER BY total DESC';
$ca['payment'] = Db::getInstance()->executeS($sql);
} else {
$ca['payment'] = array();
}
$sql = 'SELECT z.name, SUM(o.total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) as nb
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address
LEFT JOIN `'._DB_PREFIX_.'country` c ON c.id_country = a.id_country
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.id_zone = c.id_zone
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY c.id_zone
ORDER BY total DESC';
$ca['zones'] = Db::getInstance()->executeS($sql);
$sql = 'SELECT cu.name, SUM(o.total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) as nb
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'currency` cu ON o.id_currency = cu.id_currency
'.$join.'
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY o.id_currency
ORDER BY total DESC';
$ca['currencies'] = Db::getInstance()->executeS($sql);
$sql = 'SELECT SUM(total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) AS nb
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['ventil'] = Db::getInstance()->getRow($sql);
$sql = 'SELECT /*pac.id_attribute,*/ agl.name as gname, al.name as aname, COUNT(*) as total
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON od.product_attribute_id = pac.id_product_attribute
INNER JOIN '._DB_PREFIX_.'attribute a ON pac.id_attribute = a.id_attribute
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (a.id_attribute_group = agl.id_attribute_group AND agl.id_lang = '.(int)$this->context->language->id.')
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = '.(int)$this->context->language->id.')
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY pac.id_attribute';
$ca['attributes'] = Db::getInstance()->executeS($sql);
return $ca;
}
}
function statsforecast_sort($a, $b)
{
if ($a['orderSum'] == $b['orderSum']) {
return 0;
}
return ($a['orderSum'] > $b['orderSum']) ? -1 : 1;
}

View File

@@ -0,0 +1,749 @@
<?php
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class statsforecast extends Module
{
private $html = '';
private $t1 = 0;
private $t2 = 0;
private $t3 = 0;
private $t4 = 0;
private $t5 = 0;
private $t6 = 0;
private $t7 = 0;
private $t8 = 0;
public function __construct()
{
$this->name = 'statsforecast';
$this->tab = 'analytics_stats';
$this->version = '2.0.3';
$this->author = 'PrestaShop';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->trans('Stats Dashboard', array(), 'Modules.Statsforecast.Admin');
$this->description = $this->trans('This is the main module for the Stats dashboard. It displays a summary of all your current statistics.', array(), 'Modules.Statsforecast.Admin');
$this->ps_versions_compliancy = array('min' => '1.7.1.0', 'max' => _PS_VERSION_);
}
public function install()
{
return (parent::install() && $this->registerHook('AdminStatsModules'));
}
public function getContent()
{
Tools::redirectAdmin('index.php?controller=AdminStats&module=statsforecast&token='.Tools::getAdminTokenLite('AdminStats'));
}
public function hookAdminStatsModules()
{
$ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token');
$db = Db::getInstance();
if (!isset($this->context->cookie->stats_granularity)) {
$this->context->cookie->stats_granularity = 10;
}
if (Tools::isSubmit('submitIdZone')) {
$this->context->cookie->stats_id_zone = (int)Tools::getValue('stats_id_zone');
}
if (Tools::isSubmit('submitGranularity')) {
$this->context->cookie->stats_granularity = Tools::getValue('stats_granularity');
}
$currency = $this->context->currency;
$employee = $this->context->employee;
$from = max(strtotime(_PS_CREATION_DATE_.' 00:00:00'), strtotime($employee->stats_date_from.' 00:00:00'));
$to = strtotime($employee->stats_date_to.' 23:59:59');
$to2 = min(time(), $to);
$interval = ($to - $from) / 60 / 60 / 24;
$interval2 = ($to2 - $from) / 60 / 60 / 24;
$prop30 = $interval / $interval2;
if ($this->context->cookie->stats_granularity == 7) {
$interval_avg = $interval2 / 30;
}
if ($this->context->cookie->stats_granularity == 4) {
$interval_avg = $interval2 / 365;
}
if ($this->context->cookie->stats_granularity == 10) {
$interval_avg = $interval2;
}
if ($this->context->cookie->stats_granularity == 42) {
$interval_avg = $interval2 / 7;
}
$data_table = array();
if ($this->context->cookie->stats_granularity == 10) {
for ($i = $from; $i <= $to2; $i = strtotime('+1 day', $i)) {
$data_table[date('Y-m-d', $i)] = array(
'fix_date' => date('Y-m-d', $i),
'countOrders' => 0,
'countProducts' => 0,
'totalSales' => 0
);
}
}
$date_from_gadd = ($this->context->cookie->stats_granularity != 42
? 'LEFT(date_add, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(date_add),DAYOFYEAR(date_add)-WEEKDAY(date_add)), CONCAT(YEAR(date_add),"-01-01*"))');
$date_from_ginvoice = ($this->context->cookie->stats_granularity != 42
? 'LEFT(invoice_date, '.(int)$this->context->cookie->stats_granularity.')'
: 'IFNULL(MAKEDATE(YEAR(invoice_date),DAYOFYEAR(invoice_date)-WEEKDAY(invoice_date)), CONCAT(YEAR(invoice_date),"-01-01*"))');
$result = $db->query('
SELECT
'.$date_from_ginvoice.' as fix_date,
COUNT(*) as countOrders,
SUM((SELECT SUM(od.product_quantity) FROM '._DB_PREFIX_.'order_detail od WHERE o.id_order = od.id_order)) as countProducts,
SUM(o.total_paid_tax_excl / o.conversion_rate) as totalSales
FROM '._DB_PREFIX_.'orders o
WHERE o.valid = 1
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY '.$date_from_ginvoice);
while ($row = $db->nextRow($result)) {
$data_table[$row['fix_date']] = $row;
}
$this->html .= '<div>
<div class="panel-heading"><i class="icon-dashboard"></i> '.$this->displayName.'</div>
<div class="alert alert-info">'.$this->trans('The listed amounts do not include tax.', array(), 'Modules.Statsforecast.Admin').'</div>
<form id="granularity" action="'.Tools::safeOutput($ru).'#granularity" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Time frame', array(), 'Modules.Statsforecast.Admin').'
</label>
<div class="col-lg-2">
<input type="hidden" name="submitGranularity" value="1" />
<select name="stats_granularity" onchange="this.form.submit();">
<option value="10">'.$this->trans('Daily', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="42" '.($this->context->cookie->stats_granularity == '42' ? 'selected="selected"' : '').'>'.$this->trans('Weekly', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="7" '.($this->context->cookie->stats_granularity == '7' ? 'selected="selected"' : '').'>'.$this->trans('Monthly', array(), 'Modules.Statsforecast.Admin').'</option>
<option value="4" '.($this->context->cookie->stats_granularity == '4' ? 'selected="selected"' : '').'>'.$this->trans('Yearly', array(), 'Modules.Statsforecast.Admin').'</option>
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Visits', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Registrations', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Placed orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Bought items', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of registrations', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Revenue', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>';
$visit_array = array();
$sql = 'SELECT '.$date_from_gadd.' as fix_date, COUNT(*) as visits
FROM '._DB_PREFIX_.'connections c
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c').'
GROUP BY '.$date_from_gadd;
$visits = Db::getInstance()->query($sql);
while ($row = $db->nextRow($visits)) {
$visit_array[$row['fix_date']] = $row['visits'];
}
foreach ($data_table as $row) {
$visits_today = (int)(isset($visit_array[$row['fix_date']]) ? $visit_array[$row['fix_date']] : 0);
$date_from_greg = ($this->context->cookie->stats_granularity != 42
? 'LIKE \''.$row['fix_date'].'%\''
: 'BETWEEN \''.Tools::substr($row['fix_date'], 0, 10).' 00:00:00\' AND DATE_ADD(\''.Tools::substr($row['fix_date'], 0, 8).Tools::substr($row['fix_date'], 8, 2).' 23:59:59\', INTERVAL 7 DAY)');
$row['registrations'] = Db::getInstance()->getValue('
SELECT COUNT(*) FROM '._DB_PREFIX_.'customer
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween().'
AND date_add '.$date_from_greg
.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER));
$this->html .= '
<tr>
<td>'.$row['fix_date'].'</td>
<td class="text-center">'.$visits_today.'</td>
<td class="text-center">'.(int)$row['registrations'].'</td>
<td class="text-center">'.(int)$row['countOrders'].'</td>
<td class="text-center">'.(int)$row['countProducts'].'</td>
<td class="text-center">'.($visits_today ? round(100 * (int)$row['registrations'] / $visits_today, 2).' %' : '-').'</td>
<td class="text-center">'.($visits_today ? round(100 * (int)$row['countOrders'] / $visits_today, 2).' %' : '-').'</td>
<td class="text-right">'.Tools::displayPrice($row['totalSales'], $currency).'</td>
</tr>';
$this->t1 += $visits_today;
$this->t2 += (int)$row['registrations'];
$this->t3 += (int)$row['countOrders'];
$this->t4 += (int)$row['countProducts'];
$this->t8 += $row['totalSales'];
}
$this->html .= '
<tr>
<th></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Visits', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Registrations', array(), 'Admin.Shopparameters.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Placed orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Bought items', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of registrations', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Revenue', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
<tr>
<td>'.$this->trans('Total', array(), 'Admin.Global').'</td>
<td class="text-center">'.(int)$this->t1.'</td>
<td class="text-center">'.(int)$this->t2.'</td>
<td class="text-center">'.(int)$this->t3.'</td>
<td class="text-center">'.(int)$this->t4.'</td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-right">'.Tools::displayPrice($this->t8, $currency).'</td>
</tr>
<tr>
<td>'.$this->trans('Average', array(), 'Modules.Statsforecast.Admin').'</td>
<td class="text-center">'.(int)($this->t1 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t2 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t3 / $interval_avg).'</td>
<td class="text-center">'.(int)($this->t4 / $interval_avg).'</td>
<td class="text-center">'.($this->t1 ? round(100 * $this->t2 / $this->t1, 2).' %' : '-').'</td>
<td class="text-center">'.($this->t1 ? round(100 * $this->t3 / $this->t1, 2).' %' : '-').'</td>
<td class="text-right">'.Tools::displayPrice($this->t8 / $interval_avg, $currency).'</td>
</tr>
<tr>
<td>'.$this->trans('Forecast', array(), 'Modules.Statsforecast.Admin').'</td>
<td class="text-center">'.(int)($this->t1 * $prop30).'</td>
<td class="text-center">'.(int)($this->t2 * $prop30).'</td>
<td class="text-center">'.(int)($this->t3 * $prop30).'</td>
<td class="text-center">'.(int)($this->t4 * $prop30).'</td>
<td class="text-center">--</td>
<td class="text-center">--</td>
<td class="text-right">'.Tools::displayPrice($this->t8 * $prop30, $currency).'</td>
</tr>
</table>
</div>';
$ca = $this->getRealCA();
$sql = 'SELECT COUNT(DISTINCT c.id_guest)
FROM '._DB_PREFIX_.'connections c
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c');
$visitors = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT g.id_customer)
FROM '._DB_PREFIX_.'connections c
INNER JOIN '._DB_PREFIX_.'guest g ON c.id_guest = g.id_guest
WHERE g.id_customer != 0
AND c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(false, 'c');
$customers = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT c.id_cart)
FROM '._DB_PREFIX_.'cart c
INNER JOIN '._DB_PREFIX_.'cart_product cp on c.id_cart = cp.id_cart
WHERE (c.date_add BETWEEN '.ModuleGraph::getDateBetween().' OR c.date_upd BETWEEN '.ModuleGraph::getDateBetween().')
'.Shop::addSqlRestriction(false, 'c');
$carts = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(DISTINCT c.id_cart)
FROM '._DB_PREFIX_.'cart c
INNER JOIN '._DB_PREFIX_.'cart_product cp on c.id_cart = cp.id_cart
WHERE (c.date_add BETWEEN '.ModuleGraph::getDateBetween().' OR c.date_upd BETWEEN '.ModuleGraph::getDateBetween().')
AND id_address_invoice != 0
'.Shop::addSqlRestriction(false, 'c');
$fullcarts = Db::getInstance()->getValue($sql);
$sql = 'SELECT COUNT(*)
FROM '._DB_PREFIX_.'orders o
WHERE o.valid = 1
AND o.date_add BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$orders = Db::getInstance()->getValue($sql);
$this->html .= '
<div class="row row-margin-bottom">
<h4><i class="icon-filter"></i> '.$this->trans('Conversion', array(), 'Modules.Statsforecast.Admin').'</h4>
</div>
<div class="row row-margin-bottom">
<table class="table">
<tbody>
<tr>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Visitors', array(), 'Admin.Shopparameters.Feature').'</p>
<p>'.$visitors.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $customers / max(1, $visitors), 2).' %</p>
</td>
<td class="text-center">
<p>'.$this->trans('Accounts', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$customers.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $customers), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Full carts', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$fullcarts.'</p>
</td>
<td rowspan="2" class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $orders / max(1, $fullcarts), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
<p>'.$orders.'</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Registered visitors', array(), 'Modules.Statsforecast.Admin').'</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.round(100 * $orders / max(1, $customers), 2).' %</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Visitors', array(), 'Admin.Shopparameters.Feature').'</p>
</td>
<td rowspan="2" class="text-center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.round(100 * $orders / max(1, $visitors), 2).' %</p>
</td>
<td rowspan="2" class="center">
<i class="icon-chevron-right"></i>
</td>
<td rowspan="2" class="text-center">
<p>'.$this->trans('Orders', array(), 'Admin.Global').'</p>
</td>
</tr>
<tr>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $carts / max(1, $visitors)).' %</p>
</td>
<td class="text-center">
<p>'.$this->trans('Carts', array(), 'Admin.Global').'</p>
<p>'.$carts.'</p>
</td>
<td class="text-center">
<p><i class="icon-chevron-right"></i></p>
<p>'.round(100 * $fullcarts / max(1, $carts)).' %</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="alert alert-info">
<p>'.$this->trans('A simple statistical calculation lets you know the monetary value of your visitors:', array(), 'Modules.Statsforecast.Admin').'</p>
<p>'.$this->trans('On average, each visitor places an order for this amount:', array(), 'Modules.Statsforecast.Admin').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $visitors), $currency).'.</b></p>
<p>'.$this->trans('On average, each registered visitor places an order for this amount:', array(), 'Modules.Statsforecast.Admin').' <b>'.Tools::displayPrice($ca['ventil']['total'] / max(1, $customers), $currency).'</b>.</p>
</div>';
$from = strtotime($employee->stats_date_from.' 00:00:00');
$to = strtotime($employee->stats_date_to.' 23:59:59');
$interval = ($to - $from) / 60 / 60 / 24;
$this->html .= '
<div class="row row-margin-bottom">
<h4><i class="icon-money"></i> '.$this->trans('Payment distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<div class="alert alert-info">'
.$this->trans('The amounts include taxes, so you can get an estimation of the commission due to the payment method.', array(), 'Modules.Statsforecast.Admin').'
</div>
<form id="cat" action="'.Tools::safeOutput($ru).'#payment" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Module', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Average cart value', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['payment'] as $payment) {
$this->html .= '
<tr>
<td class="text-center">'.$payment['payment_method'].'</td>
<td class="text-center">'.(int)$payment['nb'].'</td>
<td class="text-right">'.Tools::displayPrice($payment['total'], $currency).'</td>
<td class="text-right">'.Tools::displayPrice($payment['total'] / (int)$payment['nb'], $currency).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-sitemap"></i> '.$this->trans('Category distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<form id="cat_1" action="'.Tools::safeOutput($ru).'#cat" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Category', array(), 'Admin.Catalog.Feature').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Average price', array(), 'Admin.Global').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['cat'] as $catrow) {
$this->html .= '
<tr>
<td class="text-center">'.(empty($catrow['name']) ? $this->trans('Unknown', array(), 'Admin.Shopparameters.Feature') : $catrow['name']).'</td>
<td class="text-center">'.$catrow['orderQty'].'</td>
<td class="text-right">'.Tools::displayPrice($catrow['orderSum'], $currency).'</td>
<td class="text-center">'.number_format((100 * $catrow['orderQty'] / $this->t4), 1, '.', ' ').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $catrow['orderSum'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
<td class="text-right">'.Tools::displayPrice($catrow['priveAvg'], $currency).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-flag"></i> '.$this->trans('Language distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Language', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage', array(), 'Admin.Global').'</span></th>
<th class="text-center" colspan="2"><span class="title_box active">'.$this->trans('Growth', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['lang'] as $ophone => $amount) {
$percent = (int)($ca['langprev'][$ophone]) ? number_format((100 * $amount / $ca['langprev'][$ophone]) - 100, 1, '.', ' ') : '&#x221e;';
$this->html .= '
<tr '.(($percent < 0) ? 'class="alt_row"' : '').'>
<td class="text-center">'.$ophone.'</td>
<td class="text-right">'.Tools::displayPrice($amount, $currency).'</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $amount / $ca['ventil']['total']), 1, '.', ' ').'%' : '-').'</td>
<td class="text-center">'.(($percent > 0 || $percent == '&#x221e;') ? '<img src="../img/admin/arrow_up.png" alt="" />' : '<img src="../img/admin/arrow_down.png" alt="" /> ').'</td>
<td class="text-center">'.(($percent > 0 || $percent == '&#x221e;') ? '+' : '').$percent.'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-map-marker"></i> '.$this->trans('Zone distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Zone', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Sales', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['zones'] as $zone) {
$this->html .= '
<tr>
<td class="text-center">'.(isset($zone['name']) ? $zone['name'] : $this->trans('Undefined', array(), 'Admin.Shopparameters.Feature')).'</td>
<td class="text-center">'.(int)($zone['nb']).'</td>
<td class="text-right">'.Tools::displayPrice($zone['total'], $currency).'</td>
<td class="text-center">'.($ca['ventil']['nb'] ? number_format((100 * $zone['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $zone['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-money"></i> '.$this->trans('Currency distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<form id="cat_2" action="'.Tools::safeOutput($ru).'#currencies" method="post" class="form-horizontal">
<div class="row row-margin-bottom">
<label class="control-label col-lg-3">
'.$this->trans('Zone', array(), 'Admin.Global').'
</label>
<div class="col-lg-3">
<input type="hidden" name="submitIdZone" value="1" />
<select name="stats_id_zone" onchange="this.form.submit();">
<option value="0">'.$this->trans('-- No filter --', array(), 'Modules.Statsforecast.Admin').'</option>';
foreach (Zone::getZones() as $zone) {
$this->html .= '<option value="'.(int)$zone['id_zone'].'" '.($this->context->cookie->stats_id_zone == $zone['id_zone'] ? 'selected="selected"' : '').'>'.$zone['name'].'</option>';
}
$this->html .= '
</select>
</div>
</div>
</form>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Currency', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Orders', array(), 'Admin.Global').'</span></th>
<th class="text-right"><span class="title_box active">'.$this->trans('Sales (converted)', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of orders', array(), 'Modules.Statsforecast.Admin').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Percentage of sales', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['currencies'] as $currency_row) {
$this->html .= '
<tr>
<td class="text-center">'.$currency_row['name'].'</td>
<td class="text-center">'.(int)($currency_row['nb']).'</td>
<td class="text-right">'.Tools::displayPrice($currency_row['total'], $currency).'</td>
<td class="text-center">'.($ca['ventil']['nb'] ? number_format((100 * $currency_row['nb'] / $ca['ventil']['nb']), 1, '.', ' ') : '0').'%</td>
<td class="text-center">'.((int)$ca['ventil']['total'] ? number_format((100 * $currency_row['total'] / $ca['ventil']['total']), 1, '.', ' ') : '0').'%</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>
<div class="row row-margin-bottom">
<h4><i class="icon-ticket"></i> '.$this->trans('Attribute distribution', array(), 'Modules.Statsforecast.Admin').'</h4>
<table class="table">
<thead>
<tr>
<th class="text-center"><span class="title_box active">'.$this->trans('Group', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Attribute', array(), 'Admin.Global').'</span></th>
<th class="text-center"><span class="title_box active">'.$this->trans('Quantity of products sold', array(), 'Modules.Statsforecast.Admin').'</span></th>
</tr>
</thead>
<tbody>';
foreach ($ca['attributes'] as $attribut) {
$this->html .= '
<tr>
<td class="text-center">'.$attribut['gname'].'</td>
<td class="text-center">'.$attribut['aname'].'</td>
<td class="text-center">'.(int)($attribut['total']).'</td>
</tr>';
}
$this->html .= '
</tbody>
</table>
</div>';
return $this->html;
}
private function getRealCA()
{
$employee = $this->context->employee;
$ca = array();
$where = $join = '';
if ((int)$this->context->cookie->stats_id_zone) {
$join = ' LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address LEFT JOIN `'._DB_PREFIX_.'country` co ON co.id_country = a.id_country';
$where = ' AND co.id_zone = '.(int)$this->context->cookie->stats_id_zone.' ';
}
$sql = 'SELECT SUM(od.`product_price` * od.`product_quantity` / o.conversion_rate) as orderSum, SUM(od.product_quantity) as orderQty, cl.name, AVG(od.`product_price` / o.conversion_rate) as priveAvg
FROM `'._DB_PREFIX_.'orders` o
STRAIGHT_JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
'.Shop::addSqlAssociation('product', 'p').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (product_shop.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
'.$join.'
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY product_shop.id_category_default';
$ca['cat'] = Db::getInstance()->executeS($sql);
uasort($ca['cat'], 'statsforecast_sort');
$lang_values = '';
$sql = 'SELECT l.id_lang, l.iso_code
FROM `'._DB_PREFIX_.'lang` l
'.Shop::addSqlAssociation('lang', 'l').'
WHERE l.active = 1';
$languages = Db::getInstance()->executeS($sql);
foreach ($languages as $language) {
$lang_values .= 'SUM(IF(o.id_lang = '.(int)$language['id_lang'].', total_paid_tax_excl / o.conversion_rate, 0)) as '.pSQL($language['iso_code']).',';
}
$lang_values = rtrim($lang_values, ',');
if ($lang_values) {
$sql = 'SELECT '.$lang_values.'
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['lang'] = Db::getInstance()->getRow($sql);
arsort($ca['lang']);
$sql = 'SELECT '.$lang_values.'
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND ADDDATE(o.`invoice_date`, interval 30 day) BETWEEN \''.$employee->stats_date_from.' 00:00:00\' AND \''.min(date('Y-m-d H:i:s'), $employee->stats_date_to.' 23:59:59').'\'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['langprev'] = Db::getInstance()->getRow($sql);
} else {
$ca['lang'] = array();
$ca['langprev'] = array();
}
$sql = 'SELECT reference
FROM `'._DB_PREFIX_.'orders` o
'.$join.'
WHERE o.valid
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'';
$result = Db::getInstance()->executeS($sql);
if (count($result)) {
$references = array();
foreach ($result as $r) {
$references[] = $r['reference'];
}
$sql = 'SELECT op.payment_method, SUM(op.amount / op.conversion_rate) as total, COUNT(DISTINCT op.order_reference) as nb
FROM `'._DB_PREFIX_.'order_payment` op
WHERE op.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
AND op.order_reference IN (
"'.implode('","', $references).'"
)
GROUP BY op.payment_method
ORDER BY total DESC';
$ca['payment'] = Db::getInstance()->executeS($sql);
} else {
$ca['payment'] = array();
}
$sql = 'SELECT z.name, SUM(o.total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) as nb
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_invoice = a.id_address
LEFT JOIN `'._DB_PREFIX_.'country` c ON c.id_country = a.id_country
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.id_zone = c.id_zone
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY c.id_zone
ORDER BY total DESC';
$ca['zones'] = Db::getInstance()->executeS($sql);
$sql = 'SELECT cu.name, SUM(o.total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) as nb
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'currency` cu ON o.id_currency = cu.id_currency
'.$join.'
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.$where.'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY o.id_currency
ORDER BY total DESC';
$ca['currencies'] = Db::getInstance()->executeS($sql);
$sql = 'SELECT SUM(total_paid_tax_excl / o.conversion_rate) as total, COUNT(*) AS nb
FROM `'._DB_PREFIX_.'orders` o
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
$ca['ventil'] = Db::getInstance()->getRow($sql);
$sql = 'SELECT /*pac.id_attribute,*/ agl.name as gname, al.name as aname, COUNT(*) as total
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON od.product_attribute_id = pac.id_product_attribute
INNER JOIN '._DB_PREFIX_.'attribute a ON pac.id_attribute = a.id_attribute
INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (a.id_attribute_group = agl.id_attribute_group AND agl.id_lang = '.(int)$this->context->language->id.')
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = '.(int)$this->context->language->id.')
WHERE o.valid = 1
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
GROUP BY pac.id_attribute';
$ca['attributes'] = Db::getInstance()->executeS($sql);
return $ca;
}
}
function statsforecast_sort($a, $b)
{
if ($a['orderSum'] == $b['orderSum']) {
return 0;
}
return ($a['orderSum'] > $b['orderSum']) ? -1 : 1;
}

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,35 @@
<?php
/*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit026a9fc36346f301b105b3da6da2a20f::getLoader();

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,52 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit026a9fc36346f301b105b3da6da2a20f
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit026a9fc36346f301b105b3da6da2a20f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit026a9fc36346f301b105b3da6da2a20f', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit026a9fc36346f301b105b3da6da2a20f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
return $loader;
}
}

View File

@@ -0,0 +1,15 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit026a9fc36346f301b105b3da6da2a20f
{
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1 @@
[]