36 lines
1.1 KiB
PHP
Executable File
36 lines
1.1 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Typeapporteur.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
|
|
class ControleurTbajoutertypeapporteur extends Controleur {
|
|
private $menuvue;
|
|
private $typeapporteur;
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuTbajout('typeapporteur');
|
|
|
|
$this->typeapporteur = new typeapporteur();
|
|
}
|
|
public function index() {
|
|
$this->genererVue();
|
|
}
|
|
|
|
public function ajouter() {
|
|
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
|
|
$codeType = $this->requete->getParametre("codeType");
|
|
// Début contrôle doublon
|
|
if (!$this->typeapporteur->existeligne($codeType)) {
|
|
$libelle = $this->requete->getParametre("libelle");
|
|
|
|
$codeType = strtoupper($codeType);
|
|
$libelle = ucfirst($libelle);
|
|
|
|
$this->typeapporteur->ajouter($codeSociete, $codeType, $libelle);
|
|
$this->executerAction("index");
|
|
}
|
|
else
|
|
$this->genererVue(array('msgErreur' => 'Ce code existe déjà!'), "index");
|
|
// Fin doublon
|
|
}
|
|
} |