Modifications mineures
This commit is contained in:
parent
cd70de049a
commit
6fe398d965
|
@ -90,7 +90,7 @@ class User
|
|||
{
|
||||
global $DB, $YEAR;
|
||||
$admins = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ORGANIZER' OR `role` = 'ADMIN' AND `year` = $YEAR;");
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ORGANIZER' OR `role` = 'ADMIN' AND `year` = $YEAR ORDER BY `role`, `surname`, `first_name`;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$admin = new User();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$orgas_response = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE (`role` = 'ORGANIZER' OR `role` = 'ADMIN') AND `year` = '$YEAR';");
|
||||
|
||||
$has_error = false;
|
||||
$error_message = null;
|
||||
|
||||
|
|
|
@ -5,17 +5,20 @@ if (!isset($_SESSION["role"]))
|
|||
|
||||
$id = $_GET["id"];
|
||||
$user = User::fromId($id);
|
||||
$team = Team::fromId($user->getTeamId());
|
||||
|
||||
if ($_SESSION["role"] != Role::ADMIN) {
|
||||
if ($user->getId() != $_SESSION["user_id"])
|
||||
if ($_SESSION["role"] == Role::ORGANIZER) {
|
||||
if (($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::PARTICIPANT) && ($team == null || $team->getTournamentId() == null || !Tournament::fromId($team->getTournamentId())->organize($_SESSION["user_id"])))
|
||||
require_once "server_files/403.php";
|
||||
}
|
||||
elseif ($user->getId() != $_SESSION["user_id"])
|
||||
require_once "server_files/403.php";
|
||||
}
|
||||
|
||||
if ($user === null)
|
||||
require_once "server_files/404.php";
|
||||
|
||||
$team = Team::fromId($user->getTeamId());
|
||||
|
||||
if ($team != null) {
|
||||
$documents = $user->getAllDocuments($team->getTournamentId());
|
||||
$payment = $user->getPayment();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
if ($_SESSION["role"] != Role::ADMIN)
|
||||
if ($_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$organizers = User::getOrganizers();
|
||||
|
|
|
@ -25,7 +25,6 @@ if (isset($_POST["edit_tournament"])) {
|
|||
|
||||
$orgas = $tournament->getOrganizers();
|
||||
$teams = $tournament->getAllTeams();
|
||||
$orgas_response = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE (`role` = 'ORGANIZER' OR `role` = 'ADMIN') AND `year` = '$YEAR';");
|
||||
|
||||
class UpdateTournament
|
||||
{
|
||||
|
@ -106,6 +105,7 @@ class UpdateTournament
|
|||
$tournament->setInscriptionDate("$this->date_inscription $this->time_inscription");
|
||||
$tournament->setSolutionsDate("$this->date_solutions $this->time_solutions");
|
||||
$tournament->setSynthesesDate("$this->date_syntheses $this->time_syntheses");
|
||||
$tournament->setDescription($this->description);
|
||||
|
||||
foreach ($this->organizers as $organizer) {
|
||||
if (!$tournament->organize($organizer->getId()))
|
||||
|
|
|
@ -18,7 +18,7 @@ if (isset($tournament) && !$has_error) { ?>
|
|||
<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À-ÿ ]+"
|
||||
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ\- ]+"
|
||||
value="<?php if (isset($tournament)) echo $tournament->name ?>" required/>
|
||||
</div>
|
||||
|
||||
|
@ -34,8 +34,8 @@ if (isset($tournament) && !$has_error) { ?>
|
|||
<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";
|
||||
foreach (User::getOrganizers() as $organizer) {
|
||||
echo "<option value=\"" . $organizer->getId(). "\">" . $organizer->getFirstName() . " " . $organizer->getSurname() . "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
@ -60,12 +60,12 @@ if (isset($tournament) && !$has_error) { ?>
|
|||
<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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->date_start : 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->date_end : date('Y-m-d') ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -73,30 +73,30 @@ if (isset($tournament) && !$has_error) { ?>
|
|||
<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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->date_inscription : 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->time_inscription : 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->date_solutions : 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->time_solutions: 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->date_syntheses : 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') ?>"/>
|
||||
value="<?= isset($tournament) ? $tournament->time_syntheses : 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>
|
||||
<textarea class="form-control" id="description" name="description"><?= isset($tournament) ? $tournament->description : "" ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -30,8 +30,10 @@
|
|||
<a class="nav-link" href="/tournois">Liste des tournois</a>
|
||||
<?php if ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER) { ?>
|
||||
<ul class="deroule">
|
||||
<li class="nav-item active"><a class="nav-link" href="/profils-orphelins">Profils orphelins</a></li>
|
||||
<li class="nav-item active"><a class="nav-link" href="/profils">Tous les profils</a></li>
|
||||
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||
<li class="nav-item active"><a class="nav-link" href="/profils-orphelins">Profils orphelins</a></li>
|
||||
<li class="nav-item active"><a class="nav-link" href="/profils">Tous les profils</a></li>
|
||||
<?php } ?>
|
||||
<li class="nav-item active"><a class="nav-link" href="/organisateurs">Organisateurs</a></li>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
|
|
|
@ -66,17 +66,21 @@ if (!$has_error) {
|
|||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Date de naissance :</strong> <?= formatDate($user->getBirthDate()) ?><br />
|
||||
</div>
|
||||
<?php
|
||||
if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) {
|
||||
?>
|
||||
<div class="alert alert-info">
|
||||
<strong>Date de naissance :</strong> <?= formatDate($user->getBirthDate()) ?><br />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Sexe :</strong> <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
|
||||
</div>
|
||||
<div class="alert alert-info">
|
||||
<strong>Sexe :</strong> <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Adresse :</strong> <?= $user->getAddress() . ", " . $user->getPostalCode() . " " . $user->getCity() . ($user->getCountry() == "France" ? "" : ", " . $user->getCountry()) ?><br />
|
||||
</div>
|
||||
<div class="alert alert-info">
|
||||
<strong>Adresse :</strong> <?= $user->getAddress() . ", " . $user->getPostalCode() . " " . $user->getCity() . ($user->getCountry() == "France" ? "" : ", " . $user->getCountry()) ?><br />
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Adresse e-mail :</strong> <a href="mailto:<?= $user->getEmail() ?>"><?= $user->getEmail() ?></a><br />
|
||||
|
@ -156,7 +160,7 @@ if (!$has_error) {
|
|||
<?php }
|
||||
|
||||
if ($user->getRole() == Role::ADMIN || $user->getRole() == Role::ORGANIZER) {
|
||||
foreach ($tournaments as $tournament) {
|
||||
foreach ($user->getOrganizedTournaments() as $tournament) {
|
||||
echo "<div class=\"alert alert-info\">Organise le tournoi <a href=\"/tournoi/" . $tournament->getName(). "\">" . $tournament->getName() . "</a></div>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,9 +135,9 @@ else {
|
|||
<label for="organizers">Organisateur·s :</label>
|
||||
<select class="custom-select" id="organizers" name="organizers[]" multiple size="4" required>
|
||||
<?php
|
||||
while (($orga_data = $orgas_response->fetch()) !== FALSE) {
|
||||
echo "<option value=\"" . $orga_data["id"] . "\" " . ($tournament->organize($orga_data["id"]) ? "selected" : "")
|
||||
. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
|
||||
foreach (User::getOrganizers() as $orga) {
|
||||
echo "<option value=\"" . $orga->getId() . "\" " . ($tournament->organize($orga->getId()) ? "selected" : "")
|
||||
. ">" . $orga->getFirstName() . " " . $orga->getSurname() . "</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
<a href="/tournoi/<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a>
|
||||
</th>
|
||||
<td>Du <?= formatDate($tournament->getStartDate()) ?> au <?= formatDate($tournament->getEndDate()) ?></td>
|
||||
<td><?= formatDate($tournament->getInscriptionDate()) ?></td>
|
||||
<td><?= formatDate($tournament->getSolutionsDate()) ?></td>
|
||||
<td><?= formatDate($tournament->getSynthesesDate()) ?></td>
|
||||
<td><?= $tournament->getSize() ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue