<h1>Ajouter une citation</h1>
  <div class="divCentre" id="ajout">
    <form action="index.php?page=52" method="post" name="ajoutCit">
      <div class="texteFormulaire">
        <p>Enseignant :</p>
        <p>Date citation :</p>
        <p>Citation : </p>
      </div>

      <div class="champsFormulaire">
        <!-- liste deroulante de salaries -->
        <select class="zoneTexte" name="listerEnseignants"><?php 
    $listePersonnes = $managerP->getList();
    foreach ($listePersonnes as $personne) {
        echo "\n";
        if (!$managerE->isEtudiant($personne->getNumPers())) {
            ?>
              <option value="<?php 
            echo $personne->getNumPers();
            ?>
"><?php 
            echo $personne->getNomPers();
            ?>
</option><?php 
        }
    }
    ?>
        </select>
        <!-- saisie de la date à laquelle la citation a été exprimée -->
        <input id="minAndMax" class="zoneTexte" name="dateCit" size="10" type="text" pattern="(0[1-9]|1[0-9]|2[0-9]|3[01])/(0[1-9]|1[012])/[0-9]{4}" required><br/><br/>
        <textarea class="zoneTexte" name="citation"></textarea>
          <p>Année :</p>
          <p>Département :</p>
        </div>

        <div class="champsFormulaire">
          <!-- choix de la division -->
          <select class="zoneTexte" name="listerAnnees"><?php 
        foreach ($listeDivisions as $division) {
            echo "\n";
            ?>
              <option value="<?php 
            echo $division->getDivNum();
            ?>
"
              <?php 
            if ($managerE->isEtudiant($_SESSION['numPers'])) {
                $etudiant = $managerE->getEtudiant($_SESSION['numPers']);
                if ($division->getDivNum() == $etudiant->div_num) {
                    echo " selected ";
                    //on selectionne si correspond à la division actuelle
                }
            }
            ?>
              ><?php 
            echo $division->getDivNom();
            ?>
</option><?php 
        }
        echo "\n";
        ?>
          </select>
Example #3
0
<h1> Noter une citation </h1>

<?php 
$db = new Mypdo();
$managerP = new PersonneManager($db);
$managerE = new EtudiantManager($db);
$managerC = new CitationManager($db);
$managerV = new VoteManager($db);
$_SESSION['numCitation'] = $_GET['citation'];
if (!$managerE->isEtudiant($_SESSION['id'])) {
    ?>
  <img src="image/erreur.png" alt="Erreur" /> Seul les <b>étudiants</b> ont le droit de noter une citation <br/><br/>
  <a href="index.php?page=2" class="bouton">Retour aux citations</a><?php 
} else {
    if ($managerV->aVote($_SESSION['numCitation'], $_SESSION['id'])) {
        ?>
    <img src="image/erreur.png" alt="Erreur" /> Vous avez déjà voté pour cette citation <br/><br/>
    <a href="index.php?page=2" class="bouton">Retour aux citations</a><?php 
    } else {
        if ($managerC->isCitationValide($_GET['citation'])) {
            ?>
      <!-- libellé de la citation-->
      <p>Evaluez la citation : <b>"<?php 
            echo $managerC->getLibelleCitation($_GET['citation'])->cit_libelle;
            ?>
"</b></p>
      <div class="divCentre" id="ajout">
        <form action="index.php?page=85" method="post" name="voteCitation">
          <div class="texteFormulaire">
            <p>Note :</p>
          </div>
				<td> <?php 
        echo $personne->getPrenomPers();
        ?>
 </td>
			</tr> <?php 
    }
    ?>
	</table>

	<p> Cliquez sur le numéro d'une personne pour afficher plus de détails</p>

	<?php 
} else {
    $numPersonne = $_GET['personne'];
    //recuperer la liste des etudiants
    if ($managerE->isEtudiant($numPersonne)) {
        $etudiant = $managerE->getEtudiant($numPersonne);
        ?>

			<h1>Détail sur l'étudiant <?php 
        echo $etudiant->per_nom;
        ?>
 </h1>
			<table class="tableCli">
				<tr class="hautTableau">
					<td><b>Prénom        	</b></td>
					<td><b>Mail          	</b></td>
					<td><b>Tel          	</b></td>
					<td><b>Département  	</b></td>
					<td><b>Ville        	</b></td>
				</tr>
<?php 
$db = new Mypdo();
$managerP = new PersonneManager($db);
$managerC = new CitationManager($db);
$managerE = new EtudiantManager($db);
$managerS = new SalarieManager($db);
$managerV = new VoteManager($db);
$supprimer = TRUE;
//verification que l'id personne existe (au cas d'une URL tapée)
if ($managerP->isPersonne($_GET['personne'])) {
    $personne = $managerP->getPersonneById($_GET['personne']);
    $prenom = $personne->per_prenom;
    $nom = $personne->per_nom;
    //on recupere le nom et le prenom de la personne pour affchage de confirmation
    //cas etudiant
    if ($managerE->isEtudiant($_GET['personne'])) {
        $listeCit = $managerC->getCitationIdEtudiant($_GET['personne']);
        foreach ($listeCit as $citation) {
            supprimerVoteEtCitation($citation->getNumCit());
            //suppression des citations et des votes associés à l'étudiant
        }
        //suppression des votes restants (pour citations entrées par un autre etudiant)
        $managerV->supprimerVoteIdPersonne($_GET['personne']);
        //suppression de l'etudiant
        $managerE->supprimerEtudiant($_GET['personne']);
    } else {
        //cas administrateur
        if ($managerP->isAdminId($_GET['personne'])) {
            //on ne peut pas supprimer le derniere administrateur de la base de données
            if ($managerP->nbAdmin() == 1) {
                ?>