* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_CAN_LOAD_FILES_')) exit; class BlockPaymentLogo extends Module { public function __construct() { $this->name = 'blockpaymentlogo'; $this->tab = 'front_office_features'; $this->version = 0.2; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Block payment logo'); $this->description = $this->l('Adds a block to display all payment logos.'); } public function install() { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', 0); if (!parent::install()) return false; if (!$this->registerHook('leftColumn')) return false; if (!$this->registerHook('header')) return false; return true; } public function uninstall() { Configuration::deleteByName('PS_PAYMENT_LOGO_CMS_ID'); return parent::uninstall(); } public function getContent() { global $cookie; $html = '

'.$this->l('Payment logo').'

'; if (Tools::isSubmit('submitConfiguration')) if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) { Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int)(Tools::getValue('id_cms'))); $html .= $this->displayConfirmation($this->l('Settings are updated')); } $cmss = CMS::listCms((int)($cookie->id_lang)); if (!sizeof($cmss)) $html .= $this->displayError($this->l('No CMS page is available')); else { $html .= '
'.$this->l('Configure').'

'; } return $html; } /** * Returns module content * * @param array $params Parameters * @return string Content */ public function hookLeftColumn($params) { if (Configuration::get('PS_CATALOG_MODE')) return ; global $smarty, $cookie; if (!Configuration::get('PS_PAYMENT_LOGO_CMS_ID')) return; $cms = new CMS((int)(Configuration::get('PS_PAYMENT_LOGO_CMS_ID')), (int)($cookie->id_lang)); if (!Validate::isLoadedObject($cms)) return; $smarty->assign('cms_payement_logo', $cms); return $this->display(__FILE__, 'blockpaymentlogo.tpl'); } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } public function hookFooter($params) { return $this->hookLeftColumn($params); } public function hookHeader($params) { if (Configuration::get('PS_CATALOG_MODE')) return ; Tools::addCSS(($this->_path).'blockpaymentlogo.css', 'all'); } }