Admin Simulator

This commit is contained in:
Michael RICOIS 2017-07-31 12:10:21 +02:00
parent 853529b572
commit 81212ff42f
3 changed files with 210 additions and 0 deletions

View File

@ -3,6 +3,115 @@ class AdminAntadisSimulatorController extends ModuleAdminController
{
public function __construct()
{
// Table simulator - helperList
// id, name, code, theme
// Un simulateur = dossier de stockage
// Un theme de simulateur = un sous dossier
$this->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()
{
/**
* Si formulaire soumis on vérifie que le dossier n'existe pas déjà
*
*/
}
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' => 'name',
'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();
}
}

View File

@ -0,0 +1,14 @@
<?php
class AdminAntadisSimulatorDetailController extends ModuleAdminController
{
public function __construct()
{
// Call of the parent constructor method
parent::__construct();
}
public function renderList()
{
}
}

View File

@ -0,0 +1,87 @@
<?php
class AdminAntadisSimulatorThemeController extends ModuleAdminController
{
public function __construct()
{
// Table simulator - helperList
// id, name, code, theme
// Un simulateur = dossier de stockage
// Un theme de simulateur = un sous dossier
$this->table = 'simulator_theme';
$this->className = 'SimulatorTheme';
$this->identifier = 'id_simulator_theme';
$this->lang = false;
// Set fields list
$this->fields_list = array(
'name' => array(
'title' => $this->l('Nom'),
),
);
// Enable bootstrap
$this->bootstrap = true;
// Call of the parent constructor method
parent::__construct();
}
public function displayConfigLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('helpers/list/list_action_details.tpl');
if (!array_key_exists('Config', self::$cache_lang)) {
self::$cache_lang['Config'] = $this->l('Configuration', 'Helper');
}
$id_simulator = Tools::getValue('id_simulator');
$link = $this->context->link->getAdminLink('AdminAntadisSimulatorDetail', true);
$tpl->assign(array(
'href' => $link.'&id_simulator='.$id_simulator.'&id_simulator_theme='.$id,
'action' => self::$cache_lang['Config'],
'id' => $id
));
return $tpl->fetch();
}
public function renderList()
{
$this->addRowAction('config');
return parent::renderList();
}
public function renderForm()
{
$this->table = 'simulator_theme';
$this->identifier = 'id_simulator_theme';
$this->show_form_cancel_button = true;
$this->fields_form = array(
'legend' => array('title' => $this->l('Add / Edit')),
'input' => array(
array(
'type' => 'hidden',
'name' => 'name',
'required' => true,
),
array(
'type' => 'text',
'label' => $this->l('Name'),
'desc' => $this->l("Nom du theme."),
'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();
}
}