plateforme-corres2math/server_files/classes/Phase.php

68 lines
1.3 KiB
PHP

<?php
class Phase
{
const INSCRIPTION = 0;
const PHASE1 = 1;
const PHASE12 = 2;
const PHASE2 = 3;
const PHASE23 = 4;
const PHASE3 = 5;
const PHASE34 = 6;
const PHASE4 = 7;
const END = 8;
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::PHASE12;
if ($date < $CONFIG->getEndPhase2Date())
return self::PHASE2;
if ($date < $CONFIG->getStartPhase3Date())
return self::PHASE23;
if ($date < $CONFIG->getEndPhase3Date())
return self::PHASE3;
if ($date < $CONFIG->getStartPhase4Date())
return self::PHASE34;
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::END:
return "Les Correspondances sont terminées";
default:
return "Entre deux phases";
}
}
}