mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-24 06:28:46 +02:00
Étape 0 : inscription des équipes (en cours)
This commit is contained in:
@ -7,7 +7,6 @@ $YEAR = $_ENV["CORRES2MATH_YEAR"];
|
||||
$URL_BASE = $_ENV["CORRES2MATH_URL_BASE"];
|
||||
$LOCAL_PATH = $_ENV["CORRES2MATH_LOCAL_PATH"];
|
||||
$MAIL_DOMAIN = $_ENV["CORRES2MATH_MAIL_DOMAIN"];
|
||||
$MAIL_DOMAIN = "correspondances-maths.fr";
|
||||
|
||||
/**
|
||||
* DB infos
|
||||
@ -25,5 +24,163 @@ catch (Exception $ex) {
|
||||
die("Erreur lors de la connexion à la base de données : " . $ex->getMessage());
|
||||
}
|
||||
|
||||
$CONFIG = new Config();
|
||||
$CONFIG->initDB();
|
||||
$CONFIG->loadConfigValues();
|
||||
|
||||
class Config
|
||||
{
|
||||
private $inscription_date;
|
||||
private $start_phase1_date;
|
||||
private $end_phase1_date;
|
||||
private $start_phase2_date;
|
||||
private $end_phase2_date;
|
||||
private $start_phase3_date;
|
||||
private $end_phase3_date;
|
||||
private $start_phase4_date;
|
||||
private $end_phase4_date;
|
||||
|
||||
public function initDB()
|
||||
{
|
||||
global $DB;
|
||||
|
||||
$DB->exec("SET GLOBAL time_zone = 'Europe/Paris';");
|
||||
$DB->exec("INSERT IGNORE INTO `config` VALUES ('inscription_date', CURRENT_TIMESTAMP), ('start_phase1_date', CURRENT_TIMESTAMP), ('end_phase1_date', CURRENT_TIMESTAMP),
|
||||
('start_phase2_date', CURRENT_TIMESTAMP), ('end_phase2_date', CURRENT_TIMESTAMP),
|
||||
('start_phase3_date', CURRENT_TIMESTAMP), ('end_phase3_date', CURRENT_TIMESTAMP),
|
||||
('start_phase4_date', CURRENT_TIMESTAMP), ('end_phase4_date', CURRENT_TIMESTAMP);");
|
||||
}
|
||||
|
||||
public function loadConfigValues()
|
||||
{
|
||||
global $DB;
|
||||
|
||||
$req = $DB->query("SELECT * FROM `config`;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$key = $data["key"];
|
||||
$this->$key = $data["value"];
|
||||
}
|
||||
}
|
||||
|
||||
public function getInscriptionDate()
|
||||
{
|
||||
return $this->inscription_date;
|
||||
}
|
||||
|
||||
public function setInscriptionDate($inscription_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$inscription_date' WHERE `key` = 'inscription_date';");
|
||||
|
||||
$this->inscription_date = $inscription_date;
|
||||
}
|
||||
|
||||
public function getStartPhase1Date()
|
||||
{
|
||||
return $this->start_phase1_date;
|
||||
}
|
||||
|
||||
public function setStartPhase1Date($start_phase1_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase1_date' WHERE `key` = 'start_phase1_date';");
|
||||
|
||||
$this->start_phase1_date = $start_phase1_date;
|
||||
}
|
||||
|
||||
public function getEndPhase1Date()
|
||||
{
|
||||
return $this->end_phase1_date;
|
||||
}
|
||||
|
||||
public function setEndPhase1Date($end_phase1_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase1_date' WHERE `key` = 'end_phase1_date';");
|
||||
|
||||
$this->end_phase1_date = $end_phase1_date;
|
||||
}
|
||||
|
||||
public function getStartPhase2Date()
|
||||
{
|
||||
return $this->start_phase2_date;
|
||||
}
|
||||
|
||||
public function setStartPhase2Date($start_phase2_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase2_date' WHERE `key` = 'start_phase2_date';");
|
||||
|
||||
$this->start_phase2_date = $start_phase2_date;
|
||||
}
|
||||
|
||||
public function getEndPhase2Date()
|
||||
{
|
||||
return $this->end_phase2_date;
|
||||
}
|
||||
|
||||
public function setEndPhase2Date($end_phase2_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase2_date' WHERE `key` = 'end_phase2_date';");
|
||||
|
||||
$this->end_phase2_date = $end_phase2_date;
|
||||
}
|
||||
|
||||
public function getStartPhase3Date()
|
||||
{
|
||||
return $this->start_phase3_date;
|
||||
}
|
||||
|
||||
public function setStartPhase3Date($start_phase3_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase3_date' WHERE `key` = 'start_phase3_date';");
|
||||
|
||||
$this->start_phase3_date = $start_phase3_date;
|
||||
}
|
||||
|
||||
public function getEndPhase3Date()
|
||||
{
|
||||
return $this->end_phase3_date;
|
||||
}
|
||||
|
||||
public function setEndPhase3Date($end_phase3_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase3_date' WHERE `key` = 'end_phase3_date';");
|
||||
|
||||
$this->end_phase3_date = $end_phase3_date;
|
||||
}
|
||||
|
||||
public function getStartPhase4Date()
|
||||
{
|
||||
return $this->start_phase4_date;
|
||||
}
|
||||
|
||||
public function setStartPhase4Date($start_phase4_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase4_date' WHERE `key` = 'start_phase4_date';");
|
||||
|
||||
$this->start_phase4_date = $start_phase4_date;
|
||||
}
|
||||
|
||||
public function getEndPhase4Date()
|
||||
{
|
||||
return $this->end_phase4_date;
|
||||
}
|
||||
|
||||
public function setEndPhase4Date($end_phase4_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase4_date' WHERE `key` = 'end_phase4_date';");
|
||||
|
||||
$this->end_phase4_date = $end_phase4_date;
|
||||
}
|
||||
}
|
||||
|
||||
session_start();
|
||||
setlocale(LC_ALL, "fr_FR.utf8");
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
|
Reference in New Issue
Block a user