public function post_add() { $attr = $this->slim->request->post(); $attr['pdf'] = $_FILES['pdf']; $form = new ECatalogForm($attr); if ($form->validate()) { $form->save(); $this->slim->redirect($this->slim->request()->getRootUri() . '/ecatalog'); } else { FlashSession::getInstance()->set("add_ecatalog_form_error", $form->error); echo $this->goBack(); exit; // $this->slim->render("ecatalog/add.php", ['form'=> $form]); } }
public function post_edit($id) { $attr = $this->slim->request->post(); $attr['id'] = $id; $form = new RoomForm($attr); if ($form->validate()) { $form->save(); $this->slim->redirect($this->slim->request()->getRootUri() . '/room'); } else { FlashSession::getInstance()->set("edit_room_form_error", $form->error); echo $this->goBack(); exit; // $this->slim->render("room/add.php", ['form'=> $form]); } }
public function post_edit($roomId, $id) { $attr = $this->slim->request->post(); $attr['picture'] = new \upload($_FILES['picture']); $attr['thumb'] = new \upload($_FILES['thumb']); $attr["room_id"] = $roomId; $attr['id'] = $id; $form = new PatternForm($attr); if ($form->validate()) { $form->save(); $this->slim->redirect($this->slim->request()->getRootUri() . '/room/' . $roomId . '/pattern'); } else { FlashSession::getInstance()->set("edit_room_pattern_form_error", $form->error); echo $this->goBack(); exit; // $this->slim->render("room/add.php", ['form'=> $form]); } }