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

This commit is contained in:
Kevin Granger
2013-11-28 14:35:41 +01:00
3 changed files with 29 additions and 19 deletions
+16 -16
View File
@@ -627,23 +627,23 @@ class AdminModulesControllerCore extends AdminController
{
$file = $f['file'];
$content = Tools::file_get_contents(_PS_ROOT_DIR_.$file);
$xml = @simplexml_load_string($content, null, LIBXML_NOCDATA);
foreach ($xml->module as $modaddons)
if ($name == $modaddons->name && isset($modaddons->id) && ($this->logged_on_addons || $f['loggedOnAddons'] == 0))
{
$download_ok = false;
if ($f['loggedOnAddons'] == 0)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id)))))
$download_ok = true;
elseif ($f['loggedOnAddons'] == 1 && $this->logged_on_addons)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons))))))
$download_ok = true;
if ($xml = @simplexml_load_string($content, null, LIBXML_NOCDATA))
foreach ($xml->module as $modaddons)
if ($name == $modaddons->name && isset($modaddons->id) && ($this->logged_on_addons || $f['loggedOnAddons'] == 0))
{
$download_ok = false;
if ($f['loggedOnAddons'] == 0)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id)))))
$download_ok = true;
elseif ($f['loggedOnAddons'] == 1 && $this->logged_on_addons)
if (file_put_contents(_PS_MODULE_DIR_.$modaddons->name.'.zip', Tools::addonsRequest('module', array('id_module' => pSQL($modaddons->id), 'username_addons' => pSQL(trim($this->context->cookie->username_addons)), 'password_addons' => pSQL(trim($this->context->cookie->password_addons))))))
$download_ok = true;
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
}
}
+11 -2
View File
@@ -153,9 +153,10 @@ class Dashgoals extends Module
$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());
$stream1 = array('key' => $this->l('Traffic'), 'values' => array(), 'disabled' => true);
$stream2 = array('key' => $this->l('Conversion Rate'), 'values' => array());
$stream3 = array('key' => $this->l('Average Cart Value'), 'values' => array());
$stream4 = array('key' => $this->l('Sales'), 'values' => array());
for ($i = '01'; $i <= 12; $i = sprintf('%02d', $i + 1))
{
@@ -178,7 +179,15 @@ class Dashgoals extends Module
if ($goal && isset($orders[$timestamp]) && $orders[$timestamp] && isset($sales[$timestamp]) && $sales[$timestamp])
$value = round(($sales[$timestamp] / $orders[$timestamp]) / $goal, 2);
$stream3['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
$goal = ConfigurationKPI::get(strtoupper('dashgoals_traffic_'.$i.'_'.$year))
* ConfigurationKPI::get(strtoupper('dashgoals_conversion_'.$i.'_'.$year)) / 100
* ConfigurationKPI::get(strtoupper('dashgoals_avg_cart_value_'.$i.'_'.$year));
$value = 0;
if ($goal && isset($sales[$timestamp]) && $sales[$timestamp])
$value = round($sales[$timestamp] / $goal, 2);
$stream4['values'][] = array('x' => Dashgoals::$month_labels[$i], 'y' => $value);
}
return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3));
return array('chart_type' => 'bar_chart_goals', 'data' => array($stream1, $stream2, $stream3, $stream4));
}
}
@@ -36,8 +36,9 @@
<section id="dashgoals" class="panel widget">
<header class="panel-heading">
<i class="icon-bar-chart"></i> <span id="dashgoals_title">{l s='Your %s Forecast' mod='dashgoals' sprintf=$goals_year}</span>
<i class="icon-bar-chart"></i> {l s='Your forecast' mod='dashgoals'}
<a href="javascript:void(0);" onclick="dashgoals_changeYear('backward');" class="icon-backward"></a>
<span id="dashgoals_title">{$goals_year}</span>
<a href="javascript:void(0);" onclick="dashgoals_changeYear('forward');" class="icon-forward"></a>
<span class="panel-heading-action">
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="toggleDashConfig('dashgoals');" title="configure">