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

44 lines
1.6 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Bureau.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurTbajouterbureau extends Controleur {
private $menuvue;
private $bureau;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuTbajout('bureau');
$this->bureau = new bureau();
}
public function index() {
$this->genererVue();
}
public function ajouter() {
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
$codeBureau = $this->requete->getParametre("codeBureau");
// Début contrôle doublon
if (!$this->bureau->existeligne($codeBureau)) {
$libelle = $this->requete->getParametre("libelle");
$nomRespon = $this->requete->getParametreFormulaire("nomRespon");
$prenomRespon = $this->requete->getParametreFormulaire("prenomRespon");
$telephoneFixe = $this->requete->getParametreFormulaire("telephoneFixe");
$telephonePortable = $this->requete->getParametreFormulaire("telephonePortable");
$email = $this->requete->getParametreFormulaire("email");
$codeBureau = strtoupper($codeBureau);
$libelle = ucfirst($libelle);
$nomRespon = strtoupper($nomRespon);
$prenomRespon = ucwords($prenomRespon);
$this->bureau->ajouter($codeSociete, $codeBureau, $libelle,
$nomRespon, $prenomRespon, $telephoneFixe, $telephonePortable, $email);
$this->executerAction("index");
}
else
$this->genererVue(array('msgErreur' => 'Ce code existe déjà!'), "index");
// Fin contrôle doublon
}
}