1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-24 09:08:47 +02:00

Possibilité d'encadrer plusieurs équipes

This commit is contained in:
Yohann
2019-12-04 11:45:14 +01:00
parent 8fa1183f9f
commit 95d7f30536
20 changed files with 185 additions and 42 deletions

View File

@ -221,4 +221,20 @@ class Team
{
return $this->year;
}
public function getAllDocuments()
{
global $DB;
$req = $DB->query("SELECT * FROM `documents` AS `t1` "
. "INNER JOIN (SELECT `team`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`user`) AS `version` FROM `documents` GROUP BY `problem`, `user`, `team`) `t2` "
. "ON `t1`.`team` = `t2`.`team` "
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`team` = $this->id;");
$docs = [];
while (($data = $req->fetch()) !== false)
$docs[] = Document::fromData($data);
return $docs;
}
}

View File

@ -301,4 +301,18 @@ class User
return $docs;
}
// Seulement pour les encadrants
public function getTeams()
{
global $DB;
$req = $DB->query("SELECT `id` FROM `teams` WHERE `encadrant` = $this->id;");
$teams = [];
while (($data =$req->fetch()) !== false)
$teams[] = Team::fromId($data["id"]);
return $teams;
}
}