36 lines
1.3 KiB
PHP
Executable File
36 lines
1.3 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/ProfilSysteme.php';
|
|
require_once 'Modele/Profil.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
|
|
class ControleurAjouterprofil extends Controleur {
|
|
private $menuvue;
|
|
private $profil;
|
|
private $profilsysteme;
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuVue('Ajouterprofil');
|
|
|
|
$this->profil = new Profil();
|
|
$this->profilsysteme = (new ProfilSysteme())->getListe();
|
|
}
|
|
public function index() {
|
|
$this->genererVue(array('profilsysteme' => $this->profilsysteme));
|
|
}
|
|
|
|
public function ajouter() {
|
|
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
|
|
$codeProfil = $this->requete->getParametre("codeProfil");
|
|
// Début contrôle doublon
|
|
if (!$this->profil->existeligne($codeProfil)) {
|
|
$libelle = $this->requete->getParametre("libelle");
|
|
$codeProfilSysteme = $this->requete->getParametre("codeProfilSysteme");
|
|
$this->profil->ajouter($codeSociete, $codeProfil, $libelle, $codeProfilSysteme);
|
|
$this->executerAction("index");
|
|
}
|
|
else
|
|
$this->genererVue(array('profilsysteme' => $this->profilsysteme, 'msgErreur' => 'Ce code existe déjà!'), "index");
|
|
// Fin doublon
|
|
}
|
|
} |