Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

This commit is contained in:
Vincent Augagneur
2013-11-05 16:32:12 +01:00
61 changed files with 565 additions and 368 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

@@ -25,12 +25,21 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class DashGoalsAjaxModuleAdminController extends ModuleAdminController
class AdminDashgoalsController extends ModuleAdminController
{
public function initContent()
{
parent::initContent();
die ('Todo');
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(
'currency' => $this->context->currency,
'goals_year' => $year,
'goals_months' => $months,
'link' => $this->context->link
));
echo $this->module->display(_PS_MODULE_DIR_.$this->module->name.DIRECTORY_SEPARATOR.$this->module->name.'.php', 'config.tpl');
}
}
+40 -8
View File
@@ -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'));
@@ -73,23 +74,44 @@ class Dashgoals extends Module
ConfigurationKPI::updateValue($key, 80);
}
// Prepare tab
$tab = new Tab();
$tab->active = 1;
$tab->class_name = "AdminDashgoals";
$tab->name = array();
foreach (Language::getLanguages(true) as $lang)
$tab->name[$lang['id_lang']] = 'Dashgoals';
$tab->id_parent = -1;
$tab->module = $this->name;
return (
parent::install()
$tab->add()
&& parent::install()
&& $this->registerHook('dashboardZoneTwo')
&& $this->registerHook('dashboardData')
&& $this->registerHook('displayBackOfficeHeader')
);
}
public function uninstall()
{
$id_tab = (int)Tab::getIdFromClassName('AdminDashgoals');
if ($id_tab)
{
$tab = new Tab($id_tab);
$tab->delete();
}
return parent::uninstall();
}
public function hookDisplayBackOfficeHeader()
{
if (get_class($this->context->controller) == 'AdminDashboardController')
$this->context->controller->addJs($this->_path.'views/js/'.$this->name.'.js');
}
public function hookDashboardZoneTwo($params)
public function setMonths($year)
{
$year = date('Y');
$months = array();
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
$months[$i.'_'.$year] = array('label' => Dashgoals::$month_labels[$i], 'values' => array());
@@ -102,16 +124,26 @@ class Dashgoals extends Module
ConfigurationKPI::updateValue(strtoupper($key), (float)Tools::getValue($key));
$month_row['values'][$type] = ConfigurationKPI::get(strtoupper($key));
}
return $months;
}
$this->context->smarty->assign('currency', $this->context->currency);
$this->context->smarty->assign('goals_year', $year);
$this->context->smarty->assign('goals_months', $months);
public function hookDashboardZoneTwo($params)
{
$year = Configuration::get('PS_DASHGOALS_CURRENT_YEAR');
$months = $this->setMonths($year);
$this->context->smarty->assign(array(
'currency' => $this->context->currency,
'goals_year' => $year,
'goals_months' => $months,
'dashgoals_ajax_link' => $this->context->link->getAdminLink('AdminDashgoals')
));
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
}
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)));
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

+21 -15
View File
@@ -35,24 +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)
{
// 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);
$.ajax({
url: dashgoals_ajax_link,
data: {
ajax: true,
action: 'changeconfyear',
year: new_year
},
success : function(result){
$('#dashgoals_title').text($('#dashgoals_title').text().replace(dashgoals_year, new_year));
var hide_conf = $('#dashgoals_config').hasClass('hide');
$('#dashgoals_config').replaceWith(result);
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();
});
@@ -0,0 +1,73 @@
{*
* 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
*}
<section id="dashgoals_config" class="dash_config hide">
<header><i class="icon-wrench"></i> {l s='Configuration' mod='dashgoals'}</header>
<form class="defaultForm form-horizontal" method="post" action="{$link->getAdminLink('AdminDashboard')}">
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<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>
<th>{l s='Sales' mod='dashgoals'}</th>
</tr>
</thead>
<tbody>
{foreach $goals_months as $month}
<tr>
<td>
{$month.label}
</td>
<td>
<div class="input-group">
<input id="dashgoals_traffic_{$month@key}" name="dashgoals_traffic_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.traffic|intval}" />
</div>
</td>
<td>
<div class="input-group">
<input id="dashgoals_conversion_{$month@key}" name="dashgoals_conversion_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.conversion|floatval}" />
<span class="input-group-addon">%</span>
</div>
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency->iso_code|escape}</span>
<input id="dashgoals_avg_cart_value_{$month@key}" name="dashgoals_avg_cart_value_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.avg_cart_value|intval}" />
</div>
</td>
<td id="dashgoals_sales_{$month@key}" class="dashgoals_sales">
</td>
</tr>
{/foreach}
</tbody>
</table>
<input class="btn btn-default" name="submitDashGoals" type="submit" value="{l s='Save' mod='dashgoals'}" />
</form>
</section>
@@ -30,6 +30,8 @@
var priceDisplayPrecision = 0;
var dashgoals_year = {$goals_year|intval};
var dashgoals_ajax_link = '{$dashgoals_ajax_link|addslashes}';
</script>
<section id="dashgoals" class="panel widget">
@@ -46,58 +48,7 @@
</a>
</span>
</header>
<section id="dashgoals_config" class="dash_config hide">
<header><i class="icon-wrench"></i> {l s='Configuration' mod='dashgoals'}</header>
<form class="defaultForm form-horizontal" method="post" action="{$link->getAdminLink('AdminDashboard')}">
<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>{l s='Traffic' mod='dashgoals'}</th>
<th>{l s='Conversion Rate' mod='dashgoals'}</th>
<th>{l s='Average Cart Value' mod='dashgoals'}</th>
<th>{l s='Sales' mod='dashgoals'}</th>
</tr>
</thead>
<tbody>
{foreach $goals_months as $month}
<tr>
<td>
{$month.label}
</td>
<td>
<div class="input-group">
<input id="dashgoals_traffic_{$month@key}" name="dashgoals_traffic_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.traffic|intval}" />
</div>
</td>
<td>
<div class="input-group">
<input id="dashgoals_conversion_{$month@key}" name="dashgoals_conversion_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.conversion|floatval}" />
<span class="input-group-addon">%</span>
</div>
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency->iso_code|escape}</span>
<input id="dashgoals_avg_cart_value_{$month@key}" name="dashgoals_avg_cart_value_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.avg_cart_value|intval}" />
</div>
</td>
<td id="dashgoals_sales_{$month@key}" class="dashgoals_sales">
</td>
</tr>
{/foreach}
</tbody>
</table>
<input class="btn btn-default" name="submitDashGoals" type="submit" value="{l s='Save' mod='dashgoals'}" />
</form>
</section>
{include file='./config.tpl'}
<section class="loading">
<div id="dash_goals_chart1" class="chart with-transitions">
<svg></svg>
Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B