mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 03:02:14 +01:00 
			
		
		
		
	Quelques vérifications temporelles et autres
This commit is contained in:
		@@ -2,13 +2,20 @@
 | 
			
		||||
 | 
			
		||||
include 'config.php';
 | 
			
		||||
 | 
			
		||||
if (!isset($_SESSION["team_id"]))
 | 
			
		||||
	error403();
 | 
			
		||||
 | 
			
		||||
if (isset($_POST["send_synthese"])) {
 | 
			
		||||
    $error_message = saveSynthese();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? GROUP BY `dest` ORDER BY `dest` ASC, `uploaded_at` DESC;");
 | 
			
		||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
 | 
			
		||||
$syntheses_req->execute([$_SESSION["team_id"]]);
 | 
			
		||||
 | 
			
		||||
$tournament_req = $DB->prepare("SELECT `date_solutions`, `date_syntheses` FROM `tournaments` WHERE `id` = ?;");
 | 
			
		||||
$tournament_req->execute([$_SESSION["tournament_id"]]);
 | 
			
		||||
$tournament_data = $tournament_req->fetch();
 | 
			
		||||
 | 
			
		||||
function saveSynthese() {
 | 
			
		||||
    global $LOCAL_PATH, $DB;
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +59,13 @@ function saveSynthese() {
 | 
			
		||||
 | 
			
		||||
<?php include 'header.php' ?>
 | 
			
		||||
 | 
			
		||||
<?php if (isset($error_message)) {
 | 
			
		||||
<?php
 | 
			
		||||
if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) {
 | 
			
		||||
	echo "<h3>Il est trop tôt pour se préoccuper des notes de synthèse, attendez le tirage des poules.</h3>";
 | 
			
		||||
	include "footer.php";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (isset($error_message)) {
 | 
			
		||||
    if ($error_message !== false) {
 | 
			
		||||
        echo "<h2>Erreur : " . $error_message . "</h2>";
 | 
			
		||||
    }
 | 
			
		||||
@@ -61,37 +74,39 @@ function saveSynthese() {
 | 
			
		||||
    }
 | 
			
		||||
}?>
 | 
			
		||||
 | 
			
		||||
<form method="post" enctype="multipart/form-data">
 | 
			
		||||
    <input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
 | 
			
		||||
    <table>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>
 | 
			
		||||
                <label for="dest">Destination de la note de synthèse :</label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <select id="dest" name="dest">
 | 
			
		||||
                    <option value="opposant">Opposant</option>
 | 
			
		||||
                    <option value="rapporteur">Rapporteur</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>
 | 
			
		||||
                <label for="file">Fichier :</label>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <input type="file" id="file" name="synthese" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td colspan="2">
 | 
			
		||||
                <input style="width: 100%;" type="submit" name="send_synthese" value="Envoyer" />
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
</form>
 | 
			
		||||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_syntheses"]) { ?>
 | 
			
		||||
    <form method="post" enctype="multipart/form-data">
 | 
			
		||||
        <input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
 | 
			
		||||
        <table>
 | 
			
		||||
            <tbody>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="dest">Destination de la note de synthèse :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <select id="dest" name="dest">
 | 
			
		||||
                        <option value="opposant">Opposant</option>
 | 
			
		||||
                        <option value="rapporteur">Rapporteur</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <label for="file">Fichier :</label>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <input type="file" id="file" name="synthese" />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td colspan="2">
 | 
			
		||||
                    <input style="width: 100%;" type="submit" name="send_synthese" value="Envoyer" />
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
            </tbody>
 | 
			
		||||
        </table>
 | 
			
		||||
    </form>
 | 
			
		||||
<?php } ?>
 | 
			
		||||
 | 
			
		||||
<div style="padding: 20px"></div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user