Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -30,6 +30,7 @@ class AdminDashgoalsController extends ModuleAdminController
|
||||
public function ajaxProcessChangeConfYear()
|
||||
{
|
||||
$year = (int)Tools::getValue('year');
|
||||
Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', $year);
|
||||
$months = $this->module->setMonths($year);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
|
||||
@@ -60,6 +60,7 @@ class Dashgoals extends Module
|
||||
|
||||
public function install()
|
||||
{
|
||||
Configuration::updateValue('PS_DASHGOALS_CURRENT_YEAR', date('Y'));
|
||||
for ($month = '01'; $month <= 12; $month = sprintf('%02d', $month + 1))
|
||||
{
|
||||
$key = strtoupper('dashgoals_traffic_'.$month.'_'.date('Y'));
|
||||
@@ -128,7 +129,7 @@ class Dashgoals extends Module
|
||||
|
||||
public function hookDashboardZoneTwo($params)
|
||||
{
|
||||
$year = date('Y');
|
||||
$year = Configuration::get('PS_DASHGOALS_CURRENT_YEAR');
|
||||
$months = $this->setMonths($year);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
@@ -142,7 +143,7 @@ class Dashgoals extends Module
|
||||
|
||||
public function hookDashboardData($params)
|
||||
{
|
||||
$year = ((isset($params['extra']) && $params['extra'] > 1970 && $params['extra'] < 2999) ? $params['extra'] : date('Y'));
|
||||
$year = ((isset($params['extra']) && $params['extra'] > 1970 && $params['extra'] < 2999) ? $params['extra'] : Configuration::get('PS_DASHGOALS_CURRENT_YEAR'));
|
||||
return array('data_chart' => array('dash_goals_chart1' => $this->getChartData($year)));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,36 +35,30 @@ function dashgoals_changeYear(xward)
|
||||
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)
|
||||
{
|
||||
if (xward == 'forward')
|
||||
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) + 1);
|
||||
else if (xward == 'backward')
|
||||
$('#dashgoals_conftitle').text(parseInt($('#dashgoals_conftitle').text()) - 1);
|
||||
|
||||
$.ajax({
|
||||
url: dashgoals_ajax_link,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'changeconfyear',
|
||||
year: parseInt($('#dashgoals_conftitle').text())
|
||||
year: new_year
|
||||
},
|
||||
success : function(result){
|
||||
$('#dashgoals_config').fadeOut();
|
||||
$('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year));
|
||||
var hide_conf = $('#dashgoals_config').hasClass('hide');
|
||||
$('#dashgoals_config').replaceWith(result);
|
||||
$('#dashgoals_config').removeClass('hide').fadeIn();
|
||||
dashgoals_calc_sales();
|
||||
if (!hide_conf)
|
||||
$('#dashgoals_config').removeClass('hide');
|
||||
$('.dashgoals_config_input').off();
|
||||
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
|
||||
dashgoals_year = new_year;
|
||||
refreshDashboard('dashgoals', false, dashgoals_year);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.dashgoals_config_input').keyup(function() {
|
||||
dashgoals_calc_sales();
|
||||
});
|
||||
$('.dashgoals_config_input').keyup(function() { dashgoals_calc_sales(); });
|
||||
dashgoals_calc_sales();
|
||||
});
|
||||
|
||||
@@ -29,11 +29,7 @@
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<a href="javascript:void(0);" onclick="dashgoals_changeConfYear('backward');" class="icon-backward"></a>
|
||||
<span id="dashgoals_conftitle">{$goals_year}</span>
|
||||
<a href="javascript:void(0);" onclick="dashgoals_changeConfYear('forward');" class="icon-forward"></a>
|
||||
</th>
|
||||
<th>{$goals_year}</th>
|
||||
<th>{l s='Traffic' mod='dashgoals'}</th>
|
||||
<th>{l s='Conversion Rate' mod='dashgoals'}</th>
|
||||
<th>{l s='Average Cart Value' mod='dashgoals'}</th>
|
||||
|
||||
Reference in New Issue
Block a user