<?php // deuxième page include 'include_dao.php'; session_start(); // on precise le repertoire ou se trouve les fichiers templates et le répèrtoire ou on met les fichiers compilés (cache) $template = new Template('template', 'cache'); $template->assign_var('LOG', FALSE); $template->assign_var('LICENCE', FALSE); // on precise la variable langage $template->set_language_var($lang); page_header('Gérer mes licences', 'Gérer mes licences', 'GERERLICENCES'); page_footer(); $template->set_filenames(array('body' => 'gererlicence.html')); $adherents = new AdherentMySqlDAO(); if (isset($_SESSION['Nom'])) { $template->assign_var('LOG', TRUE); $adherentsQuery = $adherents->queryByIdDemandeur($_SESSION['idDemandeur']); if (is_null($adherentsQuery) == false) { $template->assign_var('LICENCE', TRUE); $clubs = new ClubMySqlDAO(); $clubQuery = $clubs->queryAll(); $ligue = new LigueMySqlDAO(); $ligueQuery = $ligue->queryAll(); foreach ($adherentsQuery as $key => $value) { $template->assign_block_vars('adherents', array('ID' => $value->idAdherent, 'NOM' => $value->nom, 'PRENOM' => $value->prenom, 'CLUB' => $clubQuery[$value->idCLub - 1]->nom, 'LIGUE' => $ligueQuery[$clubQuery[$value->idCLub - 1]->idLigue - 1]->libelle, 'NUMLICENCE' => $value->numLicence, 'ID' => $value->idAdherent)); } } else { $template->assign_var('MESSAGE', "Aucune licence enregistrée, veuillez vous rendre <a href='ajouterlicence.php'>ici</a> afin d'en ajouter une."); } } else {
<?php // deuxième page include 'include_dao.php'; session_start(); // on precise le repertoire où se trouve les fichiers templates et le répértoire où on met les fichiers compilés (cache) $template = new Template('template', 'cache'); // on precise la variable langage $template->set_language_var($lang); page_header('Supprimer une licence', 'Supprimer une licence', 'SUPPRIMERLICENCE'); page_footer(); $template->set_filenames(array('body' => 'supprimerlicence.html')); $submit = isset($_POST['submit']); $id = $_GET['ID']; $template->assign_var('ID', $id); if ($submit) { $adherent = new AdherentMySqlDAO(); $adherentsQuery = $adherent->delete($id); header('Location: gererlicence.php'); } $template->display('body');
page_footer(); $template->set_filenames(array('body' => 'ajouterlicence.html')); $submit = isset($_POST['submit']); if (isset($_SESSION['Nom'])) { $template->assign_var('LOG', TRUE); if ($submit) { $numLicence = $_POST['licence']; $nom = $_POST['nom']; $prenom = $_POST['prenom']; $sexe = $_POST['sexe']; $date = $_POST['ddn']; $adresse = $_POST['adresse']; $cp = $_POST['cp']; $ville = $_POST['ville']; $club = $_POST['idclub']; $licence = new AdherentMySqlDAO(); $LicenceInsert = new Adherent(); $LicenceInsert->numLicence = $numLicence; $LicenceInsert->nom = $nom; $LicenceInsert->prenom = $prenom; $LicenceInsert->sexe = $sexe; $LicenceInsert->dateNaissance = $date; $LicenceInsert->adresse = $adresse; $LicenceInsert->cp = $cp; $LicenceInsert->ville = $ville; $LicenceInsert->idCLub = $club; $LicenceInsert->idDemandeur = $_SESSION['idDemandeur']; $licence->insert($LicenceInsert); $template->assign_var('ADDSUCCES', TRUE); $template->assign_var('MESSAGE', "Licence enregistrée avec succès, cliquez <a href='gererlicence.php'>ici</a> pour accéder à la page de gestion des licences."); }
$licences = new AdherentMySqlDAO(); $LicenceQuery = $licences->load($id); $LicenceInsert = new Adherent(); $LicenceInsert->idAdherent = $LicenceQuery->idAdherent; $LicenceInsert->numLicence = $numLicence; $LicenceInsert->nom = $nom; $LicenceInsert->prenom = $prenom; $LicenceInsert->sexe = $sexe; $LicenceInsert->dateNaissance = $date; $LicenceInsert->adresse = $adresse; $LicenceInsert->cp = $cp; $LicenceInsert->ville = $ville; $LicenceInsert->idCLub = $club; $LicenceInsert->idDemandeur = $_SESSION['idDemandeur']; $licences->update($LicenceInsert); $template->assign_var('MESSAGE', "Licence mise à jour !"); $template->assign_var('UPDATESUCCES', TRUE); } $adherents = new AdherentMySqlDAO(); $adherentsQuery = $adherents->load($id); $nom = $adherentsQuery->nom; $prenom = $adherentsQuery->prenom; $sexe = $adherentsQuery->sexe; $dateNaissance = $adherentsQuery->dateNaissance; $adresse = $adherentsQuery->adresse; $cp = $adherentsQuery->cp; $ville = $adherentsQuery->ville; $club = $adherentsQuery->idCLub; $numLicence = $adherentsQuery->numLicence; $template->assign_vars(array('NOM' => $nom, 'PRENOM' => $prenom, 'SEXE' => $sexe, 'DATE' => $dateNaissance, 'ADRESSE' => $adresse, 'CP' => $cp, 'VILLE' => $ville, 'NUMLICENCE' => $numLicence)); $template->display('body');