name = 'sendmail'; $this->tab = 'front_office_features'; $this->version = '0.1'; $this->author = 'Antadis'; $this->need_instance = 0; $this->module_key = ""; parent::__construct($name, $context); $this->displayName = $this->l('Send Mail'); $this->description = $this->l('Send Mail with personnalized SMTP.'); $this->confirmUninstall = $this->l('Are you sure you want to delete ?'); $this->currentIndex = 'index.php?controller=AdminModules'; $this->base_config_url = $this->currentIndex .'&configure=' . $this->name . '&token=' . Tools::getValue('token'); } /** * * @return boolean */ public function install() { if (!parent::install() || !self::createTab(self::searchCreateTab($this->l('Antadis'), $this->name), $this->name, $this->l('Mail Configuration'), 'AdminSendMail')){ $this->uninstall(); return false; } return true; } /** * * @return boolean */ static function createTab($id_parent, $module, $name, $class_name) { $Tab = new Tab(); $Tab->module = $module; foreach(Language::getLanguages(true) as $languages) { $Tab->name[$languages["id_lang"]] = $name; } $Tab->id_parent = $id_parent; $Tab->class_name = $class_name; $r = $Tab->save(); if($r === false) return false; return $Tab->id; } static function searchCreateTab($tab_name, $name) { $res = Db::getInstance()->getValue(' SELECT t.`id_tab` FROM `'._DB_PREFIX_.'tab` t LEFT JOIN `'._DB_PREFIX_.'tab_lang` tl ON (t.`id_tab` = tl.`id_tab` AND tl.`id_lang` = '.(int)Context::getContext()->language->id.') WHERE tl.`name` = "'.pSQL($tab_name).'"'); if(empty($res)) $res = self::createTab(0, $name, $tab_name, 'AdminSendMail'); return $res; } /** * * @return boolean */ public function uninstall() { if(!parent::uninstall()){ return false; } return true; } /** * * @param type $params * @return type */ }