mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 06:22:13 +01:00 
			
		
		
		
	Support de la finale
This commit is contained in:
		@@ -80,12 +80,17 @@ function registerTournament() {
 | 
			
		||||
        return "Une date est mal formée.";
 | 
			
		||||
 | 
			
		||||
    $description = htmlspecialchars($_POST["description"]);
 | 
			
		||||
    
 | 
			
		||||
    $final = isset($_POST["final"]) && $_POST["final"];
 | 
			
		||||
    
 | 
			
		||||
    if ($final && $DB->query("SELECT `id` FROM `tournaments` WHERE `final` = true AND `year` = $YEAR;")->fetch() !== false)
 | 
			
		||||
        return "Une finale est déjà enregistrée.";
 | 
			
		||||
 | 
			
		||||
    $req = $DB->prepare("INSERT INTO `tournaments` (`name`, `size`, `place`, `price`, `description`, 
 | 
			
		||||
                           `date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `year`) 
 | 
			
		||||
                           VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
 | 
			
		||||
                           `date_start`, `date_end`, `date_inscription`, `date_solutions`, `date_syntheses`, `final`, `year`)
 | 
			
		||||
                           VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
 | 
			
		||||
    $req->execute([$name, $size, $place, $price, $description, $date_start, $date_end,
 | 
			
		||||
        "$date_inscription $time_inscription", "$date_solutions $time_solutions", "$date_syntheses $time_syntheses", $YEAR]);
 | 
			
		||||
        "$date_inscription $time_inscription", "$date_solutions $time_solutions", "$date_syntheses $time_syntheses", $final, $YEAR]);
 | 
			
		||||
 | 
			
		||||
    $req = $DB->query("SELECT `id` FROM `tournaments` WHERE `name` = '$name' AND `year` = $YEAR;");
 | 
			
		||||
    $tournament_id = $req->fetch()["id"];
 | 
			
		||||
@@ -175,7 +180,8 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
 | 
			
		||||
                    <label for="date_start">Dates :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    Du <input style="width: 45%;" type="date" id="date_start" name="date_start" required /> au <input style="width: 45%;" type="date" id="date_end" name="date_end" required />
 | 
			
		||||
                    Du <input style="width: 45%;" type="date" id="date_start" name="date_start" required /> au <!--suppress HtmlFormInputWithoutLabel -->
 | 
			
		||||
                    <input style="width: 45%;" type="date" id="date_end" name="date_end" required />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
@@ -184,6 +190,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" required />
 | 
			
		||||
                    <!--suppress HtmlFormInputWithoutLabel -->
 | 
			
		||||
                    <input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" required />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
@@ -193,6 +200,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" required />
 | 
			
		||||
                    <!--suppress HtmlFormInputWithoutLabel -->
 | 
			
		||||
                    <input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" required />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
@@ -202,6 +210,7 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input style="width: 49%;" type="date" id="date_syntheses" name="date_syntheses" required />
 | 
			
		||||
                    <!--suppress HtmlFormInputWithoutLabel -->
 | 
			
		||||
                    <input style="width: 49%;" type="time" id="time_syntheses" name="time_syntheses" required />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
@@ -213,6 +222,14 @@ if (!isset($_SESSION["role"]) or $_SESSION["role"] != "ADMIN") {
 | 
			
		||||
                    <textarea style="width: 100%;" name="description" id="description" required></textarea>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="final">Ce tournoi est la finale nationale :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input style="width: 100%;" type="checkbox" id="final" name="final" />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <input style="width: 100%;" type="submit" value="Ajouter un tournoi" />
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user