1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-26 00:27:32 +02:00

Séparation vue et contrôleur

This commit is contained in:
galaxyoyo
2019-09-06 13:48:50 +02:00
parent a1b4c42707
commit a1ef162bdb
58 changed files with 2628 additions and 2758 deletions

View File

@ -25,41 +25,8 @@ catch (Exception $ex) {
}
session_start();
if (isset($_SESSION["user_id"])) {
$response = $DB->query("SELECT * FROM `users` WHERE `id` ='" . $_SESSION["user_id"] . "' AND `year` = '$YEAR';");
$data = $response->fetch();
if ($data === FALSE)
unset($_SESSION["user_id"]);
else {
$_SESSION["email"] = $data["email"];
$_SESSION["surname"] = $data["surname"];
$_SESSION["first_name"] = $data["first_name"];
$_SESSION["birth_date"] = $data["birth_date"];
$_SESSION["role"] = $data["role"];
$_SESSION["team_id"] = $data["team_id"];
}
if (isset($_SESSION["user_id"]) && isset($_SESSION["team_id"]) && $_SESSION["team_id"] != NULL) {
$response = $DB->query("SELECT `tournament`, `validation_status`, `final_selection` FROM `teams` WHERE `id` ='" . $_SESSION["team_id"] . "' AND `year` = '$YEAR';");
$data = $response->fetch();
$_SESSION["tournament_id"] = $data["tournament"];
$_SESSION["team_validation_status"] = $data["validation_status"];
}
if ((isset($data["final_selection"]) && $data["final_selection"]) || $_SESSION["role"] == "ADMIN" || $_SESSION["role"] == "ORGANIZER") {
$response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `final` AND `year` = $YEAR;");
$data = $response->fetch();
$_SESSION["final_id"] = $data["id"];
$_SESSION["final_name"] = $data["name"];
}
}
setlocale(LC_ALL, "fr_FR.utf8");
function echo_date($date = NULL, $with_time = false) {
if ($date == NULL)
$date = date("yyyy-mm-dd");
require_once "model.php";
return strftime("%d %B %G" . ($with_time ? " %H:%M" : ""), strtotime($date));
}
loadUserValues();