lang = TRUE; parent::__construct(); $this->imagelist = array( 'bmobile' => array($this->l('Bannière Mobile'), '500x178'), //'bsite' => array($this->l('Bannière Site'), '800x300'), ); } public function postProcess() { global $currentIndex, $cookie; if(Tools::isSubmit('submitBanners')) { foreach(Language::getLanguages(false) as $language) { Configuration::updateValue('ANT_PROMO_BANNER_2',Tools::getValue('enabled_fr', 0)); Configuration::updateValue('ANT_PROMO_BANNER_3',Tools::getValue('enabled_es', 0)); Configuration::updateValue('ANT_PROMO_BANNERURL_2',Tools::getValue('url_2', '')); Configuration::updateValue('ANT_PROMO_BANNERURL_3',Tools::getValue('url_3', '')); foreach(array_keys($this->imagelist) as $img) { if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { $random = Tools::passwdGen(7); if (glob(_PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_*_'.$language['id_lang'].'.jpg')) { foreach (glob(_PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_*_'.$language['id_lang'].'.jpg') as $filename) { unlink($filename); } } if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/ant_promobanner/img/img_'.$img.'_'.$random.'_'.$language['id_lang'].'.jpg')) { HelperFormBootstrap::displayErrors($this->l('An error occured during the image upload.')); } Configuration::updateValue('ANT_PROMO_BANNERNAME_'.$language['id_lang'], $random); } } } HelperFormBootstrap::displaySuccess('Mise à jour réussie'); } } public function display() { global $cookie, $currentIndex; $languages = Language::getLanguages(false); $images = array(); foreach(array_keys($this->imagelist) as $img) { $images[] = 'img_'.$img; } $divLangName = 'img_bmobile¤url'; $helper = new HelperFormBootstrap(); $helper->_select2 = true; $helper->_inputSwitch = true; $html = $helper->renderStyle(); $html .= '