Location update (correct_location() todo)
This commit is contained in:
parent
cf15f3af1e
commit
ea2a254979
|
@ -87,7 +87,66 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo
|
// 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 "<form method='POST' action='/xlocation/".$this->diplome_id."'>";
|
||||||
|
echo "<table><thead style='font-weight: bold;'><tr><td>Lesson</td><td>Read name</td><td>Correction</td></tr></thead><tbody>";
|
||||||
|
|
||||||
|
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 "<tr><td><b>$e_name</b></td><td>$basename</td><td><input type='text' style='display: inline-block; margin: 1em .2em; padding: .2em; border: none; background-color: $color;' name='name[$id]' value='$name'></td></tr>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</tbody></table>";
|
||||||
|
|
||||||
|
echo "<input type='submit' value='SAVE'>";
|
||||||
|
|
||||||
|
echo "</form>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function correct_lessons(){
|
public function correct_lessons(){
|
||||||
|
|
Loading…
Reference in New Issue