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

94 lines
2.4 KiB
PHP

<?php
require_once 'Framework/Controleur.php';
require_once 'Modele/Police.php';
require_once 'Modele/Typeavenant.php';
require_once 'Modele/Menuvueutilisateur.php';
class ControleurCreeravenant extends Controleur {
private $menuvue;
private $police;
private $typeavenant;
public function __construct() {
$this->menuvue = new Menuvueutilisateur();
$this->menuvue->getMenuVue("Creeravenant");
$this->police = new Police();
$this->typeavenant = new Typeavenant;
}
public function index() {
$idPolice = $_SESSION['idPolice_C'];
$this->police->getContextePoliceId($idPolice);
$police = $this->police->getPoliceId($idPolice);
$oldCodeTypeAvenant = $police['codeTypeAvenant'];
$typeavenant = $this->typeavenant->getListeSuite($oldCodeTypeAvenant);
$this->genererVue(array('police' => $police, 'typeavenant' => $typeavenant));
}
public function enregistrer()
{
$idPolice = $_SESSION['idPolice_C'];
$codeTypeAvenant = $this->requete->getParametreFormulaire("codeTypeAvenant");
$motifavenant = $this->requete->getParametreFormulaire("motifavenant");
$dateAvenant = $this->requete->getParametreDate("dateAvenant");
$_SESSION['dateAvenant_C'] = $dateAvenant;
$_SESSION['motifavenant_C'] = $motifavenant;
if($codeTypeAvenant=="RES")
{
$this->rediriger("Ficheresiliation");
}
else
if($codeTypeAvenant=="RET")
{
$this->rediriger("Ficheretrait");
}
else
if($codeTypeAvenant=="REN")
{
$dateEcheanceRen = $this->requete->getParametreDate("dateEcheanceRen");
$_SESSION['dateEcheanceRen_C'] = $dateEcheanceRen;
$this->rediriger("Ficherenouvellement");
}
else
if($codeTypeAvenant=="ADL")
{
$this->rediriger("Fichelimiteadditionnelle");
}
else
if($codeTypeAvenant=="CHC")
{
$this->rediriger("Fichechangementcollege");
}
else
{
$this->police->creeravenant($idPolice, $codeTypeAvenant, $motifavenant, $dateAvenant);
$this->police->getContexteAjaxPolice($idPolice);
if($codeTypeAvenant=="INC")
{
/*
if($_SESSION['codeTypeContrat']=="G")
{
$this->rediriger("Importassure");
}
else
{
$this->rediriger("Listeadherent");
}
*/
$this->rediriger("Fichepolice");
}
else
{
$this->rediriger("Fichepolice");
}
}
}
}