prestation/Controleur/ControleurModifierprofil.php
2025-12-01 18:54:33 +00:00

45 lines
1.5 KiB
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/ProfilSysteme.php';
require_once 'Modele/Profil.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurModifierprofil extends Controleur {
private $menuvue;
private $profil;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue('Modifierprofil');
$this->profil = new Profil();
$this->profilsysteme = new ProfilSysteme();
}
public function index() {
$id = $this->requete->getParametre("id");
$profil = $this->profil->getProfil($id);
$profilsysteme = $this->profilsysteme->getListe();
$this->genererVue(array('profil' => $profil, 'profilsysteme' => $profilsysteme));
}
public function reafficher() {
$this->genererVue();
}
public function modifier() {
$id = $this->requete->getParametre("idprofil");
$oldcodeType = $this->requete->getParametre("oldcodeProfil");
$codeProfil = $this->requete->getParametre("codeProfil");
$libelle = $this->requete->getParametre("libelle");
$codeProfilSysteme= $this->requete->getParametre("codeProfilSysteme");
// Début contrôle doublon
$doublon = false;
$doublon = (($codeProfil!=$oldcodeType) && ($this->profil->existeligne($codeProfil)));
if (!$doublon) {
$this->profil->modifier($id, $codeProfil, $libelle, $codeProfilSysteme);
}
$this->rediriger("Listeprofil");
// Fin contrôle doublon
}
}