//kevin special commit
This commit is contained in:
@@ -1,3 +1,32 @@
|
||||
{*
|
||||
* 2007-2013 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-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<script>
|
||||
var dashboard_ajax_url = '{$link->getAdminLink('AdminDashboard')}';
|
||||
</script>
|
||||
|
||||
<div class="page-head">
|
||||
<h2 class="page-title">
|
||||
{l s='Dashboard'}
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ class HookCore extends ObjectModel
|
||||
$output .= self::wrapLiveEdit($display, $moduleInstance, $array['id_hook']);
|
||||
}
|
||||
else if ($array_return)
|
||||
$output[] = $display;
|
||||
$output[$moduleInstance->name] = $display;
|
||||
else
|
||||
$output .= $display;
|
||||
}
|
||||
|
||||
@@ -56,4 +56,14 @@ class AdminDashboardControllerCore extends AdminController
|
||||
);
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function ajaxProcessRefreshDashboard()
|
||||
{
|
||||
$id_module = null;
|
||||
if ($module = Tools::getValue('module'))
|
||||
$id_module = Module::getInstanceByName($module)->id;
|
||||
|
||||
$datas = Hook::exec('dashboardDatas', array(), $id_module, true);
|
||||
die(Tools::jsonEncode($datas));
|
||||
}
|
||||
}
|
||||
@@ -21,3 +21,48 @@
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
$(document).ready( function () {
|
||||
refreshDashbard();
|
||||
});
|
||||
|
||||
|
||||
function refreshDashbard()
|
||||
{
|
||||
datas = {
|
||||
ajax:true,
|
||||
action:'refreshDashboard'
|
||||
};
|
||||
$.ajax({
|
||||
url : dashboard_ajax_url,
|
||||
data : datas,
|
||||
dataType: 'json',
|
||||
success : function(widgets){
|
||||
for (var name in widgets)
|
||||
for (data_type in widgets[name])
|
||||
window[data_type](widgets[name][data_type]);
|
||||
},
|
||||
error : function(data){
|
||||
alert("[TECHNICAL ERROR]");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function data_value(datas)
|
||||
{
|
||||
for (var data_id in datas)
|
||||
$('#'+data_id).html(datas[data_id]);
|
||||
}
|
||||
|
||||
function data_trends(datas)
|
||||
{
|
||||
for (var data_id in datas)
|
||||
{
|
||||
$('#'+data_id).html(datas[data_id]['value']);
|
||||
if (datas[data_id]['value'] == 'down')
|
||||
$('#'+data_id).parent().removeClass('dash_trend_up').addClass('dash_trend_down');
|
||||
else
|
||||
$('#'+data_id).parent().removeClass('dash_trend_down').addClass('dash_trend_up');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class Dashactivity extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneOne'))
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneOne') || !$this->registerHook('dashboardDatas'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -51,4 +51,29 @@ class Dashactivity extends Module
|
||||
{
|
||||
return $this->display(__FILE__, 'dashboard_zone_one.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardDatas($params)
|
||||
{
|
||||
return array(
|
||||
'data_value' => array(
|
||||
'order_nbr' => 365,
|
||||
'pending_orders' => 120,
|
||||
'return_exchanges' => 35,
|
||||
'abandoned_cart' => 12,
|
||||
'products_out_of_stock' => 4,
|
||||
'new_messages' => 42,
|
||||
'order_inquires' => 13,
|
||||
'product_reviews' => 56,
|
||||
'new_customers' => 42,
|
||||
'online_visitor' => 200,
|
||||
'new_registrations' => 125,
|
||||
'total_suscribers' => 13500,
|
||||
'visits' => 10000,
|
||||
'unique_visitors' => 3500,
|
||||
),
|
||||
'data_trends' => array(
|
||||
'orders_trends' => array('way' => 'down', 'value' => 0.66),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class Dashproducts extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneTwo'))
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardDatas'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -51,4 +51,10 @@ class Dashproducts extends Module
|
||||
{
|
||||
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardDatas($params)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class Dashtrends extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneTwo'))
|
||||
if (!parent::install() || !$this->registerHook('dashboardZoneTwo') || !$this->registerHook('dashboardDatas'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -51,4 +51,9 @@ class Dashtrends extends Module
|
||||
{
|
||||
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
|
||||
}
|
||||
|
||||
public function hookDashboardDatas($params)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user