diff --git a/build/database/repo/ue.php b/build/database/repo/ue.php index d9e6e0e..1f96004 100644 --- a/build/database/repo/ue.php +++ b/build/database/repo/ue.php @@ -179,10 +179,24 @@ class ue extends Repo_i { /* (2) Prepare Statement */ $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); - $st = $this->pdo->prepare("SELECT ue.code, ue.label, ue.disabled, ue.required, ue.volumeCours, ue.volumeTD, ue.volumeTP, IFNULL(ue.Formation_idFormation, -1) idForm, f.labelFormation labelForm + $st = $this->pdo->prepare("SELECT + ue.code, + ue.label, + ue.disabled, + ue.required, + ue.volumeCours, + ue.volumeTD, + ue.volumeTP, + IFNULL(ue.Formation_idFormation, -1) idForm, + f.labelFormation labelForm, + IFNULL(CONCAT('[', GROUP_CONCAT(fc.idForm, ',', ftd.idForm, ',', ftp.idForm), ']'), '[]') formations FROM `UE` ue LEFT JOIN Formation f ON ue.Formation_idFormation = f.idFormation + LEFT JOIN ( SELECT DISTINCT gc.Formation_idFormation idForm, c.UE_code as code FROM GroupeCours gc, Cours c WHERE gc.Cours_idCours = c.idCours GROUP BY gc.Formation_idFormation ) fc ON fc.code = ue.code + LEFT JOIN ( SELECT DISTINCT gtd.Formation_idFormation idForm, td.UE_code as code FROM GroupeTD gtd, TD td WHERE gtd.TD_idTD = td.idTD GROUP BY gtd.Formation_idFormation ) ftd ON ftd.code = ue.code + LEFT JOIN ( SELECT DISTINCT gtp.Formation_idFormation idForm, tp.UE_code as code FROM GroupeTP gtp, TP tp WHERE gtp.TP_idTP = tp.idTP GROUP BY gtp.Formation_idFormation ) ftp ON ftp.code = ue.code $cond + GROUP BY ue.code ORDER BY `ue`.`label` ASC"); /* (3) Bind params and execute statement */