1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-25 02:20:29 +02:00

Possibilité de modification de la page d'accueil

This commit is contained in:
Yohann
2019-10-17 00:35:06 +02:00
parent a580086312
commit b571598a3c
5 changed files with 118 additions and 66 deletions

View File

@ -39,17 +39,21 @@ class Config
private $end_phase3_date;
private $start_phase4_date;
private $end_phase4_date;
private $index_page;
public function initDB()
{
global $DB;
global $DB, $LOCAL_PATH;
$index_template_page = htmlspecialchars(file_get_contents($LOCAL_PATH . "/server_files/views/index.html"));
$DB->exec("SET GLOBAL time_zone = 'Europe/Paris';");
$DB->exec("INSERT IGNORE INTO `config` VALUES ('inscription_date', CURRENT_TIMESTAMP + INTERVAL 2 DAY),
$DB->prepare("INSERT IGNORE INTO `config` VALUES ('inscription_date', CURRENT_TIMESTAMP + INTERVAL 2 DAY),
('start_phase1_date', CURRENT_TIMESTAMP + INTERVAL 1 DAY), ('end_phase1_date', CURRENT_TIMESTAMP + INTERVAL 3 DAY),
('start_phase2_date', CURRENT_TIMESTAMP + INTERVAL 4 DAY), ('end_phase2_date', CURRENT_TIMESTAMP + INTERVAL 5 DAY),
('start_phase3_date', CURRENT_TIMESTAMP + INTERVAL 6 DAY), ('end_phase3_date', CURRENT_TIMESTAMP + INTERVAL 7 DAY),
('start_phase4_date', CURRENT_TIMESTAMP + INTERVAL 8 DAY), ('end_phase4_date', CURRENT_TIMESTAMP + INTERVAL 9 DAY);");
('start_phase4_date', CURRENT_TIMESTAMP + INTERVAL 8 DAY), ('end_phase4_date', CURRENT_TIMESTAMP + INTERVAL 9 DAY),
('index_page', ?);")->execute([$index_template_page]);
}
public function loadConfigValues()
@ -180,6 +184,19 @@ class Config
$this->end_phase4_date = $end_phase4_date;
}
public function getIndexPage()
{
return $this->index_page;
}
public function setIndexPage($index_page)
{
global $DB;
$DB->prepare("UPDATE `config` SET `value` = ? WHERE `key` = 'index_page';")->execute([$index_page]);
$this->index_page = $index_page;
}
}
session_start();