* @copyright 2008-2015 Mediacom87 * @license define in the module * @version 1.7.0 */ class blockzopim extends Module { /** * __construct function. * * @access public * @return void */ public function __construct() { $this->name = 'blockzopim'; $this->tab = version_compare(_PS_VERSION_, '1.4.0.0', '>=') ? 'advertising_marketing' : 'Mediacom87'; $this->version = '1.7.0'; $this->need_instance = 0; $this->author = 'Mediacom87'; parent::__construct(); $this->displayName = $this->l('Block Zopim'); $this->description = $this->l('Integrate your Zopim script on your site.'); $this->affiliateurl = 'http://bit.ly/zopimaff'; if (version_compare(_PS_VERSION_, '1.6.0.0', '>=')) { $this->bootstrap = true; } if (version_compare(_PS_VERSION_, '1.5.0.0', '>=')) { $this->moduleList(); } } /** * install function. * * @access public * @return void */ function install() { $this->addAsTrusted(); if (!parent::install() || !$this->registerHook('footer') || !Configuration::updateValue('ZOPIM', '') || !Configuration::updateValue('MED_MODULES_LIST', true) || !Configuration::updateValue('MED_MODULE_TIME', 0)) return false; return true; } /** * uninstall function. * * @access public * @return void */ function uninstall() { if (!Configuration::deleteByName('ZOPIM') || !parent::uninstall() || !Configuration::deleteByName('MED_MODULE_TIME')) return false; return true; } /** * getContent function. * * @access public * @param string $tab (default: 'AdminModules') * @return void */ public function getContent($tab = 'AdminModules') { $output = ''; if (Tools::isSubmit('submitblockzopim')) { if (Configuration::updateValue('ZOPIM', Tools::getValue('zopimscript'))) { $output .= $this->displayConfirmation($this->l('Settings updated')); } } elseif (Tools::isSubmit('saveModule')) { if (Configuration::get('MED_MODULES_LIST') != Tools::getValue('MED_MODULES_LIST')) { if (is_file(_PS_ROOT_DIR_.self::CACHE_FILE_MUST_HAVE_MODULES_LIST)) { Tools::deleteFile(_PS_ROOT_DIR_.self::CACHE_FILE_MUST_HAVE_MODULES_LIST); Configuration::deleteByName('MED_MODULE_TIME'); } } if (Configuration::updateValue('MED_MODULES_LIST', Tools::getValue('MED_MODULES_LIST'))) { $output .= $this->displayConfirmation($this->l('Settings updated')); } } $output .= '
'.$this->l('If you want to customize the Chat window directly in the PrestaShop Backoffice and adapt its design by shop when you use the multi shop mode.').'
'.$this->l('Discover our enhanced version of this module.').'
'; return ' '.$this->panelHeading($this->l('Settings')).' '.$this->displayInfoMessage($message).' '.$this->panelEnding().' '.$this->panelHeading($this->l('Informations'), 'fa-info-circle').''.$this->l('You can also support our agency by clicking the advertising below').'.
'.$this->displayGoogleAds('5753334670').'
'.$this->panelEnding().' '.$this->displayListModules(); } /** * hookFooter function. * * @access public * @param mixed $params * @return void */ function hookFooter($params) { global $smarty; $zopim = Configuration::get('ZOPIM'); if ($zopim) { $smarty->assign('zopim', $zopim); return $this->display(__FILE__, 'blockzopim.tpl'); } } /** * displayInfoMessage function. * * @access private * @param mixed $message * @return void */ private function displayInfoMessage($message) { return ''; } /** * displayGoogleAds function. * * @access private * @param mixed $slot * @return void */ private function displayGoogleAds($slot) { return ' '; } /** * panelHeading function. * * @access private * @param mixed $title * @param string $icon (default: 'fa-cog') * @return void */ private function panelHeading($title, $icon = 'fa-cog') { if (version_compare(_PS_VERSION_, '1.6.0.0', '<')) { return ''; } } /** * submitButton function. * * @access private * @param string $name (default: 'save') * @return void */ private function submitButton($name = 'save') { if (version_compare(_PS_VERSION_, '1.6.0.0', '<')) { return ''; } else { return ''; } } /** * isoCode function. * * @access private * @param bool $domain (default: false) * @return void */ private function isoCode($domain = false) { if (version_compare(_PS_VERSION_, '1.5.0.0', '<')) { global $cookie; $language = new Language($cookie->id_lang); $iso = $language->iso_code; } else { $iso = $this->context->language->iso_code; } if ($iso == 'fr') { return 'fr'; } else if ($domain) { return 'com'; } else { return 'en'; } } /** * radioButton function. * * @access private * @param mixed $sauv * @param mixed $ok * @param mixed $ko * @return void */ private function radioButton($sauv, $ok, $ko) { $result = Configuration::get($sauv); if (!isset($result)) { $result = 0; } if (version_compare(_PS_VERSION_, '1.6.0.0', '<')) { return ' '; } else { return ' '; } } }