fix [modules.json] format + fix 'teacher/pdf' to return data even if no formation is found (+remove dumb data from pdf)

This commit is contained in:
xdrm-brackets 2018-05-14 12:03:11 +02:00
parent cfb9e0df23
commit 1bfd97009e
2 changed files with 23 additions and 31 deletions

View File

@ -132,7 +132,7 @@ class pdfController{
$fetched = $form_repo->get(null); $fetched = $form_repo->get(null);
/* (2) Error: no formation found */ /* (2) Error: no formation found */
if( count($fetched) < 1 ) if( !is_array($fetched) )
return ['error' => new Error(Err::RepoError)]; return ['error' => new Error(Err::RepoError)];
/* (3) Reference formations by key = idForm */ /* (3) Reference formations by key = idForm */
@ -285,10 +285,6 @@ class pdfController{
Il est à noter qu\'elle contient les données générées au '.$date.'. Elle peut ne plus être à jour. Il est à noter qu\'elle contient les données générées au '.$date.'. Elle peut ne plus être à jour.
</blockquote> </blockquote>
<p>
Si un problème persiste veuillez contacter les responsables à l\'addresse mail suivante <span style="color: red;">&lt;mail_display_error&gt;</span>.
</p>
<br><br><br> <br><br><br>
@ -317,12 +313,12 @@ class pdfController{
</tr> </tr>
<tr> <tr>
<td class="ar">Heures manquantes</td> <td class="ar">Sous service</td>
<td>'.( $missing_h>0 ? "$svg_warning $missing_h" : $missing_h).' h</td> <td>'.( $missing_h>0 ? "$svg_warning $missing_h" : $missing_h).' h</td>
</tr> </tr>
<tr> <tr>
<td class="ar">Heures sup.</td> <td class="ar">Sur service</td>
<td>'.$sup_h.' h</td> <td>'.$sup_h.' h</td>
</tr> </tr>
</tbody> </tbody>
@ -352,10 +348,6 @@ class pdfController{
Il est à noter qu\'elle contient les données générées au '.$date.'. Elle peut ne plus être à jour. Il est à noter qu\'elle contient les données générées au '.$date.'. Elle peut ne plus être à jour.
</blockquote> </blockquote>
<p>
Si un problème persiste veuillez contacter les responsables à l\'addresse mail suivante <span style="color: red;">&lt;mail_display_error&gt;</span>.
</p>
<br><br><br> <br><br><br>
<table> <table>

View File

@ -96,7 +96,7 @@
"par": { "par": {
"URL0": {"des": "Department id", "typ": "id", "ren": "department" } "URL0": {"des": "Department id", "typ": "id", "ren": "department" }
}, },
"output": { "out": {
"switched": { "des": "Whether the department has been switched", "typ": "bool" } "switched": { "des": "Whether the department has been switched", "typ": "bool" }
} }
@ -133,7 +133,7 @@
"par": { "par": {
"URL0": { "des": "The version id", "typ": "id", "ren": "version" } "URL0": { "des": "The version id", "typ": "id", "ren": "version" }
}, },
"output": { "out": {
"sucess": { "des": "success of the operation", "typ": "bool" } "sucess": { "des": "success of the operation", "typ": "bool" }
} }
} }
@ -142,7 +142,7 @@
"des": "Get the list of the versions of the department", "des": "Get the list of the versions of the department",
"per": [["cas_admin"]], "per": [["cas_admin"]],
"par": {}, "par": {},
"output": { "out": {
"versions": { "des": "List of available versions", "typ": "array" } "versions": { "des": "List of available versions", "typ": "array" }
} }
}, },
@ -150,9 +150,9 @@
"des": "Create a backup if the name is empty, execute the backup if the name is set", "des": "Create a backup if the name is empty, execute the backup if the name is set",
"per": [["cas_admin"]], "per": [["cas_admin"]],
"par": { "par": {
"label": { "des": "Label of the version","typ": "text"} "label": { "des": "Label of the version", "typ": "text" }
}, },
"output": { "out": {
"created_id": { "des": "The id of the created version", "typ": "varchar(10,10,alphanumeric)" } "created_id": { "des": "The id of the created version", "typ": "varchar(10,10,alphanumeric)" }
} }
}, },
@ -160,11 +160,11 @@
"des": "Update a version and switch to this version", "des": "Update a version and switch to this version",
"per": [["cas_admin"]], "per": [["cas_admin"]],
"par": { "par": {
"URL0": { "des": "id of the version","typ": "id","ren": "version"}, "URL0": { "des": "id of the version", "typ": "id", "ren": "version" },
"label" : { "des": "Label de la version", "typ": "text", "opt":true}, "label": { "des": "Label de la version", "typ": "text", "opt": true },
"default": { "des": "true if this version is the one that should be used by default on login", "typ": "bool","opt":true} "default": { "des": "Whether this version should be used on login", "typ": "bool", "opt": true }
}, },
"output": { "out": {
"updated": { "des": "Whether the version has been switched|applied", "typ": "bool" } "updated": { "des": "Whether the version has been switched|applied", "typ": "bool" }
} }
}, },
@ -174,7 +174,7 @@
"par": { "par": {
"URL0": { "des": "The version id", "typ": "id", "ren": "version" } "URL0": { "des": "The version id", "typ": "id", "ren": "version" }
}, },
"output": { "out": {
"deleted": { "des": "Whether the version has been deleted", "typ": "bool" } "deleted": { "des": "Whether the version has been deleted", "typ": "bool" }
} }
} }
@ -261,7 +261,7 @@
"GET": { "GET": {
"des": "Get a professor's fiche", "des": "Get a professor's fiche",
"per": [["cas_admin"],["cas_user"]], "per": [["cas_admin"], ["cas_user"]],
"par": { "par": {
"URL0": { "des": "Optional professor UID.", "typ": "id", "ren": "prof_id" } "URL0": { "des": "Optional professor UID.", "typ": "id", "ren": "prof_id" }
}, },
@ -346,7 +346,7 @@
"volume": { "des": "Number of hours for Cours", "typ": "id", "opt": true, "def": 0 }, "volume": { "des": "Number of hours for Cours", "typ": "id", "opt": true, "def": 0 },
"formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] } "formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"created_id" : { "des": "The id of the created Cours", "typ": "id" }, "created_id" : { "des": "The id of the created Cours", "typ": "id" },
"formations" : { "des": "The ids of the linked formations", "typ": "array<id>" } "formations" : { "des": "The ids of the linked formations", "typ": "array<id>" }
} }
@ -370,7 +370,7 @@
"add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] }, "add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] },
"rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] } "rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"updated" : { "des": "Whether it has been updated", "typ": "bool" } "updated" : { "des": "Whether it has been updated", "typ": "bool" }
} }
}, },
@ -381,7 +381,7 @@
"par": { "par": {
"URL0": { "des": "Id of the Cours", "typ": "id", "ren": "idCours" } "URL0": { "des": "Id of the Cours", "typ": "id", "ren": "idCours" }
}, },
"output": { "out": {
"deleted" : { "des": "Whether it has been deleted", "typ": "bool" } "deleted" : { "des": "Whether it has been deleted", "typ": "bool" }
} }
} }
@ -399,7 +399,7 @@
"volume": { "des": "Number of hours for TD", "typ": "id", "opt": true, "def": 0 }, "volume": { "des": "Number of hours for TD", "typ": "id", "opt": true, "def": 0 },
"formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] } "formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"created_id" : { "des": "The id of the created TD", "typ": "id" }, "created_id" : { "des": "The id of the created TD", "typ": "id" },
"formations" : { "des": "The ids of the linked formations", "typ": "array<id>" } "formations" : { "des": "The ids of the linked formations", "typ": "array<id>" }
} }
@ -423,7 +423,7 @@
"add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] }, "add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] },
"rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] } "rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"updated" : { "des": "Whether it has been updated", "typ": "bool" } "updated" : { "des": "Whether it has been updated", "typ": "bool" }
} }
}, },
@ -434,7 +434,7 @@
"par": { "par": {
"URL0": { "des": "Id of the TD", "typ": "id", "ren": "idTD" } "URL0": { "des": "Id of the TD", "typ": "id", "ren": "idTD" }
}, },
"output": { "out": {
"deleted" : { "des": "Whether it has been deleted", "typ": "bool" } "deleted" : { "des": "Whether it has been deleted", "typ": "bool" }
} }
} }
@ -452,7 +452,7 @@
"volume": { "des": "Number of hours for TP", "typ": "id", "opt": true, "def": 0 }, "volume": { "des": "Number of hours for TP", "typ": "id", "opt": true, "def": 0 },
"formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] } "formations": { "des": "List of formations (ids)", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"created_id" : { "des": "The id of the created TP", "typ": "id" }, "created_id" : { "des": "The id of the created TP", "typ": "id" },
"formations" : { "des": "The ids of the linked formations", "typ": "array<id>" } "formations" : { "des": "The ids of the linked formations", "typ": "array<id>" }
} }
@ -476,7 +476,7 @@
"add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] }, "add_form": { "des": "Id of formations to add", "typ": "array<id>", "opt": true, "def": [] },
"rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] } "rem_form": { "des": "Id of formations to remove", "typ": "array<id>", "opt": true, "def": [] }
}, },
"output": { "out": {
"updated" : { "des": "Whether it has been updated", "typ": "bool" } "updated" : { "des": "Whether it has been updated", "typ": "bool" }
} }
}, },
@ -487,7 +487,7 @@
"par": { "par": {
"URL0": { "des": "Id of the TP", "typ": "id", "ren": "idTP" } "URL0": { "des": "Id of the TP", "typ": "id", "ren": "idTP" }
}, },
"output": { "out": {
"deleted" : { "des": "Whether it has been deleted", "typ": "bool" } "deleted" : { "des": "Whether it has been deleted", "typ": "bool" }
} }
} }