prestation/Controleur/ControleurAjaxouvrirtypegarant.php
2025-12-01 18:54:33 +00:00

35 lines
996 B
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Gestionconfiee.php';
class ControleurAjaxouvrirtypegarant extends Controleur {
private $type;
public function __construct() {
$this->type = new Gestionconfiee();
}
public function index(){
$this->genererVueAjax();
}
public function enregistrer(){
$codeTypeGarant = strtoupper($this->requete->getParametreFormulaire("codeTypeGarant"));
$libelle = strtoupper($this->requete->getParametreFormulaire("libelle"));
if(empty($codeTypeGarant) && empty($libelle))
{
die();
}
if (!($this->type->existeTypeGarant($codeTypeGarant)))
{
$this->type->ajouterTypeGarant($codeTypeGarant,$libelle);
} else{
echo 'Erreur: Le code saisi existe déjà! Veuillez entrer un autre./Error : The code entered, already exists! Please enter another.';
die();
}
}
}