mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 03:42:11 +01:00 
			
		
		
		
	Redesign du site
This commit is contained in:
		@@ -3,12 +3,12 @@
 | 
			
		||||
if (!isset($_SESSION["role"]) || ($_SESSION["role"] != Role::PARTICIPANT && $_SESSION["role"] != Role::ENCADRANT))
 | 
			
		||||
	require_once "server_files/403.php";
 | 
			
		||||
 | 
			
		||||
$tournaments_response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `date_inscription` > CURRENT_DATE AND `year` = '$YEAR';");
 | 
			
		||||
$tournaments_response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `date_inscription` > CURRENT_TIMESTAMP AND `year` = $YEAR;");
 | 
			
		||||
 | 
			
		||||
$has_error = false;
 | 
			
		||||
$error_message = null;
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["submitted"])) {
 | 
			
		||||
if (isset($_POST["add_team"])) {
 | 
			
		||||
    $new_team = new NewTeam($_POST);
 | 
			
		||||
    try {
 | 
			
		||||
    	$new_team->makeVerifications();
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
$has_error = false;
 | 
			
		||||
$error_message = null;
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["submitted"]) && !isset($_SESSION["user_id"])) {
 | 
			
		||||
if (isset($_POST["login"]) && !isset($_SESSION["user_id"])) {
 | 
			
		||||
	$logging_in_user = new LoggingInUser($_POST);
 | 
			
		||||
	try {
 | 
			
		||||
		$logging_in_user->makeVerifications();
 | 
			
		||||
 
 | 
			
		||||
@@ -4,5 +4,11 @@ unset($_SESSION["user_id"]);
 | 
			
		||||
session_destroy();
 | 
			
		||||
 | 
			
		||||
require_once "server_files/views/header.php";
 | 
			
		||||
echo "<h2>Déconnexion réussie !</h2>";
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<div class="alert alert-success">
 | 
			
		||||
    Déconnexion réussie !
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
require_once "server_files/views/footer.php";
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ $user = $_SESSION["user"];
 | 
			
		||||
$has_error = false;
 | 
			
		||||
$error_message = null;
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["submitted"])) {
 | 
			
		||||
if (isset($_POST["update_account"])) {
 | 
			
		||||
    $my_account = new MyAccount($_POST);
 | 
			
		||||
    try {
 | 
			
		||||
    	$my_account->makeVerifications();
 | 
			
		||||
@@ -21,7 +21,7 @@ if (isset($_POST["submitted"])) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["submitted_password"])) {
 | 
			
		||||
if (isset($_POST["update_password"])) {
 | 
			
		||||
	$new_password = new NewPassword($_POST);
 | 
			
		||||
	try {
 | 
			
		||||
		$new_password->makeVerifications();
 | 
			
		||||
@@ -63,8 +63,10 @@ class MyAccount
 | 
			
		||||
		$keys = ["email", "surname", "first_name", "birth_date", "gender", "address", "postal_code", "city", "country", "phone_number",
 | 
			
		||||
			"school", "class", "responsible_name", "responsible_phone", "responsible_email", "description"];
 | 
			
		||||
 | 
			
		||||
		if ($this->user->getRole() == Role::PARTICIPANT)
 | 
			
		||||
			$this->class = SchoolClass::fromName($this->class);
 | 
			
		||||
		if ($this->user->getRole() != Role::PARTICIPANT)
 | 
			
		||||
			$this->class = SchoolClass::fromName(strtoupper($this->class));
 | 
			
		||||
		else
 | 
			
		||||
		    $this->class = SchoolClass::ADULT;
 | 
			
		||||
 | 
			
		||||
		foreach ($keys as $key)
 | 
			
		||||
			$this->$key = $this->$key != null && $this->$key != "" ? $this->$key : $this->user->$key;
 | 
			
		||||
 
 | 
			
		||||
@@ -134,7 +134,7 @@ class MyTeam
 | 
			
		||||
 | 
			
		||||
		$_SESSION["tournament"] = $this->tournament;
 | 
			
		||||
 | 
			
		||||
		header("Location: $URL_BASE/mon_equipe");
 | 
			
		||||
		header("Location: $URL_BASE/mon-equipe");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ if (isset($_SESSION["team"]) || !isset($_SESSION["user"]) || ($_SESSION["role"]
 | 
			
		||||
$has_error = false;
 | 
			
		||||
$error_message = null;
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["submitted"])) {
 | 
			
		||||
if (isset($_POST["join_team"])) {
 | 
			
		||||
	$join_team = new JoinTeam($_POST);
 | 
			
		||||
	try {
 | 
			
		||||
		$join_team->makeVerifications();
 | 
			
		||||
@@ -47,6 +47,8 @@ class JoinTeam
 | 
			
		||||
 | 
			
		||||
	public function joinTeam()
 | 
			
		||||
	{
 | 
			
		||||
		global $team;
 | 
			
		||||
 | 
			
		||||
		$user = $_SESSION["user"];
 | 
			
		||||
 | 
			
		||||
		$user->setTeamId($this->team->getId());
 | 
			
		||||
@@ -56,7 +58,7 @@ class JoinTeam
 | 
			
		||||
		else
 | 
			
		||||
			$this->team->setParticipant($this->min_null_index, $user->getId());
 | 
			
		||||
 | 
			
		||||
		$_SESSION["team"] = $this->team;
 | 
			
		||||
		$team = $_SESSION["team"] = $this->team;
 | 
			
		||||
		$tournament = $_SESSION["tournament"] = Tournament::fromId($this->team->getTournamentId());
 | 
			
		||||
 | 
			
		||||
		Mailer::sendJoinTeamMail($user, $this->team, $tournament);
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ class SaveSolution
 | 
			
		||||
 | 
			
		||||
	public function __construct()
 | 
			
		||||
	{
 | 
			
		||||
		$this->file = $_FILES["document"];
 | 
			
		||||
		$this->file = $_FILES["solution"];
 | 
			
		||||
		$this->problem = htmlspecialchars($_POST["problem"]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,8 +33,8 @@ class SaveSynthesis
 | 
			
		||||
 | 
			
		||||
	public function __construct()
 | 
			
		||||
	{
 | 
			
		||||
		$this->file = $_FILES["document"];
 | 
			
		||||
		$this->dest = DestType::fromName(strtoupper(htmlspecialchars($_POST["problem"])));
 | 
			
		||||
		$this->file = $_FILES["synthese"];
 | 
			
		||||
		$this->dest = DestType::fromName(strtoupper(htmlspecialchars($_POST["dest"])));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function makeVerifications()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user