plateforme-corres2math/server_files/classes/Phase.php

68 lines
1.3 KiB
PHP
Raw Normal View History

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