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 "
"; + + } public function correct_lessons(){