1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| <?php
if (!defined('_PS_VERSION_')) exit();
class moulinette extends Module
{
public function __construct()//construction du module - Infos qui s affiche ds l onglet Modules de l admin
{
$this->name = 'moulinette';
$this->tab = 'other';//catégorie du module
$this->version = 1.0;
$this->author = 'Thor Production';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('The Moulinette');
$this->description = $this->l('Update price and quantity from software <b>LGPI</b>.');//'Met à jour les prix et les stocks extrait du logiciel <b>LGPI</b>.'
$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');//Message de confiramtion de désinstalation du module
}
public function install()//installation du module
{
if(!parent::install()
|| !$this->installModuleTab('AdminMoulinette', array(1=>'The Moulinette', 2=>'The Moulinette'), 1)) return false;
return true;
}
public function uninstall()//désinstallation du module
{
if(!parent::uninstall()
|| !$this->uninstallModuleTab('AdminMoulinette')) return false;
return true;
}
private function installModuleTab($tabClass, $tabName, $idTabParent)
{
$tab = new Tab();
$tab->name = $tabName;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = $idTabParent;
if(!$tab->save()) return false;
return true;
}
private function uninstallModuleTab($tabClass)
{
$idTab = Tab::getIdFromClassName($tabClass);
if($idTab != 0)
{
$tab = new Tab($idTab);
$tab->delete();
return true;
}
return false;
}
}
?> |
Partager