1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-01-07 14:22:22 +00:00

Un encandrant peut encadrer plusieurs équipes

This commit is contained in:
Yohann 2019-12-13 19:09:14 +01:00
parent ef505465d5
commit 79400ca298
8 changed files with 9 additions and 7 deletions

View File

@ -323,7 +323,7 @@ class User
public function getTeams()
{
global $DB;
$req = $DB->query("SELECT `id` FROM `teams` WHERE `encadrant` = $this->id;");
$req = $DB->query("SELECT `id` FROM `teams` WHERE `encadrant` = $this->id OR `participant_1` = $this->id OR `participant_2` = $this->id OR `participant_3` = $this->id OR `participant_4` = $this->id OR `participant_5` = $this->id;");
$teams = [];

View File

@ -13,7 +13,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
require_once "server_files/403.php";
if (isset($_POST["upload_answer"])) {

View File

@ -13,7 +13,7 @@ $user = $_SESSION["user"];
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
require_once "server_files/403.php";
$has_error = false;

View File

@ -15,6 +15,8 @@ if ($user === null)
require_once "server_files/404.php";
$teams = $user->getTeams();
if ($user->getRole() == Role::PARTICIPANT)
$team = sizeof($teams) == 0 ? null : $teams[0];
$has_error = false;
$error_message = null;

View File

@ -11,7 +11,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["teams"]) && sizeof($_SESSION
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId())
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId())
require_once "server_files/403.php";
$video = Video::getVideo(Reason::SOLUTION, $team);

View File

@ -49,7 +49,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["teams"]) && sizeof($_SESSION
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId())
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId())
require_once "server_files/403.php";
$documents = $team->getAllDocuments();

View File

@ -13,7 +13,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId())
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
require_once "server_files/403.php";
$has_error = false;

View File

@ -12,7 +12,7 @@ $team = $user->getRole() == Role::PARTICIPANT ? $_SESSION["team"] : Team::fromTr
if ($team == null)
require_once "server_files/404.php";
if ($team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
if ($user->getRole() == Role::ENCADRANT && $team->getEncadrantId() != $user->getId() || $team->getValidationStatus() != ValidationStatus::VALIDATED)
require_once "server_files/403.php";
$has_error = false;