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

43 lines
1.3 KiB
PHP
Executable File

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Pays.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurTbmodifierpays extends Controleur {
private $menuvue;
private $pays;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuTbajout('pays');
$this->pays = new pays();
}
public function index() {
$id = $this->requete->getParametre("id");
$pays = $this->pays->getPays($id);
$this->genererVue(array('pays' => $pays));
}
public function reafficher() {
$this->genererVue();
}
public function modifier() {
$id = $this->requete->getParametre("idpays");
$oldcodePays = $this->requete->getParametre("oldcodePays");
$codePays = $this->requete->getParametre("codePays");
$libelle = $this->requete->getParametre("libelle");
// Début contrôle doublon
$doublon = false;
$doublon = (($codePays!=$oldcodePays) && ($this->pays->existeligne($codePays)));
if (!$doublon) {
$codePays = strtoupper($codePays);
$libelle = ucfirst($libelle);
$this->pays->modifier($id, $codePays, $libelle);
}
$this->rediriger("Tblistepays");
// Fin contrôle doublon
}
}