plateforme-tfjm2/server_files/views/ajouter_tournoi.php

111 lines
5.2 KiB
PHP

<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Ajouter un tournoi</h1>
</div>
<?php
/** @var NewTournament $tournament */
if (isset($tournament) && !$has_error) { ?>
<div class="alert alert-success">
Tournoi de <?= $tournament->name ?> ajouté avec succès !
</div>
<?php } ?>
<form method="POST">
<div class="form-row">
<div class="form-group col-md-6">
<label for="name">Nom du tournoi :</label>
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ ]+"
value="<?php if (isset($tournament)) echo $tournament->name ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="place">Lieu :</label>
<input class="form-control" type="text" id="place" name="place"
value="<?php if (isset($tournament)) echo $tournament->place ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="organizers">Organisateurs :</label>
<select style="width: 100%;" id="organizers" name="organizers[]" multiple size="4" class="custom-select" required>
<?php
while (($data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["first_name"] . " " . $data["surname"] . "</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="size">Nombre d'équipes :</label>
<input class="form-control" type="number" id="size" name="size"
value="<?php if (isset($tournament)) echo $tournament->size; else echo 6; ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="price">Prix par participant :</label>
<input class="form-control" type="number" id="price" name="price"
value="<?php if (isset($tournament)) echo $tournament->price; else echo 0; ?>" required/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-6">
<label for="date_start">Début du tournoi :</label>
<input class="form-control" type="date" id="date_start" name="date_start"
value="<?= isset($tournament) ? substr($tournament->getStartDate(), 0, 10) : date('Y-m-d') ?>"/>
</div>
<div class="form-group col-md-6">
<label for="date_end">Fin du tournoi :</label>
<input class="form-control" type="date" id="date_end" name="date_end"
value="<?= isset($tournament) ? substr($tournament->getEndDate(), 0, 10) : date('Y-m-d') ?>"/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-4">
<label for="date_inscription">Date limite d'inscription :</label>
<input class="form-control" type="date" id="date_inscription" name="date_inscription"
value="<?= isset($tournament) ? substr($tournament->getInscriptionDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_inscription" name="time_inscription"
value="<?= isset($tournament) ? substr($tournament->getInscriptionDate(), 11, 5) : date('H:i') ?>"/>
</div>
<div class="form-group col-md-4">
<label for="date_solutions">Date limite de remise des solutions :</label>
<input class="form-control" type="date" id="date_solutions" name="date_solutions"
value="<?= isset($tournament) ? substr($tournament->getSolutionsDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_solutions" name="time_solutions"
value="<?= isset($tournament) ? substr($tournament->getSolutionsDate(), 11, 5) : date('H:i') ?>"/>
</div>
<div class="form-group col-md-4">
<label for="date_syntheses">Date limite de remise des notes de synthèse :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses"
value="<?= isset($tournament) ? substr($tournament->getSynthesesDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses"
value="<?= isset($tournament) ? substr($tournament->getSynthesesDate(), 11, 5) : date('H:i') ?>"/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="description">Description :</label>
<textarea class="form-control" id="description" name="description"><?= isset($tournament) ? $tournament->getDescription() : "" ?></textarea>
</div>
</div>
<label for="final">Ce tournoi est la finale nationale :</label>
<input type="checkbox" id="final" name="final" /><br /><br />
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="add_tournament" type="submit" value="Ajouter un tournoi" />
</div>
</form>
<?php require_once "footer.php" ?>