From ea2a254979cabc6d80e51f291c54106cceb657c6 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 15 Sep 2017 20:36:12 +0200 Subject: [PATCH] Location update (correct_location() todo) --- build/router/controller/ics.php | 61 ++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/build/router/controller/ics.php b/build/router/controller/ics.php index fb0dfab..d47aa7c 100644 --- a/build/router/controller/ics.php +++ b/build/router/controller/ics.php @@ -87,7 +87,66 @@ } // todo - public function location(){} + public function location(){ + + /* [1] Get events data + =========================================================*/ + /* (1) Get the list of available events */ + $sqlr = DatabaseDriver::getPDO()->prepare("SELECT * FROM event WHERE id_diplome = :idd"); + $sqlr->execute([ ':idd' => $this->diplome_id ]); + $events = $sqlr->fetchAll(); + + /* (2) Manage error */ + if( !$events ) + die("Correction not available for this diplome"); + + /* [2] Get location data + =========================================================*/ + foreach($events as &$event){ + + $event['location'] = []; + + /* (1) Get the list of available locations*/ + $sqlr = DatabaseDriver::getPDO()->prepare("SELECT * FROM location WHERE id_event = :ide"); + $sqlr->execute([ ':ide' => $event['id_event'] ]); + $locations = $sqlr->fetchAll(); + + if( !$locations ) + $locations = []; + + foreach($locations as $location) + $event['location'][] = $location; + + } + + + echo "
"; + echo ""; + + foreach($events as $event){ + + + foreach($event['location'] as $location){ + + $color = $event['color']; + $id = $location['id_location']; + $basename = $location['basename']; + $name = $location['name']; + $e_name = $event['name']; + + echo ""; + + } + + } + + echo "
LessonRead nameCorrection
$e_name$basename
"; + + echo ""; + + echo "
"; + + } public function correct_lessons(){