diff --git a/build/router/controller/ics.php b/build/router/controller/ics.php
index 33b0145..fb0dfab 100644
--- a/build/router/controller/ics.php
+++ b/build/router/controller/ics.php
@@ -50,7 +50,7 @@
- public function info(){
+ public function lessons(){
/* [1] Get database data
=========================================================*/
@@ -65,7 +65,8 @@
- echo "
";
}
+ // todo
+ public function location(){}
- public function correct(){
+ public function correct_lessons(){
/* [1] Update data
@@ -114,7 +119,7 @@
/* [2] Update file one the fly
=========================================================*/
/* (1) Get corrections */
- $sqlr = DatabaseDriver::getPDO()->prepare("SELECT CONCAT(basename, color) as uid, name FROM event WHERE id_diplome = :idd");
+ $sqlr = DatabaseDriver::getPDO()->prepare("SELECT id_event, name FROM event WHERE id_diplome = :idd");
$sqlr->execute([ ':idd' => $this->diplome_id ]);
/* (2) Manage error */
@@ -125,7 +130,7 @@
$corrections = [];
foreach($fetched as $c)
- $corrections[$c['uid']] = $c['name'];
+ $corrections[$c['id_event']] = $c['name'];
/* (3) Get file pointer */
@@ -142,7 +147,7 @@
for( $l = 0 ; $l < count($line)-1 ; $l++ ){
// {1} If got the right pointer //
- if( preg_match('@^DESCRIPTION:(.+#[\da-f]{6})$@', $line[$l], $m) ){
+ if( preg_match('@^DESCRIPTION:event\@(\d+)$@', $line[$l], $m) ){
// {2} If is in the list of correction //
if( !isset($corrections[$m[1]]) )
@@ -162,6 +167,9 @@
header('Location: /');
}
+ // todo
+ public function correct_location(){}
+
/* POST-CALL
*
*/
diff --git a/build/router/controller/page.php b/build/router/controller/page.php
index 32937b8..2d3d90c 100644
--- a/build/router/controller/page.php
+++ b/build/router/controller/page.php
@@ -41,24 +41,35 @@
/* [2] Display the links
=========================================================*/
- echo "Diplome | Config | Link | Last Update |
";
+ echo "Diplome | Lessons' name | Location | Link | Last Update |
";
foreach($diplomes as $id=>$data){
$name = $data[0];
$upda = $data[1];
-
- echo "$name | ";
-
$URI = $_SERVER['REQUEST_URI'];
$url = $_SERVER['HTTP_HOST'].$URI."ics/$id.ics";
$link = __ROOT__."/tmp/$id.ics";
- echo "Correct | ";
+
+ // name
+ echo "
$name | ";
+
+ // link to correct lessons
+ echo "Correct | ";
echo "Correct | ";
+ echo "https://$url | ";
+
+ // update date
echo "$upda | ";
echo "
";
}
diff --git a/config/routes.json b/config/routes.json
index 9c7a4b2..25d7000 100644
--- a/config/routes.json
+++ b/config/routes.json
@@ -20,17 +20,33 @@
}
},
- "/info/{diplome_id}": {
+ "/location/{diplome_id}": {
"methods": ["GET"],
- "controller": "ics:info",
+ "controller": "ics:location",
"arguments": {
"diplome_id": "T\\d+"
}
},
- "/correct/{diplome_id}": {
+ "/lessons/{diplome_id}": {
+ "methods": ["GET"],
+ "controller": "ics:lessons",
+ "arguments": {
+ "diplome_id": "T\\d+"
+ }
+ },
+
+ "/xlessons/{diplome_id}": {
"methods": ["POST"],
- "controller": "ics:correct",
+ "controller": "ics:correct_lessons",
+ "arguments": {
+ "diplome_id": "T\\d+"
+ }
+ },
+
+ "/xlocation/{diplome_id}": {
+ "methods": ["POST"],
+ "controller": "ics:correct_location",
"arguments": {
"diplome_id": "T\\d+"
}