public function action_detail($id = 0) { $data["forum"] = Model_Forum::find($id); if ($data["forum"] == null) { Response::redirect("/teachers/forum/"); } if (Input::get("del_id", null) != null) { $del_comment = Model_Comment::find(Input::get("del_id", 0)); if ($del_comment->user_id == $this->user->id) { $del_comment->deleted_at = time(); $del_comment->save(); } } // add if (Input::post("body", "") != "" and Security::check_token()) { // save $comment = Model_Comment::forge(); $comment->body = Input::post("body", ""); $comment->forum_id = $id; $comment->user_id = $this->user->id; $comment->save(); } $data["user"] = $this->user; $view = View::forge("teachers/forum/detail", $data); $this->template->content = $view; }
public function action_detail($id = 0) { $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]]]); $data["forum"] = Model_Forum::find($id); if ($data["forum"] == null) { Response::redirect("/students/forum/"); } if (Input::get("del_id", null) != null) { $del_comment = Model_Comment::find(Input::get("del_id", 0)); if ($del_comment->user_id == $this->user->id) { $del_comment->deleted_at = time(); $del_comment->save(); } } // add if (Input::post("body", "") != "" and Security::check_token()) { // save $comment = Model_Comment::forge(); $comment->body = Input::post("body", ""); $comment->forum_id = $id; $comment->user_id = $this->user->id; $comment->save(); } $data["user"] = $this->user; $view = View::forge("students/forum/detail", $data); $this->template->content = $view; }
public function post_delforum() { $code = 0; $message = "ok"; if ($this->auth_status) { $forum = Model_Forum::find(Input::post("id", 0)); if ($forum != null) { $forum->deleted_at = time(); $forum->save(); } else { $code = 404; $message = "Content not found."; } } else { $code = 500; $message = "Auth error."; } $this->response(array('code' => $code, 'message' => $message)); }