[*] MO: remove all static call of Module::display() method. Use it as a method on a Module instance.

This commit is contained in:
rMalie
2011-11-28 10:04:41 +00:00
parent 8c9ac59984
commit 8c470eaef0
9 changed files with 20 additions and 34 deletions
-25
View File
@@ -1221,31 +1221,6 @@ abstract class ModuleCore
return $result;
}
public static function displayTemplate($file, $template, $cacheId = null, $compileId = null)
{
$context = Context::getContext();
if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL)
$result = Tools::displayError('No template found for module').' '.basename($file,'.php');
else
{
$context->smarty->assign(array(
'module_dir' => __PS_BASE_URI__.'modules/'.basename($file, '.php').'/',
'module_template_dir' => ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'
));
$smarty_subtemplate = $context->smarty->createTemplate(
($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template,
$cacheId,
$compileId,
$context->smarty
);
$result = $smarty_subtemplate->fetch();
}
return $result;
}
/**
* Get realpath of a template of current module (check if template is overriden too)
*
+2 -2
View File
@@ -87,7 +87,7 @@ class BlockCategories extends Module
Configuration::updateValue('BLOCK_CATEG_NBR_COLUMN_FOOTER', $nbrColumns);
Configuration::updateValue('BLOCK_CATEG_SORT_WAY', Tools::getValue('BLOCK_CATEG_SORT_WAY'));
Configuration::updateValue('BLOCK_CATEG_SORT', Tools::getValue('BLOCK_CATEG_SORT'));
$this->_clearBlockcategoriesCache();
$output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';
}
@@ -121,7 +121,7 @@ class BlockCategories extends Module
<input type="radio" name="BLOCK_CATEG_SORT" id="sort_on" value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/>
<label class="t" for="sort_on"> <img src="../modules/'.$this->name.'/sort_number.png" alt="'.$this->l('Enabled').'" title="'.$this->l('By position').'" />'.$this->l('By position').'</label>
<input type="radio" name="BLOCK_CATEG_SORT" id="sort_off" value="1" '.(Tools::getValue('BLOCK_CATEG_SORT', Configuration::get('BLOCK_CATEG_SORT')) ? 'checked="checked" ' : '').'/>
<label class="t" for="sort_off"> <img src="../modules/'.$this->name.'/sort_alphabet.png" alt="'.$this->l('Disabled').'" title="'.$this->l('By name').'" />'.$this->l('By name').'</label> -
<label class="t" for="sort_off"> <img src="../modules/'.$this->name.'/sort_alphabet.png" alt="'.$this->l('Disabled').'" title="'.$this->l('By name').'" />'.$this->l('By name').'</label> -
<select name="BLOCK_CATEG_SORT_WAY">
<option value="0" '.(!Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Ascending').'</option>
<option value="1" '.(Tools::getValue('BLOCK_CATEG_SORT_WAY', Configuration::get('BLOCK_CATEG_SORT_WAY')) ? 'selected="selected" ' : '').'>'.$this->l('Descending').'</option>
+1 -1
View File
@@ -68,7 +68,7 @@ else
$smarty->assign('this_path', __PS_BASE_URI__.'modules/cashondelivery/');
$template = 'validation.tpl';
echo Module::displayTemplate('cashondelivery', $template);
echo $cashOnDelivery->display('cashondelivery', $template);
}
include(dirname(__FILE__).'/../../footer.php');
@@ -32,6 +32,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
require_once(dirname(__FILE__).'/FavoriteProduct.php');
require_once(dirname(__FILE__).'/favoriteproducts.php');
if (!Context::getContext()->customer->isLogged())
Tools::redirect('authentication.php?back=modules/favoriteproducts/favoriteproducts.php');
@@ -42,7 +43,8 @@ if ((int)Context::getContext()->customer->id)
{
$smarty->assign('favoriteProducts', FavoriteProduct::getFavoriteProducts((int)Context::getContext()->customer->id, (int)Context::getContext()->language->id));
echo Module::displayTemplate(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl');
$favoriteproducts = new FavoriteProducts();
echo $favoriteproducts->display(dirname(__FILE__).'/favoriteproducts.php', 'favoriteproducts-account.tpl');
}
include(dirname(__FILE__).'/../../footer.php');
+3 -1
View File
@@ -33,6 +33,7 @@ require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/LoyaltyModule.php');
include_once(dirname(__FILE__).'/LoyaltyStateModule.php');
include_once(dirname(__FILE__).'/loyalty.php');
$context = Context::getContext();
if (!$context->customer->isLogged())
@@ -159,6 +160,7 @@ $smarty->assign(array(
'minimalLoyalty' => (float)Configuration::get('PS_LOYALTY_MINIMAL'),
'categories' => $categoriesNames));
echo Module::displayTemplate(dirname(__FILE__).'/loyalty.php', 'loyalty.tpl');
$loyalty = new Loyalty();
echo $loyalty->display(dirname(__FILE__).'/loyalty.php', 'loyalty.tpl');
include(dirname(__FILE__).'/../../footer.php');
+3 -1
View File
@@ -32,6 +32,8 @@ include(dirname(__FILE__).'/../../header.php');
$smarty->assign('iso_code', Tools::strtolower(Context::getContext()->language->iso_code));
echo Module::displayTemplate(dirname(__FILE__).'/paypal', 'about.tpl');
require_once _PS_MODULE_DIR_.'paypal/paypal.php';
$paypal = new PayPal();
echo $paypal->display(dirname(__FILE__).'/paypal', 'about.tpl');
include(dirname(__FILE__).'/../../footer.php');
+1 -1
View File
@@ -1318,7 +1318,7 @@ class PayPal extends PaymentModule
public function display($file, $template, $cacheId = NULL, $compileId = NULL)
{
if (substr(_PS_VERSION_, 0, 3) != '1.3')
return parent::displayTemplate($file, $template);
return parent::display($file, $template);
global $smarty;
$previousTemplate = $smarty->currentTemplate;
@@ -31,6 +31,7 @@ require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
include_once(dirname(__FILE__).'/referralprogram.php');
$context = Context::getContext();
if (!$context->customer->isLogged())
@@ -185,7 +186,8 @@ $smarty->assign(array(
'mails_exists' => (isset($mails_exists) ? $mails_exists : array())
));
echo Module::displayTemplate(dirname(__FILE__).'/referralprogram.php', 'referralprogram-program.tpl');
$referralprogram = new ReferralProgram();
echo $referralprogram->display(dirname(__FILE__).'/referralprogram.php', 'referralprogram-program.tpl');
include(dirname(__FILE__).'/../../footer.php');
@@ -28,6 +28,8 @@
require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');
include_once(dirname(__FILE__).'/referralprogram.php');
if (!Tools::getValue('width') AND !Tools::getValue('height'))
require_once(dirname(__FILE__).'/../../header.php');
@@ -44,7 +46,8 @@ if (file_exists($xmlFile))
}
}
echo Module::displayTemplate(dirname(__FILE__).'/referralprogram', 'referralprogram-rules.tpl');
$referralprogram = new ReferralProgram();
echo $referralprogram->display(dirname(__FILE__).'/referralprogram', 'referralprogram-rules.tpl');
if (!Tools::getValue('width') AND !Tools::getValue('height'))
require_once(dirname(__FILE__).'/../../footer.php');