mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 06:22:22 +00:00
Support des lettres de motivation
This commit is contained in:
parent
b9299a31d0
commit
7d6e899f76
@ -271,6 +271,7 @@ class DocumentType
|
|||||||
const SOLUTION = 3;
|
const SOLUTION = 3;
|
||||||
const SYNTHESIS = 4;
|
const SYNTHESIS = 4;
|
||||||
const SCHOLARSHIP = 5;
|
const SCHOLARSHIP = 5;
|
||||||
|
const MOTIVATION_LETTER = 6;
|
||||||
|
|
||||||
public static function getTranslatedName($type) {
|
public static function getTranslatedName($type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -282,6 +283,8 @@ class DocumentType
|
|||||||
return "Fiche sanitaire";
|
return "Fiche sanitaire";
|
||||||
case self::SCHOLARSHIP:
|
case self::SCHOLARSHIP:
|
||||||
return "Notification de bourse";
|
return "Notification de bourse";
|
||||||
|
case self::MOTIVATION_LETTER:
|
||||||
|
return "Lettre de motivation";
|
||||||
case self::SOLUTION:
|
case self::SOLUTION:
|
||||||
return "Solution";
|
return "Solution";
|
||||||
default:
|
default:
|
||||||
@ -299,6 +302,8 @@ class DocumentType
|
|||||||
return "SANITARY_PLUG";
|
return "SANITARY_PLUG";
|
||||||
case self::SCHOLARSHIP:
|
case self::SCHOLARSHIP:
|
||||||
return "SCHOLARSHIP";
|
return "SCHOLARSHIP";
|
||||||
|
case self::MOTIVATION_LETTER:
|
||||||
|
return "MOTIVATION_LETTER";
|
||||||
case self::SOLUTION:
|
case self::SOLUTION:
|
||||||
return "SOLUTION";
|
return "SOLUTION";
|
||||||
default:
|
default:
|
||||||
@ -316,6 +321,8 @@ class DocumentType
|
|||||||
return self::SANITARY_PLUG;
|
return self::SANITARY_PLUG;
|
||||||
case "SCHOLARSHIP":
|
case "SCHOLARSHIP":
|
||||||
return self::SCHOLARSHIP;
|
return self::SCHOLARSHIP;
|
||||||
|
case "MOTIVATION_LETTER":
|
||||||
|
return self::MOTIVATION_LETTER;
|
||||||
case "SOLUTION":
|
case "SOLUTION":
|
||||||
return self::SOLUTION;
|
return self::SOLUTION;
|
||||||
default:
|
default:
|
||||||
|
@ -435,6 +435,17 @@ class User
|
|||||||
while (($data = $req->fetch()) !== false)
|
while (($data = $req->fetch()) !== false)
|
||||||
$docs[] = Document::fromData($data);
|
$docs[] = Document::fromData($data);
|
||||||
|
|
||||||
|
if ($this->team_id > 0) {
|
||||||
|
$req = $DB->query("SELECT * FROM `documents` AS `t1` "
|
||||||
|
. "INNER JOIN (SELECT `user`, `type`, `tournament`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `documents` GROUP BY `tournament`, `type`, `user`) `t2` "
|
||||||
|
. "ON `t1`.`user` = `t2`.`user` AND `t1`.`type` = `t2`.`type` AND `t1`.`tournament` = `t2`.`tournament` "
|
||||||
|
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`tournament` = $tournament_id AND `t1`.`team` = $this->team_id "
|
||||||
|
. "AND `t1`.`type` = 'MOTIVATION_LETTER';");
|
||||||
|
|
||||||
|
while (($data = $req->fetch()) !== false)
|
||||||
|
$docs[] = Document::fromData($data);
|
||||||
|
}
|
||||||
|
|
||||||
return $docs;
|
return $docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,8 @@ class SendDocument
|
|||||||
|
|
||||||
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `tournament`, `type`)
|
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `tournament`, `type`)
|
||||||
VALUES (?, ?, ?, ?, ?);");
|
VALUES (?, ?, ?, ?, ?);");
|
||||||
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team"]->getId(), $_SESSION["team"]->isSelectedForFinal() ? $FINAL->getId() : $_SESSION["team"]->getTournamentId(), $this->type]);
|
$req->execute([$id, $this->type == DocumentType::getName(DocumentType::MOTIVATION_LETTER) ? -1 : $_SESSION["user_id"], $_SESSION["team"]->getId(),
|
||||||
|
$_SESSION["team"]->isSelectedForFinal() ? $FINAL->getId() : $_SESSION["team"]->getTournamentId(), $this->type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ if ($file !== null) {
|
|||||||
$user = User::fromId($file->getUserId());
|
$user = User::fromId($file->getUserId());
|
||||||
$type = $file->getType();
|
$type = $file->getType();
|
||||||
|
|
||||||
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && $user->getId() != $_SESSION["user_id"])
|
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT)) {
|
||||||
require_once "server_files/403.php";
|
if ($type != DocumentType::MOTIVATION_LETTER && $user->getId() != $_SESSION["user_id"] || $file->getTeamId() != $team->getId())
|
||||||
|
require_once "server_files/403.php";
|
||||||
|
}
|
||||||
|
|
||||||
$surname = $user->getSurname();
|
|
||||||
$first_name = $user->getFirstName();
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case DocumentType::PARENTAL_CONSENT:
|
case DocumentType::PARENTAL_CONSENT:
|
||||||
$name = "Autorisation parentale";
|
$name = "Autorisation parentale";
|
||||||
@ -67,7 +67,13 @@ if ($file !== null) {
|
|||||||
$name = "Notification de bourse";
|
$name = "Notification de bourse";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$name .= " de $first_name $surname.pdf";
|
if ($type == DocumentType::MOTIVATION_LETTER)
|
||||||
|
$name = "Lettre de motivation de l'équipe $trigram.pdf";
|
||||||
|
else {
|
||||||
|
$surname = $user->getSurname();
|
||||||
|
$first_name = $user->getFirstName();
|
||||||
|
$name .= " de $first_name $surname.pdf";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -136,6 +136,7 @@ function canValidate(Team $team, Tournament $tournament)
|
|||||||
$d = $req->fetch();
|
$d = $req->fetch();
|
||||||
$can_validate &= $d["version"] > 0;
|
$can_validate &= $d["version"] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 1; $i <= 6; ++$i) {
|
for ($i = 1; $i <= 6; ++$i) {
|
||||||
if ($team->getParticipants()[$i] === NULL)
|
if ($team->getParticipants()[$i] === NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -159,6 +160,11 @@ function canValidate(Team $team, Tournament $tournament)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `team` = ? AND `tournament` = ? AND `type` = ?;");
|
||||||
|
$req->execute([$team->getId(), $tournament->getId(), "MOTIVATION_LETTER"]);
|
||||||
|
$d = $req->fetch();
|
||||||
|
$can_validate &= $d["version"] > 0;
|
||||||
|
|
||||||
return $can_validate;
|
return $can_validate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,12 +178,20 @@ function printDocuments($documents)
|
|||||||
echo "<div class=\"alert alert-info\">\n";
|
echo "<div class=\"alert alert-info\">\n";
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $document) {
|
||||||
$file_id = $document->getFileId();
|
$file_id = $document->getFileId();
|
||||||
$user = User::fromId($document->getUserId());
|
|
||||||
$surname = $user->getSurname();
|
|
||||||
$first_name = $user->getFirstName();
|
|
||||||
$name = DocumentType::getTranslatedName($document->getType());
|
$name = DocumentType::getTranslatedName($document->getType());
|
||||||
$version = $document->getVersion();
|
$version = $document->getVersion();
|
||||||
echo "$name de $first_name $surname (version $version) : <a href=\"/file/$file_id\"><strong>Télécharger</strong></a><br />\n";
|
if ($document->getType() == DocumentType::MOTIVATION_LETTER) {
|
||||||
|
$team = Team::fromId($document->getTeamId());
|
||||||
|
echo "Lettre de motivation de l'équipe " . $team->getTrigram();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$user = User::fromId($document->getUserId());
|
||||||
|
$surname = $user->getSurname();
|
||||||
|
$first_name = $user->getFirstName();
|
||||||
|
echo "$name de $first_name $surname";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " (version $version) : <a href=\"/file/$file_id\"><strong>Télécharger</strong></a><br />\n";
|
||||||
}
|
}
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
@ -228,6 +242,12 @@ function getZipFile($document_type, $tournament_id, $team_id = -1)
|
|||||||
case DocumentType::PHOTO_CONSENT:
|
case DocumentType::PHOTO_CONSENT:
|
||||||
$name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";
|
$name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";
|
||||||
break;
|
break;
|
||||||
|
case DocumentType::SCHOLARSHIP:
|
||||||
|
$name = "Notification de bourse de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";
|
||||||
|
break;
|
||||||
|
case DocumentType::MOTIVATION_LETTER:
|
||||||
|
$name = "Lettre de motivation de l'équipe " . $team->getTrigram() . ".pdf";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$name = "Fiche sanitaire de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";
|
$name = "Fiche sanitaire de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";
|
||||||
break;
|
break;
|
||||||
|
@ -227,6 +227,7 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<option value="photo_consent">Autorisation de droit à l'image</option>
|
<option value="photo_consent">Autorisation de droit à l'image</option>
|
||||||
<option value="sanitary_plug">Fiche sanitaire</option>
|
<option value="sanitary_plug">Fiche sanitaire</option>
|
||||||
|
<option value="motivation_letter">Lettre de motivation (pour toute l'équipe)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -115,7 +115,7 @@ require_once "header.php";
|
|||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
Pour demander à valider votre équipe, vous devez avoir au moins un encadrant, quatre participants,
|
Pour demander à valider votre équipe, vous devez avoir au moins un encadrant, quatre participants,
|
||||||
choisi un problème et soumis une autorisation de droit à l'image, une fiche sanitaire et une autorisation
|
choisi un problème et soumis une autorisation de droit à l'image, une fiche sanitaire et une autorisation
|
||||||
parentale (si besoin) par participant.
|
parentale (si besoin) par participant, ainsi qu'une lettre de motivation à transmettre aux organisateurs.
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php }
|
<?php }
|
||||||
|
@ -23,7 +23,7 @@ if ($payment->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
|||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
<label for="method"><strong>Mode de paiement :</strong></label>
|
<label for="method"><strong>Mode de paiement :</strong></label>
|
||||||
<select class="custom-select" id="method" name="method">
|
<select class="custom-select" id="method" name="method" onchange="displayInfos()">
|
||||||
<?php
|
<?php
|
||||||
for ($method = PaymentMethod::NOT_PAID; $method <= PaymentMethod::SCHOLARSHIP; ++$method) {
|
for ($method = PaymentMethod::NOT_PAID; $method <= PaymentMethod::SCHOLARSHIP; ++$method) {
|
||||||
if ($method == PaymentMethod::CASH || $method == PaymentMethod::BANK_CHECK)
|
if ($method == PaymentMethod::CASH || $method == PaymentMethod::BANK_CHECK)
|
||||||
@ -32,13 +32,39 @@ if ($payment->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
|||||||
<option value="<?= strtolower(PaymentMethod::getName($method)) ?>"><?= PaymentMethod::getTranslatedName($method) ?></option>
|
<option value="<?= strtolower(PaymentMethod::getName($method)) ?>"><?= PaymentMethod::getTranslatedName($method) ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
<label for="infos"><strong>Informations sur le paiement :</strong></label>
|
<label id="infos_label" for="infos"><strong>Informations sur le paiement :</strong></label>
|
||||||
<textarea class="form-control" name="infos" id="infos"></textarea>
|
<textarea class="form-control" name="infos" id="infos"></textarea>
|
||||||
<label for="scholarship"><strong>Notification de bourse :</strong></label>
|
<label id="scholarship_label" for="scholarship"><strong>Notification de bourse :</strong></label>
|
||||||
<input type="file" class="form-control" name="scholarship" id="scholarship" />
|
<input type="file" class="form-control" name="scholarship" id="scholarship" />
|
||||||
<input class="btn btn-primary btn-block" type="submit" name="pay" value="Envoyer" />
|
<input class="btn btn-primary btn-block" type="submit" name="pay" value="Envoyer" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function displayInfos() {
|
||||||
|
console.log("value = " + document.getElementById("method").value);
|
||||||
|
switch (document.getElementById("method").value) {
|
||||||
|
case "scholarship":
|
||||||
|
document.getElementById("scholarship_label").style.display = "block";
|
||||||
|
document.getElementById("scholarship").style.display = "block";
|
||||||
|
document.getElementById("scholarship").require = "true";
|
||||||
|
document.getElementById("infos_label").style.display = "none";
|
||||||
|
document.getElementById("infos").style.display = "none";
|
||||||
|
document.getElementById("infos").require = "false";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
document.getElementById("scholarship_label").style.display = "none";
|
||||||
|
document.getElementById("scholarship").style.display = "none";
|
||||||
|
document.getElementById("scholarship").require = "false";
|
||||||
|
document.getElementById("infos_label").style.display = "block";
|
||||||
|
document.getElementById("infos").style.display = "block";
|
||||||
|
document.getElementById("infos").require = "true";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
displayInfos();
|
||||||
|
</script>
|
||||||
<?php } else {
|
<?php } else {
|
||||||
if ($payment->getValidationStatus() == ValidationStatus::WAITING) { ?>
|
if ($payment->getValidationStatus() == ValidationStatus::WAITING) { ?>
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
@ -62,6 +88,7 @@ if ($payment->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
|||||||
<strong>Informations sur le paiement :</strong> <?= $payment->getTransactionInfos() ?><br />
|
<strong>Informations sur le paiement :</strong> <?= $payment->getTransactionInfos() ?><br />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
require_once "footer.php";
|
require_once "footer.php";
|
Loading…
Reference in New Issue
Block a user