public function action_edit($id = 0) { $data["forum"] = Model_Forum::find($id); if ($data["forum"] == null) { $data["forum"] = Model_Forum::forge(); } // add if (Input::post("title", "") != "" and Security::check_token()) { // save $data["forum"]->title = Input::post("title", ""); $data["forum"]->body = Input::post("body", ""); if ($id == 0) { $data["forum"]->user_id = $this->user->id; } $data["forum"]->save(); Response::redirect("/teachers/forum/"); } $view = View::forge("teachers/forum/edit", $data); $this->template->content = $view; }
public function action_edit($id = 0) { $data["forum"] = Model_Forum::find($id); $data['pasts'] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]); $data["donetrial"] = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", -1)], ["deleted_at", 0]]]); if ($data["forum"] == null) { $data["forum"] = Model_Forum::forge(); } // add if (Input::post("title", "") != "" and Security::check_token()) { // save $data["forum"]->title = Input::post("title", ""); $data["forum"]->body = Input::post("body", ""); if ($id == 0) { $data["forum"]->user_id = $this->user->id; } $data["forum"]->save(); Response::redirect("/students/forum/"); } $data["user"] = $this->user; $view = View::forge("students/forum/edit", $data); $this->template->content = $view; }