public function lampsAction() { require_once 'models/homeModel.php'; $model = new homeModel(); $this->_view->title = TITEL_LAMPS; if ($_POST['send'] == "adddevice") { $newDevice = $model->saveDevice($_POST); } if ($_POST['send'] == "editdevice") { $editDevice = $model->updateDevice($_POST); } $lights = $model->getAllDevices(); foreach ($lights as $lamp) { $arr['id'] = $lamp['id']; $arr['room_id'] = $lamp['room_id']; $arr['device'] = $lamp['device']; $arr['status'] = $lamp['status']; $arr['sunset'] = $lamp['sunset']; $arr['letter'] = $lamp['letter']; $arr['code'] = $lamp['code']; $arr['sort'] = $lamp['sort']; $arr['aktiv'] = $lamp['aktiv']; $arr['room'] = $model->getRoomNameById($lamp['room_id']); $array[] = $arr; } $this->_view->lampen = $array; $rooms = $model->getAllRooms(); $this->_view->rooms = $rooms; $this->_view->display('lamps/index.tpl.php'); }