[+] BO : Preactivation Premium - Part 2

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13811 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny committed 2012-03-02 09:45:29 +00:00
1 parent ecb6b65901
commit 3ec3810b68
2 files changed
+33 -11

No files matched your search

+24 -11
View File
@@ -519,23 +519,36 @@ class AdminHomeControllerCore extends AdminController
// If preactivation xml file exists, we load it // If preactivation xml file exists, we load it
if (file_exists('../config/xml/preactivation.xml')) if (file_exists('../config/xml/preactivation.xml'))
{ {
$count = 0;
$preactivation = simplexml_load_file('../config/xml/preactivation.xml'); $preactivation = simplexml_load_file('../config/xml/preactivation.xml');
foreach ($preactivation->partner as $partner) foreach ($preactivation->partner as $partner)
{ {
// Cache the logo
if (!file_exists('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png')) if (!file_exists('../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png'))
@copy(htmlentities((string)$partner->logo), '../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png'); @copy(htmlentities((string)$partner->logo), '../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png');
$label_final = ''; // Check if module is not already installed and configured
foreach ($partner->labels->label as $label) $display = 0;
if (empty($label_final) || (string)$label->attributes()->iso == $isoUser) foreach ($partner->checkconfiguration->key as $key)
$label_final = (string)$label; if (Configuration::get(pSQL((string)$key)) == '')
$link = 'index.php?controller=adminmodules&install='.htmlentities((string)$partner->module).'&token='.Tools::getAdminTokenLite('AdminModules').'&module_name='.htmlentities((string)$partner->module).'&redirect=config'; $display = 1;
$return .= '<div style="float:left;width:275px;height:90px;border:1px solid #cccccc;background-color:white;padding-left:5px;padding-right:5px'.(empty($return) ? '' : ';margin-left:45px;').'">
<p align="center"> // Display the module
<a href="'.$link.'"><img src="../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png" alt="'.htmlentities((string)$partner->name).'" border="0" /></a><br /> if ($display == 1 && $count < 2)
<b><a href="'.$link.'">'.htmlentities(utf8_decode((string)$label_final)).'</a></b> {
</p> $label_final = '';
</div>'; foreach ($partner->labels->label as $label)
if (empty($label_final) || (string)$label->attributes()->iso == $isoUser)
$label_final = (string)$label;
$link = 'index.php?controller=adminmodules&install='.htmlentities((string)$partner->module).'&token='.Tools::getAdminTokenLite('AdminModules').'&module_name='.htmlentities((string)$partner->module).'&redirect=config';
$return .= '<div style="width:46.5%;height:90px;border:1px solid #cccccc;background-color:white;padding-left:5px;padding-right:5px;'.(empty($return) ? 'float:left' : 'float:right').'">
<p align="center">
<a href="'.$link.'"><img src="../img/tmp/preactivation_'.htmlentities((string)$partner->module).'.png" alt="'.htmlentities((string)$partner->name).'" border="0" /></a><br />
<b><a href="'.$link.'">'.htmlentities(utf8_decode((string)$label_final)).'</a></b>
</p>
</div>';
$count++;
}
} }
} }
if (!empty($return)) if (!empty($return))
@@ -728,7 +728,12 @@ class AdminModulesControllerCore extends AdminController
} }
} }
if ($return) if ($return)
{
// If redirect parameter is present and module installed with success, we redirect on configuration module page
if (Tools::getValue('redirect') == 'config' && Tools::getValue('module_name') != '' && $return == '12' && Module::isInstalled(pSQL(Tools::getValue('module_name'))))
Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name'));
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '')); Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : ''));
}
} }
public function postProcess() public function postProcess()
@@ -736,6 +741,10 @@ class AdminModulesControllerCore extends AdminController
// Parent Post Process // Parent Post Process
parent::postProcess(); parent::postProcess();
// If redirect parameter is present and module already installed, we redirect on configuration module page
if (Tools::getValue('redirect') == 'config' && Tools::getValue('module_name') != '' && Module::isInstalled(pSQL(Tools::getValue('module_name'))))
Tools::redirectAdmin('index.php?controller=adminmodules&configure='.Tools::getValue('module_name').'&token='.Tools::getValue('token').'&module_name='.Tools::getValue('module_name'));
// Execute filter or callback methods // Execute filter or callback methods
$filterMethods = array('filterModules', 'resetFilterModules', 'filterCategory', 'unfilterCategory'); $filterMethods = array('filterModules', 'resetFilterModules', 'filterCategory', 'unfilterCategory');
$callbackMethods = array('reset', 'download', 'enable', 'delete'); $callbackMethods = array('reset', 'download', 'enable', 'delete');