prestation/Controleur/ControleurTbmodifieraffection.php
2025-12-05 10:42:46 +00:00

47 lines
1.6 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Typeaffection.php';
require_once 'Modele/Affection.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurTbmodifieraffection extends Controleur {
private $menuvue;
private $affection;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuTbajout('affection');
$this->affection = new Affection();
$this->typeaffection = new Typeaffection();
}
public function index() {
$id = $this->requete->getParametre("id");
$affection = $this->affection->getaffection($id);
$typeaffection = $this->typeaffection->getListe();
$this->genererVue(array('affection' => $affection, 'typeaffection' => $typeaffection));
}
public function reafficher() {
$this->genererVue();
}
public function modifier() {
$id = $this->requete->getParametre("idaffection");
$oldcodeAffection = $this->requete->getParametre("oldcodeAffection");
$codeAffection = $this->requete->getParametre("codeAffection");
$libelle = $this->requete->getParametre("libelle");
$codeType = $this->requete->getParametre("codeType");
// Début contrôle doublon
$doublon = false;
$doublon = (($codeAffection!=$oldcodeAffection) && ($this->affection->existeligne($codeAffection)));
if (!$doublon) {
$codeAffection = strtoupper($codeAffection);
$libelle = ucfirst($libelle);
$this->affection->modifier($id, $codeAffection, $libelle, $codeType);
}
$this->rediriger("Tblisteaffection");
// Fin contrôle doublon
}
}