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

63 lines
1.5 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Collegetype.php';
class ControleurAjaxnouveaucollegetype extends Controleur {
private $collegetype;
public function __construct() {
$this->collegetype = new collegetype();
}
public function index(){
$this->genererVueAjax();
}
public function ajouter(){
$codeCollegeType = strtoupper($this->requete->getParametreFormulaire("codeCollegeType"));
if (est_anglophone())
{
$libelle = strtoupper($this->requete->getParametreFormulaire("libelleEng"));
} else{
$libelle = strtoupper($this->requete->getParametreFormulaire("libelle"));
}
if(empty($codeCollegeType) && empty($libelle))
{
die();
}
if (!($this->collegetype->existeLigne($codeCollegeType)))
{
$this->collegetype->ajouter($codeCollegeType,$libelle);
} else{
echo 'Erreur: Le code saisi existe déjà! Veuillez saisir un autre./Error : The code entered, already exists! Please enter another.';
die();
}
}
public function enregistrermodif()
{
$idTable = $this->requete->getParametreFormulaire("idTable");
$libelle = strtoupper($this->requete->getParametreFormulaire("libelle"));
$this->collegetype->enregistrermodif($idTable, $libelle);
}
public function supprimer()
{
$idTable = $this->requete->getParametreFormulaire("idTable");
$this->collegetype->supprimer($idTable);
}
}