diff --git a/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl index cdcd6394a..aa4f69b9f 100644 --- a/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/search/helpers/view/view.tpl @@ -157,7 +157,7 @@ $(function() { {foreach $addons key=key item=addon} - {$addon.title|escape:'htmlall':'UTF-8'} + {$addon.title|escape:'htmlall':'UTF-8'} {$addon.description|truncate:256:'...'|escape:'htmlall':'UTF-8'} {/foreach} diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index ecacff248..73c5bea95 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -303,7 +303,8 @@ class AdminDashboardControllerCore extends AdminController 'date_to' => $this->context->employee->stats_date_to, 'compare_from' => $this->context->employee->stats_compare_from, 'compare_to' => $this->context->employee->stats_compare_to, - 'dashboard_use_push' => (int)Tools::getValue('dashboard_use_push') + 'dashboard_use_push' => (int)Tools::getValue('dashboard_use_push'), + 'extra' => (int)Tools::getValue('extra') ); die(Tools::jsonEncode(Hook::exec('dashboardData', $params, $id_module, true, true, (int)Tools::getValue('dashboard_use_push')))); diff --git a/js/admin-dashboard.js b/js/admin-dashboard.js index f708d7b60..7cc9c2389 100644 --- a/js/admin-dashboard.js +++ b/js/admin-dashboard.js @@ -31,7 +31,6 @@ $(document).ready( function () { $(".preactivationLink").click(function() { preactivationLinkClick($(this).attr("rel")); }); - refreshDashboard(false, false); getBlogRss(); @@ -40,7 +39,7 @@ $(document).ready( function () { }); -function refreshDashboard(module_name, use_push) +function refreshDashboard(module_name, use_push, extra) { module_list = new Array(); @@ -72,7 +71,8 @@ function refreshDashboard(module_name, use_push) ajax:true, action:'refreshDashboard', module:module_list[module_id], - dashboard_use_push:Number(use_push) + dashboard_use_push:Number(use_push), + extra:extra }, dataType: 'json', success : function(widgets){ @@ -82,9 +82,6 @@ function refreshDashboard(module_name, use_push) if (parseInt(dashboard_use_push) == 1) refreshDashboard(false, true); - }, - error : function(data){ - //@TODO display errors } }); } @@ -108,9 +105,6 @@ function setDashboardDateRange(action) } else $('#datepickerFrom, #datepickerTo').parent('.input-group').addClass('has-error'); - }, - error : function(data){ - //@TODO display errors } }); } @@ -218,9 +212,6 @@ function getBlogRss() else { $('.dash_news').hide(); } - }, - error : function(data){ - //@TODO display errors } }); } @@ -280,9 +271,6 @@ function saveDashConfig(widget_name) refreshDashboard(widget_name); toggleDashConfig(widget_name); } - }, - error : function(data){ - //@TODO display errors } }); } @@ -300,9 +288,6 @@ function preactivationLinkClick(module) type: 'POST', success : function(jsonData){ - }, - error : function(data){ - //@TODO display errors } }); } diff --git a/modules/dashgoals/controllers/admin/ajax.php b/modules/dashgoals/controllers/admin/ajax.php new file mode 100644 index 000000000..efdc50edf --- /dev/null +++ b/modules/dashgoals/controllers/admin/ajax.php @@ -0,0 +1,36 @@ + + * @copyright 2007-2013 PrestaShop SA + * @version Release: $Revision: 13573 $ + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +class DashGoalsAjaxModuleAdminController extends ModuleAdminController +{ + public function initContent() + { + parent::initContent(); + + die ('Todo'); + } +} \ No newline at end of file diff --git a/modules/dashgoals/dashgoals.php b/modules/dashgoals/dashgoals.php index 685bc116a..6578b156e 100644 --- a/modules/dashgoals/dashgoals.php +++ b/modules/dashgoals/dashgoals.php @@ -111,16 +111,15 @@ class Dashgoals extends Module public function hookDashboardData($params) { - return array('data_chart' => array('dash_goals_chart1' => $this->getChartData())); + $year = ((isset($params['extra']) && $params['extra'] > 1970 && $params['extra'] < 2999) ? $params['extra'] : date('Y')); + return array('data_chart' => array('dash_goals_chart1' => $this->getChartData($year))); } - public function getChartData() + public function getChartData($year) { - $year = date('Y'); - - $visits = AdminStatsController::getVisits(false, date('Y-01-01'), date('Y-12-31'), 'month'); - $orders = AdminStatsController::getOrders(date('Y-01-01'), date('Y-12-31'), 'month'); - $sales = AdminStatsController::getTotalSales(date('Y-01-01'), date('Y-12-31'), 'month'); + $visits = AdminStatsController::getVisits(false, $year.date('-01-01'), $year.date('-12-31'), 'month'); + $orders = AdminStatsController::getOrders($year.date('-01-01'), $year.date('-12-31'), 'month'); + $sales = AdminStatsController::getTotalSales($year.date('-01-01'), $year.date('-12-31'), 'month'); $stream1 = array('key' => $this->l('Traffic'), 'values' => array()); $stream2 = array('key' => $this->l('Conversion Rate'), 'values' => array()); diff --git a/modules/dashgoals/views/js/dashgoals.js b/modules/dashgoals/views/js/dashgoals.js index a1f7c51c4..d1cc960d2 100644 --- a/modules/dashgoals/views/js/dashgoals.js +++ b/modules/dashgoals/views/js/dashgoals.js @@ -28,6 +28,28 @@ function dashgoals_calc_sales() }); } +function dashgoals_changeYear(xward) +{ + var new_year = dashgoals_year; + if (xward == 'forward') + new_year = dashgoals_year + 1; + else if (xward == 'backward') + new_year = dashgoals_year - 1; + $('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year)); + dashgoals_year = new_year; + refreshDashboard('dashgoals', false, dashgoals_year); +} + +function dashgoals_changeConfYear(xward) +{ + // Todo + // getModuleLink('dashgoals', 'ajax', array('year' => $('#dashgoals_conftitle').text()), $ssl = null, $id_lang = null, $id_shop = null) + if (xward == 'forward') + $('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) + 1); + else if (xward == 'backward') + $('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) - 1); +} + $(document).ready(function() { $('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); diff --git a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl index 9b66c4bc6..5e8eab7d0 100644 --- a/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl +++ b/modules/dashgoals/views/templates/hook/dashboard_zone_two.tpl @@ -28,16 +28,20 @@ var currency_sign = '{$currency->sign|addslashes}'; var currency_blank = {$currency->blank|intval}; var priceDisplayPrecision = 0; + + var dashgoals_year = {$goals_year|intval};
- {l s='Goals' mod='dashgoals'} + {l s='Your %s Forecast' mod='dashgoals' sprintf=$goals_year} + + - + - + @@ -48,7 +52,11 @@ - +
{$goals_year} + + {$goals_year} + + {l s='Traffic' mod='dashgoals'} {l s='Conversion Rate' mod='dashgoals'} {l s='Average Cart Value' mod='dashgoals'}