Commit 0e973a68 authored by Georgios Tsakalos's avatar Georgios Tsakalos

update lab actions

parent 0ff299a3
......@@ -42,21 +42,24 @@ class ListAll
$staff = $this->staffservice->getTeachersBySchoolId($school->id);
$clean_staff = [];
foreach ($staff as $obj) {
if ($obj['is_responsible']) {
$clean_staff[] = [
'value' => $obj['id'],
'label' => $obj['name'] . " " . $obj['surname'],
];
}
$clean_staff[] = [
'value' => $obj['id'],
'label' => $obj['name'] . " " . $obj['surname'],
];
}
$courses = $this->labservice->getCourses();
$lessons = [];
foreach ($courses as $lesson) {
$lessons[] = ['value' => $lesson->id, 'label' => $lesson->name];
$lessons = $this->labservice->getLessons();
$lessons_formatted = [];
foreach ($lessons as $lesson) {
$lessons_formatted[] = ['value' => $lesson->id, 'label' => $lesson->name];
}
$labs_formatted = [];
foreach($labs as $lab) {
$lab['responsible'] = $lab['teacher_id'];
$labs_formatted[] = $lab;
}
return $this->view->render($res, 'schools/labs.twig', [
'labs' => $labs,
'labs' => $labs_formatted,
'staff' => $clean_staff,
'lab_types' => [
[
......@@ -72,7 +75,7 @@ class ListAll
'label' => 'ΓΡΑΦΕΙΟ',
],
],
'lessons' => $lessons,
'lessons' => $lessons_formatted,
]);
}
}
......@@ -35,16 +35,13 @@ class PersistLab
$params['school_id'] = $school->id;
$params['lessons'] = [1,2];
unset($params['id']);
try {
if ($id > 0) {
$id = $this->labservice->updateLab($params, $id);
$lab = $this->labservice->getLabById($id);
} else {
error_log(print_r('in else', TRUE));
$id = $this->labservice->createLab($params);
error_log(print_r('created lab', TRUE));
if ($id > 0) {
$lab = $this->labservice->getLabById($id);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment