Corrections mineures

This commit is contained in:
galaxyoyo 2019-09-25 01:15:03 +02:00
parent 2b1bb79efb
commit 6bb27034ce
6 changed files with 25 additions and 52 deletions

View File

@ -3,7 +3,6 @@
require_once "server_files/config.php";
require_once "server_files/classes/Document.php";
require_once "server_files/classes/DocumentType.php";
require_once "server_files/classes/Phase.php";
require_once "server_files/classes/Question.php";
require_once "server_files/classes/Reason.php";

View File

@ -6,7 +6,6 @@ class Document
private $user_id;
private $team_id;
private $problem;
private $type;
private $uploaded_at;
private $version;
@ -38,7 +37,6 @@ class Document
$this->user_id = $data["user"];
$this->team_id = $data["team"];
$this->problem = $data["problem"];
$this->type = DocumentType::fromName($data["type"]);
$this->uploaded_at = $data["uploaded_at"];
$this->version = isset($data["version"]) ? $data["version"] : 1;
}
@ -63,11 +61,6 @@ class Document
return $this->problem;
}
public function getType()
{
return $this->type;
}
public function getUploadedAt()
{
return $this->uploaded_at;
@ -86,7 +79,7 @@ class Document
$req = $DB->query("SELECT * FROM `documents` AS `t1` "
. "INNER JOIN (SELECT `user`, `problem`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `documents` GROUP BY `problem`, `user`) `t2` "
. "ON `t1`.`user` = `t2`.`user` AND `t1`.`problem` = `t2`.`problem` "
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`problem` = $problem " . ($team_id >= 0 ? "AND `team` = $team_id" : "") . " ORDER BY `t1`.`type`;");
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`problem` = $problem " . ($team_id >= 0 ? "AND `team` = $team_id" : "") . ";");
$docs = [];

View File

@ -1,28 +0,0 @@
<?php
class DocumentType
{
const PHOTO_CONSENT = 0;
public static function getTranslatedName($type) {
switch ($type) {
default:
return "Autorisation de droit à l'image";
}
}
public static function getName($type) {
switch ($type) {
default:
return "PHOTO_CONSENT";
}
}
public static function fromName($name) {
switch ($name) {
default:
return self::PHOTO_CONSENT;
}
}
}

View File

@ -121,7 +121,7 @@ function printDocuments($documents)
$user = User::fromId($document->getUserId());
$surname = $user->getSurname();
$first_name = $user->getFirstName();
$name = DocumentType::getTranslatedName($document->getType());
$name = "Autorisation de droit à l'image";
$version = $document->getVersion();
echo "$name de $first_name $surname (version $version) : <a href=\"/file/$file_id\"><strong>Télécharger</strong></a><br />\n";
}

View File

@ -4,7 +4,7 @@
Nom de l'équipe : <?= $team->getName() ?><br/>
Trigramme : <?= $team->getTrigram() ?><br/>
Problème : <a href="/problem/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a><br/>
Problème : <a href="/probleme/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a><br/>
<?php
if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId());

View File

@ -1,35 +1,44 @@
<?php require_once "header.php" ?>
<div class="mt-4 mb-4">
<h1 class="display-4"><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
</div>
<div class="mt-4 mb-4">
<h1 class="display-4"><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
</div>
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<div class="alert alert-info">
<strong>Équipe :</strong> <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">"
. $team->getName() . " (" . $team->getTrigram() . ")</a>" ?>
<div class="alert alert-info">
<strong>Équipe
:</strong> <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">"
. $team->getName() . " (" . $team->getTrigram() . ")</a>" ?>
</div>
<?php } ?>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
<div class="alert alert-info">
<strong>Lycée :</strong> <?= $user->getSchool() ?><br />
<strong>Lycée :</strong> <?= $user->getSchool() ?><br/>
<strong>Classe :</strong> <?= SchoolClass::getTranslatedName($user->getClass()) ?>
</div>
<?php } elseif ($user->getDescription() != "") { ?>
<div class="alert alert-info">
<div class="alert alert-info">
<strong>Description :</strong> <?= $user->getDescription() ?>
</div>
<?php }
<?php } ?>
echo "<hr />";
<div class="alert alert-info">
<strong>Adresse e-mail :</strong> <a href="mailto:<?= $user->getEmail() ?>"><?= $user->getEmail() ?></a>
</div>
if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<div class="alert alert-info">
<strong>Autorise Animath à envoyer des mails :</strong> <?= $user->doReceiveAnimathMails() ? "oui" : "non" ?>
</div>
<hr/>
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<div class="mt-4 mb-4">
<h1 class="display-5">Autorisation de droit à l'image :</h1>
</div>
<?php
printDocuments($documents);
<?php
printDocuments($documents);
}
require_once "footer.php";