private function getLabTypes()
 {
     return array_reduce($this->labService->getLabTypes(), function ($map, $type) {
         $map[trim($type['name'])] = $type['id'];
         return $map;
     }, []);
 }
Beispiel #2
0
 public function __invoke(Request $req, Response $res, array $args = [])
 {
     $school = $req->getAttribute('school', false);
     if (!$school) {
         return $res->withStatus(403, 'No school');
     }
     $labs = $this->labService->getLabsBySchoolId($school->id);
     return $this->view->render($res, 'schools/labs.twig', ['school' => $school, 'labs' => $labs, 'staff' => array_map(function ($teacher) {
         return ['value' => $teacher['id'], 'label' => $teacher['fullname']];
     }, $this->staffService->getTeachersBySchoolId($school->id)), 'network_options' => array_map(function ($option) {
         return ['value' => $option, 'label' => $option];
     }, $this->labService->getHasNetworkValues()), 'server_options' => array_map(function ($option) {
         return ['value' => $option, 'label' => $option];
     }, $this->labService->getHasServerValues()), 'lab_types' => array_map(function ($type) {
         return ['value' => $type['id'], 'label' => $type['name']];
     }, $this->labService->getLabTypes()), 'lessons_options' => array_map(function ($lesson) {
         return ['value' => $lesson['id'], 'label' => $lesson['name']];
     }, $this->labService->getLessons())]);
 }