Merge branch 'excel-import'
This commit is contained in:
commit
f0a2e57394
|
@ -61,6 +61,16 @@ class excelController
|
||||||
* declare the lambda that will add finalized UE to the array
|
* declare the lambda that will add finalized UE to the array
|
||||||
*/
|
*/
|
||||||
$addEU = function() use (&$UECode,&$allUE,&$UE){
|
$addEU = function() use (&$UECode,&$allUE,&$UE){
|
||||||
|
//determine if UE is disabled (if cours+td+tp = 0)
|
||||||
|
$totalVH = 0;
|
||||||
|
foreach ($UE["groups"] as $groups){
|
||||||
|
foreach ($groups as $group){
|
||||||
|
$totalVH += $group["VH"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$UE["disabled"] = $totalVH == 0;
|
||||||
|
|
||||||
if($UECode != ""){
|
if($UECode != ""){
|
||||||
if(isset($allUE[$UECode])){
|
if(isset($allUE[$UECode])){
|
||||||
$counter = 1;
|
$counter = 1;
|
||||||
|
@ -352,7 +362,7 @@ class excelController
|
||||||
$UE["CourseVH"],
|
$UE["CourseVH"],
|
||||||
$UE["TdVH"],
|
$UE["TdVH"],
|
||||||
$UE["TpVH"],
|
$UE["TpVH"],
|
||||||
false,
|
$UE["disabled"],
|
||||||
$UE["defaultFormationId"]
|
$UE["defaultFormationId"]
|
||||||
);
|
);
|
||||||
if(isset($UE["groups"])){
|
if(isset($UE["groups"])){
|
||||||
|
@ -369,19 +379,19 @@ class excelController
|
||||||
case "Course":
|
case "Course":
|
||||||
$coursRepo->create( $codeUE,
|
$coursRepo->create( $codeUE,
|
||||||
$allProf[$group["professor"]]["dbId"],
|
$allProf[$group["professor"]]["dbId"],
|
||||||
$group["VH"],
|
$UE["disabled"] ? $UE["CourseVH"] : $group["VH"],
|
||||||
$formations);
|
$formations);
|
||||||
break;
|
break;
|
||||||
case "TD":
|
case "TD":
|
||||||
$tdRepo->create($codeUE,
|
$tdRepo->create($codeUE,
|
||||||
$allProf[$group["professor"]]["dbId"],
|
$allProf[$group["professor"]]["dbId"],
|
||||||
$group["VH"],
|
$UE["disabled"] ? $UE["TdVH"] : $group["VH"],
|
||||||
$formations);
|
$formations);
|
||||||
break;
|
break;
|
||||||
case "TP":
|
case "TP":
|
||||||
$tpRepo->create($codeUE,
|
$tpRepo->create($codeUE,
|
||||||
$allProf[$group["professor"]]["dbId"],
|
$allProf[$group["professor"]]["dbId"],
|
||||||
$group["VH"],
|
$UE["disabled"] ? $UE["TpVH"] : $group["VH"],
|
||||||
$formations);
|
$formations);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,26 @@ class category extends Repo_i{
|
||||||
public function getStats(?int $id = null){
|
public function getStats(?int $id = null){
|
||||||
$st = $this->pdo->prepare("SELECT VHCours, VHTd, VHTp, Cat.idCategorie idCat, count(P.idProfesseur) nbrProf, Cat.labelCategorie labelCat
|
$st = $this->pdo->prepare("SELECT VHCours, VHTd, VHTp, Cat.idCategorie idCat, count(P.idProfesseur) nbrProf, Cat.labelCategorie labelCat
|
||||||
FROM Categorie Cat
|
FROM Categorie Cat
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.Categorie_idCategorie idCat FROM Professeur Prof LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur GROUP BY Prof.Categorie_idCategorie) VHCours ON VHCours.idCat = Cat.idCategorie
|
LEFT JOIN (SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.Categorie_idCategorie idCat
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.Categorie_idCategorie idCat FROM Professeur Prof LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur GROUP BY Prof.Categorie_idCategorie) VHTd ON VHTd.idCat = Cat.idCategorie
|
FROM Professeur Prof
|
||||||
LEFT JOIN (SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.Categorie_idCategorie idCat FROM Professeur Prof LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur GROUP BY Prof.Categorie_idCategorie) VHTp ON VHTp.idCat = Cat.idCategorie
|
LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur
|
||||||
|
JOIN UE U ON Cours.UE_code = U.code
|
||||||
|
WHERE U.disabled = 0
|
||||||
|
GROUP BY Prof.Categorie_idCategorie) VHCours ON VHCours.idCat = Cat.idCategorie
|
||||||
|
|
||||||
|
LEFT JOIN (SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.Categorie_idCategorie idCat
|
||||||
|
FROM Professeur Prof
|
||||||
|
LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
|
JOIN UE U2 ON TD.UE_code = U2.code
|
||||||
|
WHERE U2.disabled = 0
|
||||||
|
GROUP BY Prof.Categorie_idCategorie) VHTd ON VHTd.idCat = Cat.idCategorie
|
||||||
|
|
||||||
|
LEFT JOIN (SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.Categorie_idCategorie idCat
|
||||||
|
FROM Professeur Prof
|
||||||
|
LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
|
JOIN UE U3 ON TP.UE_code = U3.code
|
||||||
|
WHERE U3.disabled = 0
|
||||||
|
GROUP BY Prof.Categorie_idCategorie) VHTp ON VHTp.idCat = Cat.idCategorie
|
||||||
LEFT JOIN Professeur P ON Cat.idCategorie = P.Categorie_idCategorie
|
LEFT JOIN Professeur P ON Cat.idCategorie = P.Categorie_idCategorie
|
||||||
".($id ? " WHERE Cat.idCategorie = :idCat" : "")."
|
".($id ? " WHERE Cat.idCategorie = :idCat" : "")."
|
||||||
GROUP BY Cat.idCategorie;");
|
GROUP BY Cat.idCategorie;");
|
||||||
|
|
|
@ -259,9 +259,26 @@ class professor extends Repo_i {
|
||||||
FROM
|
FROM
|
||||||
Professeur Prof,
|
Professeur Prof,
|
||||||
Categorie Cat,
|
Categorie Cat,
|
||||||
(SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.idProfesseur idProf FROM Professeur Prof LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur GROUP BY Prof.idProfesseur) VHCours,
|
(SELECT IFNULL(SUM(Cours.volume),0) VHCours, Prof.idProfesseur idProf
|
||||||
(SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.idProfesseur idProf FROM Professeur Prof LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur GROUP BY Prof.idProfesseur) VHTd,
|
FROM Professeur Prof
|
||||||
(SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.idProfesseur idProf FROM Professeur Prof LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur GROUP BY Prof.idProfesseur) VHTp
|
LEFT JOIN Cours ON Prof.idProfesseur = Cours.Professeur_idProfesseur
|
||||||
|
JOIN UE U ON Cours.UE_code = U.code
|
||||||
|
WHERE U.disabled = 0
|
||||||
|
GROUP BY Prof.idProfesseur) VHCours,
|
||||||
|
|
||||||
|
(SELECT IFNULL(SUM(TD.volume),0) VHTd , Prof.idProfesseur idProf
|
||||||
|
FROM Professeur Prof
|
||||||
|
LEFT JOIN TD ON TD.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
|
JOIN UE U2 ON TD.UE_code = U2.code
|
||||||
|
WHERE U2.disabled = 0
|
||||||
|
GROUP BY Prof.idProfesseur) VHTd,
|
||||||
|
|
||||||
|
(SELECT IFNULL(SUM(TP.volume),0) VHTp, Prof.idProfesseur idProf
|
||||||
|
FROM Professeur Prof
|
||||||
|
LEFT JOIN TP ON TP.Professeur_idProfesseur = Prof.idProfesseur
|
||||||
|
JOIN UE U3 ON TP.UE_code = U3.code
|
||||||
|
WHERE U3.disabled = 0
|
||||||
|
GROUP BY Prof.idProfesseur) VHTp
|
||||||
|
|
||||||
WHERE $cond Prof.Categorie_idCategorie = Cat.idCategorie
|
WHERE $cond Prof.Categorie_idCategorie = Cat.idCategorie
|
||||||
AND VHCours.idProf = Prof.idProfesseur
|
AND VHCours.idProf = Prof.idProfesseur
|
||||||
|
|
Loading…
Reference in New Issue