table = 'simulator'; $this->className = 'Simulator'; $this->identifier = 'id_simulator'; $this->lang = false; // Set fields list $this->fields_list = array( 'code' => array( 'title' => $this->l('Code'), ), 'name' => array( 'title' => $this->l('Nom'), ), ); // Enable bootstrap $this->bootstrap = true; // Call of the parent constructor method parent::__construct(); } public function init() { parent::init(); } public function postProcess() { $path = _PS_ROOT_DIR_.'/themes/simulation'; if (Tools::isSubmit('submitAddsimulator')) { $name = Tools::getValue('name'); $isCreated = mkdir($path.'/'.$name); if (!$isCreated) { $this->errors[] = Tools::displayError("Can't create directory"); return; } } } public function initContent() { parent::initContent(); } public function displayThemesLink($token = null, $id, $name = null) { $tpl = $this->createTemplate('helpers/list/list_action_details.tpl'); if (!array_key_exists('Themes', self::$cache_lang)) { self::$cache_lang['Themes'] = $this->l('Themes', 'Helper'); } $link = $this->context->link->getAdminLink('AdminAntadisSimulatorTheme', true); $tpl->assign(array( 'href' => $link.'&id_simulator='.$id, 'action' => self::$cache_lang['Themes'], 'id' => $id )); return $tpl->fetch(); } public function renderList() { $this->addRowAction('themes'); return parent::renderList(); } public function renderView() { // Détail du simulator // Récupération type // Affichage du détail des faces en fonction du type } public function renderForm() { $this->table = 'simulator'; $this->identifier = 'id_simulator'; $this->show_form_cancel_button = true; $this->fields_form = array( 'legend' => array('title' => $this->l('Add / Edit')), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Code'), 'desc' => $this->l("Code du simulateur - utiliser pour le nom du dossier"), 'name' => 'code', 'empty_message' => $this->l('Le champs code ne peut pas être vide.'), 'required' => true, ), array( 'type' => 'text', 'label' => $this->l('Name'), 'desc' => $this->l("Nom du simulateur."), 'name' => 'name', 'empty_message' => $this->l('Le champs nom ne peut pas être vide.'), 'required' => true, ), ), 'submit' => array('title' => $this->l('Save')) ); return parent::renderForm(); } }