Import initial du projet Production
This commit is contained in:
49
Controleur/ControleurAjouterutilisateur.php
Normal file
49
Controleur/ControleurAjouterutilisateur.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require_once 'Framework/Controleur.php';
|
||||
require_once 'Modele/Profil.php';
|
||||
require_once 'Modele/Utilisateur.php';
|
||||
require_once 'Modele/Service.php';
|
||||
require_once 'Modele/Menuvueutilisateur.php';
|
||||
|
||||
class ControleurAjouterutilisateur extends Controleur {
|
||||
private $menuvue;
|
||||
private $utilisateur;
|
||||
private $profil;
|
||||
private $service;
|
||||
|
||||
public function __construct() {
|
||||
$this->menuvue = new Menuvueutilisateur();
|
||||
$this->menuvue->getMenuVue('Ajouterutilisateur');
|
||||
|
||||
$this->utilisateur = new Utilisateur();
|
||||
$this->profil = (new Profil())->getListe();
|
||||
$this->service = (new Service())->getListe();
|
||||
}
|
||||
public function index() {
|
||||
$this->genererVue(array('profil' => $this->profil, 'service' => $this->service));
|
||||
|
||||
$chemin = $this->menuvue->getChemin('Ajouterutilisateur');
|
||||
}
|
||||
|
||||
public function ajouter() {
|
||||
$codeSociete = $this->requete->getSession()->getAttribut('codeSociete');
|
||||
$codeUtilisateur = $this->requete->getParametre("codeUtilisateur");
|
||||
// Début contrôle doublon
|
||||
if (!$this->utilisateur->existeligne($codeUtilisateur)) {
|
||||
$nom = $this->requete->getParametre("nom");
|
||||
$prenoms = $this->requete->getParametre("prenoms");
|
||||
$codeService = $this->requete->getParametre("codeService");
|
||||
$telephone = $this->requete->getParametreFormulaire("telephone");
|
||||
$email = $this->requete->getParametreFormulaire("email");
|
||||
$fonction = $this->requete->getParametreFormulaire("fonction");
|
||||
$codeProfil = $this->requete->getParametre("codeProfil");
|
||||
$this->utilisateur->ajouter($codeSociete, $codeUtilisateur, $nom, $prenoms, $codeService,
|
||||
$telephone, $email, $fonction, $codeProfil);
|
||||
$this->executerAction("index");
|
||||
}
|
||||
else
|
||||
$this->genererVue(array('profil' => $this->profil, 'service' => $this->service, 'msgErreur' => 'Ce code existe déjà!',
|
||||
'chemin' => $chemin), "index");
|
||||
// Fin doublon
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user