mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +00:00
Phase 1 (en cours)
This commit is contained in:
parent
4926539e25
commit
51282d13ea
@ -3,6 +3,7 @@
|
||||
require_once "server_files/config.php";
|
||||
|
||||
require_once "server_files/classes/Document.php";
|
||||
require_once "server_files/classes/Phase.php";
|
||||
require_once "server_files/classes/Role.php";
|
||||
require_once "server_files/classes/SchoolClass.php";
|
||||
require_once "server_files/classes/Team.php";
|
||||
@ -33,6 +34,7 @@ $ROUTES["^connexion/(mdp_oublie)/?$"] = ["server_files/controllers/connexion.php
|
||||
$ROUTES["^connexion/(reinitialiser_mdp)/(.*)/?$"] = ["server_files/controllers/connexion.php", "reset_password", "token"];
|
||||
$ROUTES["^connexion/?$"] = ["server_files/controllers/connexion.php"];
|
||||
$ROUTES["^deconnexion/?$"] = ["server_files/controllers/deconnexion.php"];
|
||||
$ROUTES["^envoyer-video-1$"] = ["server_files/controllers/envoyer_video.php"];
|
||||
$ROUTES["^equipe/([A-Z]{3})/?$"] = ["server_files/controllers/equipe.php", "trigram"];
|
||||
$ROUTES["^file/([a-z0-9]{64})/?$"] = ["server_files/controllers/view_file.php", "file_id"];
|
||||
$ROUTES["^informations/([0-9]*)/.*?$"] = ["server_files/controllers/informations.php", "id"];
|
||||
|
66
server_files/classes/Phase.php
Normal file
66
server_files/classes/Phase.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
class Phase
|
||||
{
|
||||
const INSCRIPTION = 0;
|
||||
const PHASE1 = 1;
|
||||
const PHASE2 = 2;
|
||||
const PHASE3 = 3;
|
||||
const PHASE4 = 4;
|
||||
const END = 5;
|
||||
const BETWEEN_PHASES = 6;
|
||||
|
||||
public static function getCurrentPhase()
|
||||
{
|
||||
global $CONFIG;
|
||||
|
||||
$date = date("Y-m-d H:i:s");
|
||||
|
||||
if ($date < $CONFIG->getStartPhase1Date())
|
||||
return self::INSCRIPTION;
|
||||
|
||||
if ($date < $CONFIG->getEndPhase1Date())
|
||||
return self::PHASE1;
|
||||
|
||||
if ($date < $CONFIG->getStartPhase2Date())
|
||||
return self::BETWEEN_PHASES;
|
||||
|
||||
if ($date < $CONFIG->getEndPhase2Date())
|
||||
return self::PHASE2;
|
||||
|
||||
if ($date < $CONFIG->getStartPhase3Date())
|
||||
return self::BETWEEN_PHASES;
|
||||
|
||||
if ($date < $CONFIG->getEndPhase3Date())
|
||||
return self::PHASE3;
|
||||
|
||||
if ($date < $CONFIG->getStartPhase4Date())
|
||||
return self::BETWEEN_PHASES;
|
||||
|
||||
if ($date < $CONFIG->getEndPhase4Date())
|
||||
return self::PHASE4;
|
||||
|
||||
return self::END;
|
||||
}
|
||||
|
||||
public static function getTranslatedName($phase)
|
||||
{
|
||||
switch ($phase)
|
||||
{
|
||||
case self::INSCRIPTION:
|
||||
return "Inscription";
|
||||
case self::PHASE1:
|
||||
return "Phase 1 (soumission des vidéos)";
|
||||
case self::PHASE2:
|
||||
return "Phase 2 (questions)";
|
||||
case self::PHASE3:
|
||||
return "Phase 3 (réponses)";
|
||||
case self::PHASE4:
|
||||
return "Phase 4 (vidéo de réponse)";
|
||||
case self::BETWEEN_PHASES:
|
||||
return "Entre deux phases";
|
||||
default:
|
||||
return "Le tournoi est terminé";
|
||||
}
|
||||
}
|
||||
}
|
38
server_files/controllers/envoyer_video.php
Normal file
38
server_files/controllers/envoyer_video.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/** @var Team $team */
|
||||
$team = $_SESSION["team"];
|
||||
|
||||
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::PARTICIPANT && $_SESSION["role"] != Role::ENCADRANT || $team == null || $team->getValidationStatus() != ValidationStatus::VALIDATED)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$has_error = false;
|
||||
$error_message = null;
|
||||
|
||||
if (isset($_POST["upload"])) {
|
||||
$new_video = new NewVideo($_POST);
|
||||
try {
|
||||
$new_video->makeVerfications();
|
||||
$new_video->uploadVideo();
|
||||
} catch (AssertionError $e) {
|
||||
$has_error = true;
|
||||
$error_message = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
class NewVideo
|
||||
{
|
||||
private $link;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->link = $data["link"];
|
||||
}
|
||||
|
||||
public function makeVerifications()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require_once "server_files/views/envoyer_video.php";
|
31
server_files/views/envoyer_video.php
Normal file
31
server_files/views/envoyer_video.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once "header.php";
|
||||
|
||||
if ($has_error)
|
||||
echo "<h2>Erreur : $error_message</h2>";
|
||||
elseif (isset($new_video))
|
||||
echo "<h2>Votre vidéo a bien été envoyée !</h2>";
|
||||
?>
|
||||
|
||||
<form method="POST">
|
||||
<table style="width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 30%;">
|
||||
<label for="link">Lien de la vidéo :</label>
|
||||
</td>
|
||||
<td style="width: 70%;">
|
||||
<input style="width: 100%;" type="url" id="link" name="link" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input style="width: 100%;" type="submit" name="upload" value="Envoyer la vidéo" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php require_once "footer.php";
|
@ -41,8 +41,13 @@
|
||||
<?php }
|
||||
} else { ?>
|
||||
<li><a href="<?= $URL_BASE ?>/mon_equipe">Mon équipe</a></li>
|
||||
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED || true) { ?>
|
||||
<?php } ?>
|
||||
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED) {
|
||||
switch (Phase::getCurrentPhase()) {
|
||||
case Phase::PHASE1: ?>
|
||||
<li><a href="<?= $URL_BASE ?>/envoyer-video-1">Envoyer ma vidéo (phase 1)</a></li>
|
||||
<?php break;
|
||||
}
|
||||
} ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?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%">
|
||||
@ -30,11 +33,13 @@
|
||||
|
||||
<h2>Calendrier</h2>
|
||||
|
||||
Inscription avant le : <strong><?= formatDate($CONFIG->getInscriptionDate(), true) ?></strong><br />
|
||||
Phase 1 : Du <strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong><br />
|
||||
Phase 2 : Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong><br />
|
||||
Phase 3 : Du <strong><?= formatDate($CONFIG->getStartPhase3Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase3Date(), true) ?></strong><br />
|
||||
Phase 4 : Du <strong><?= formatDate($CONFIG->getStartPhase4Date(), true) ?></strong> au <strong><?= formatDate($CONFIG->getEndPhase4Date(), true) ?></strong><br />
|
||||
<?= 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>
|
||||
|
Loading…
Reference in New Issue
Block a user