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

50 lines
1.8 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Bureau.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurTbmodifierbureau extends Controleur {
private $menuvue;
private $bureau;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuTbajout('bureau');
$this->bureau = new bureau();
}
public function index() {
$id = $this->requete->getParametre("id");
$bureau = $this->bureau->getBureau($id);
$this->genererVue(array('bureau' => $bureau));
}
public function reafficher() {
$this->genererVue();
}
public function modifier() {
$id = $this->requete->getParametre("idbureau");
$oldcodeBureau = $this->requete->getParametre("oldcodeBureau");
$codeBureau = $this->requete->getParametre("codeBureau");
$libelle = $this->requete->getParametre("libelle");
$nomRespon = $this->requete->getParametre("nomRespon");
$prenomRespon = $this->requete->getParametre("prenomRespon");
$telephoneFixe = $this->requete->getParametre("telephoneFixe");
$telephonePortable = $this->requete->getParametre("telephonePortable");
$email = $this->requete->getParametre("email");
// Début contrôle doublon
$doublon = false;
$doublon = (($codeBureau!=$oldcodeBureau) && ($this->bureau->existeligne($codeBureau)));
if (!$doublon) {
$codeBureau = strtoupper($codeBureau);
$libelle = ucfirst($libelle);
$nomRespon = strtoupper($nomRespon);
$prenomRespon = ucwords($prenomRespon);
$this->bureau->modifier($id, $codeBureau, $libelle, $nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email);
}
// Fin contrôle doublon
$this->rediriger("Tblistebureau");
}
}