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:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user