<script> changerTitre("Voter pour une citation"); </script>
<h1>Voter pour une citation</h1>
<?php 
$pdo = new Mypdo();
$citationManager = new CitationManager($pdo);
$personneManager = new PersonneManager($pdo);
$voteManager = new VoteManager($pdo);
if (!isConnected() || !$personneManager->isEtudiant(getPersonneConnectee()->getPerNum())) {
    throw new ExceptionPerso("Vous n'avez pas les droits pour afficher cette page. Seul un etudiant peut ajouter une citation !", ExceptionPerso::ERR_DROITS);
}
if (empty($_GET['id'])) {
    throw new ExceptionPerso("Merci de ne pas modifier l'URL de la page", ExceptionPerso::ERR_URL);
} else {
    $citation = $citationManager->getCitation($_GET['id']);
    if (empty($_POST['vot_valeur'])) {
        $detailsProf = $personneManager->getPersonne($citation->getCitationPerNum());
        $moyenne = $voteManager->getMoyenneVote($citation->getCitationNum());
        include "include/pages/form/voterCitation.form.inc.php";
    } else {
        if ($voteManager->isPerNumDejaVote(getPersonneConnectee()->getPerNum(), $citation->getCitationNum())) {
            throw new ExceptionPerso("Vous avez déjà voté pour cette citation !", ExceptionPerso::ERR_VOTE);
        }
        $vote = new Vote(array('cit_num' => $citation->getCitationNum(), 'per_num' => getPersonneConnectee()->getPerNum(), 'vot_valeur' => $_POST['vot_valeur'] === "zero" ? 0 : $_POST["vot_valeur"]));
        $retour = $voteManager->add($vote);
        if ($retour != 0) {
            afficherMessageSucces("Votre vote a été pris en compte !");
            redirection(1, LISTER_CITATIONS);
        } else {
            afficherMessageErreur("Votre vote n'a pas été pris en compte, il se peut que vous ayiez déjà voté !");
            redirection(5, LISTER_CITATIONS);
        }
 <h1>Modifier une personne enregistrée</h1> <?php 
if (empty($_GET['id'])) {
    throw new ExceptionPerso("Merci de ne pas modifier l'url !", ExceptionPerso::ERR_URL);
} else {
    $modifFinie = false;
    $pdo = new Mypdo();
    $personneManager = new PersonneManager($pdo);
    $salarieManager = new SalarieManager($pdo);
    $etudiantManager = new EtudiantManager($pdo);
    $per_num = $_GET['id'];
    $pwdChanged = false;
    if (!is_numeric($per_num)) {
        quitterModifierPersonne();
        throw new ExceptionPerso("Vous ne pouvez pas modifier l'URL !", ExceptionPerso::ERR_PEBCAK);
    }
    $personne = $personneManager->getPersonne($per_num);
    if (empty($personne)) {
        //personne vide, le numero n'existe pas
        quitterModifierPersonne();
        throw new ExceptionPerso("Le numero saisi ne correspond à aucune personne.", ExceptionPerso::ERR_PERSONNE);
    }
    if (empty($_POST["per_prenom"]) && empty($_POST['dep_num']) && empty($_POST['sal_telprof'])) {
        include "include/pages/form/modifPersonne.form.inc.php";
    } else {
        if (!empty($_POST['per_nom'])) {
            // créations variable sessions pour enregistrement temporaire.
            include "include/pages/modifierPersonne.control.inc.php";
        }
        if (!$personneManager->isConnexionAutorisee($personne->getPerLogin(), $_SESSION['verif_pwd'])) {
            quitterModifierPersonne();
            throw new ExceptionPerso("Mot de passe incorrect, modification de la personne impossible !", ExceptionPerso::ERR_PERSONNE);
Exemplo n.º 3
0
    echo 'Actuellement ' . $manager->getNbrePersonne()->nbrePersonne . ' &eacuteleves sont enregistr&eacutes';
}
if ($manager->getNbrePersonne()->nbrePersonne != 0) {
    ?>

	<br/><br/>
	<table align="center">
		<tr>
			<th>Num&eacutero</th>
			<th>Nom</th>
			<th>Pr&eacutenom</th>
			<th>E-mail</th>
		</tr>

<?php 
    $listePersonne = $manager->getPersonne();
    foreach ($listePersonne as $personne) {
        ?>

	<tr>
		<?php 
        echo '<td><a href="?page=8&num=' . $personne->getPer_num() . '" ><b>' . $personne->getPer_num() . '</b><a/></td>';
        ?>
		<td><?php 
        echo $personne->getPer_nom();
        ?>
</td>
		<td><?php 
        echo $personne->getPer_prenom();
        ?>
</td>