Initial commit for newdesigngestionnaire project
This commit is contained in:
51
Controleur/ControleurTbmodifieraffection.php
Executable file
51
Controleur/ControleurTbmodifieraffection.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?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();
|
||||
|
||||
$chemin = $this->menuvue->getChemin('affection');
|
||||
|
||||
$this->genererVue(array('affection' => $affection, 'typeaffection' => $typeaffection, 'chemin' => $chemin));
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user