plateforme-corres2math/server_files/classes/Phase.php

66 lines
1.3 KiB
PHP

<?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é";
}
}
}