1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Calendrier

This commit is contained in:
galaxyoyo 2019-09-19 00:46:32 +02:00
parent 5372350f46
commit c48b97cc6d
6 changed files with 151 additions and 149 deletions

View File

@ -29,7 +29,8 @@ $ROUTES = [];
$ROUTES["^(|accueil|index|accueil\.php|accueil\.html|accueil\.py|index\.php|index\.html|index\.py)$"] = ["server_files/controllers/index.php"];
$ROUTES["^ajouter_equipe$"] = ["server_files/controllers/ajouter_equipe.php"];
$ROUTES["^ajouter_admin$"] = ["server_files/controllers/ajouter_admin.php"];
$ROUTES["^calendrier$"] = ["server_files/controllers/calendrier.php"];
$ROUTES["^calendrier/(modifier)$"] = ["server_files/controllers/calendrier.php", "edit"];
$ROUTES["^calendrier/?$"] = ["server_files/controllers/calendrier.php"];
$ROUTES["^confirmer-mail/([a-z0-9]*)/?$"] = ["server_files/controllers/confirmer_mail.php", "token"];
$ROUTES["^connexion/(confirmation-mail)/?$"] = ["server_files/controllers/connexion.php", "confirmation-mail"];
$ROUTES["^connexion/(mdp-oublie)/?$"] = ["server_files/controllers/connexion.php", "mdp_oublie"];
@ -45,7 +46,6 @@ $ROUTES["^mon-compte/?$"] = ["server_files/controllers/mon_compte.php"];
$ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
$ROUTES["^problemes/?$"] = ["server_files/controllers/problemes.php"];
$ROUTES["^rejoindre_equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"];

View File

@ -6,7 +6,7 @@ if ($_SESSION["role"] != Role::ADMIN)
$has_error = false;
$error_message = null;
if (isset($_POST["update_calendar"])) {
if (isset($_GET["edit"]) && isset($_POST["update_calendar"])) {
$update_calendar = new UpdateCalendar($_POST);
try {
$update_calendar->makeVerifications();
@ -71,7 +71,7 @@ class UpdateCalendar
$CONFIG->setStartPhase4Date($this->date_start_phase4 . " " . $this->time_start_phase4);
$CONFIG->setEndPhase4Date($this->date_end_phase4 . " " . $this->time_end_phase4);
header("Location: $URL_BASE/problemes");
header("Location: $URL_BASE/calendrier");
exit();
}
}

View File

@ -1,3 +0,0 @@
<?php
require_once "server_files/views/problemes.php";

View File

@ -1,96 +1,139 @@
<?php require_once "header.php"; ?>
<form method="post">
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="date_inscription">Fin des inscriptions :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase1" name="date_start_phase1" value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_start_phase1" name="time_start_phase1" value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase1" name="date_end_phase1" value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_end_phase1" name="time_end_phase1" value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase2" name="date_start_phase2" value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_start_phase2" name="time_start_phase2" value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase2" name="date_end_phase2" value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_end_phase2" name="time_end_phase2" value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase3" name="date_start_phase3" value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_start_phase3" name="time_start_phase3" value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase3" name="date_end_phase3" value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_end_phase3" name="time_end_phase3" value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase4" name="date_start_phase4" value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_start_phase4" name="time_start_phase4" value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase4" name="date_end_phase4" value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>" />
<input style="width: 49%;" type="time" id="time_end_phase4" name="time_end_phase4" value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>" />
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input style="width: 100%;" type="submit" name="update_calendar" value="Mettre à jour le calendrier" />
</td>
</tr>
</tbody>
</table>
</form>
<?php if (isset($_GET["edit"])) { ?>
<form method="post">
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="date_inscription">Fin des inscriptions :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription"
value="<?= substr($CONFIG->getInscriptionDate(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase1" name="date_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase1" name="time_start_phase1"
value="<?= substr($CONFIG->getStartPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 1 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase1" name="date_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase1" name="time_end_phase1"
value="<?= substr($CONFIG->getEndPhase1Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase2" name="date_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase2" name="time_start_phase2"
value="<?= substr($CONFIG->getStartPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 2 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase2" name="date_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase2" name="time_end_phase2"
value="<?= substr($CONFIG->getEndPhase2Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase3" name="date_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase3" name="time_start_phase3"
value="<?= substr($CONFIG->getStartPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 3 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase3" name="date_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase3" name="time_end_phase3"
value="<?= substr($CONFIG->getEndPhase3Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_start_phase1">Début de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_start_phase4" name="date_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_start_phase4" name="time_start_phase4"
value="<?= substr($CONFIG->getStartPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td style="width: 30%;">
<label for="date_end_phase1">Fin de la phase 4 :</label>
</td>
<td style="width: 70%;">
<input style="width: 49%;" type="date" id="date_end_phase4" name="date_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 0, 10) ?>"/>
<input style="width: 49%;" type="time" id="time_end_phase4" name="time_end_phase4"
value="<?= substr($CONFIG->getEndPhase4Date(), 11, 5) ?>"/>
</td>
</tr>
<tr>
<td colspan="2" style="width: 100%;">
<input style="width: 100%;" type="submit" name="update_calendar"
value="Mettre à jour le calendrier"/>
</td>
</tr>
</tbody>
</table>
</form>
<?php } else { ?><h2>Calendrier</h2>
<?php require_once "footer.php";
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> :
<strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE1) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE2) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE3) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong><br/>
<?= Phase::getTranslatedName(Phase::PHASE4) ?> : Du
<strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong><br/>
<br/>
Phase actuelle : <strong><?= Phase::getTranslatedName(Phase::getCurrentPhase()) ?></strong><br/>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<a href="<?= $URL_BASE ?>/calendrier/modifier">Modifier le calendrier</a>
<?php }
}
require_once "footer.php";

View File

@ -25,7 +25,17 @@
<ul id="menu">
<li id="menu-logo"><img src="<?= $URL_BASE ?>/logo.png" alt="Logo Corres2Math"></li>
<li><a href="<?= $URL_BASE ?>/">Accueil</a></li>
<li><a href="<?= $URL_BASE ?>/problemes">Liste des problèmes</a></li>
<li><a href="<?= $URL_BASE ?>/calendrier">Calendrier</a></li>
<li>
<!-- TODO Menu déroulant -->
<a>Liste des problèmes</a>
<ul>
<li><a href="<?= $URL_BASE ?>/probleme/1">Problème 1</a></li>
<li><a href="<?= $URL_BASE ?>/probleme/2">Problème 2</a></li>
<li><a href="<?= $URL_BASE ?>/probleme/3">Problème 3</a></li>
<li><a href="<?= $URL_BASE ?>/probleme/4">Problème 4</a></li>
</ul>
</li>
<?php if (!isset($_SESSION["user_id"])) { ?>
<li><a href="<?= $URL_BASE ?>/connexion">Connexion</a></li>
<?php if (date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate()) { ?>

View File

@ -1,48 +0,0 @@
<?php require_once "header.php" ?>
<!-- TODO -->
<h1>TODO : renommer cette page en <span style="font-family: Courier">/calendrier</span> et faire un menu déroulant pour accéder aux informations sur un prolème</h1>
<h2>Liste des problèmes</h2>
<table style="border: 1px solid black; width: 100%">
<thead style="border: 1px solid black">
<tr>
<th style="border: 1px solid black; text-align: center">Problème</th>
</tr>
</thead>
<tbody style="border: 1px solid black">
<?php
for ($i = 1; $i <= 4; ++$i) {
?>
<tr style="border: 1px solid black">
<td style="border: 1px solid black; text-align: center"><a href="<?= $URL_BASE ?>/probleme/<?= $i ?>">Problème <?= $i ?></a></td>
</tr>
<?php
}
?>
</tbody>
<tfoot style="border: 1px solid black">
<tr>
<th style="border: 1px solid black; text-align: center">Problème</th>
</tr>
</tfoot>
</table>
<hr />
<h2>Calendrier</h2>
<?= Phase::getTranslatedName(Phase::INSCRIPTION) ?> : <strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong><br />
<?= Phase::getTranslatedName(Phase::PHASE1) ?> : Du <strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong><br />
<?= Phase::getTranslatedName(Phase::PHASE2) ?> : Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong><br />
<?= Phase::getTranslatedName(Phase::PHASE3) ?> : Du <strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong><br />
<?= Phase::getTranslatedName(Phase::PHASE4) ?> : Du <strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong><br />
<br />
Phase actuelle : <strong><?= Phase::getTranslatedName(Phase::getCurrentPhase()) ?></strong><br />
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<a href="<?= $URL_BASE ?>/calendrier">Modifier le calendrier</a>
<?php }
require_once "footer.php" ?>