public function action_detail($id = 0)
 {
     $data["forum"] = Model_Contactforum::find($id);
     if ($data["forum"] == null) {
         Response::redirect("/admin/contactforum/");
     }
     if ($data["forum"]->is_read == 0) {
         $data["forum"]->is_read = 1;
         $data["forum"]->save();
     }
     if (Input::get("del_id", null) != null) {
         $del_comment = Model_Contactcomment::find(Input::get("del_id", 0));
         $del_comment->deleted_at = time();
         $del_comment->save();
     }
     // add
     if (Input::post("body", "") != "" and Security::check_token()) {
         // save
         $comment = Model_Contactcomment::forge();
         $comment->body = Input::post("body", "");
         $comment->contactforum_id = $id;
         $comment->user_id = $this->user->id;
         $comment->save();
     }
     $view = View::forge("admin/contacts/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_Contactforum::find($id);
     if ($data["forum"] == null) {
         Response::redirect("/students/contactforum/");
     }
     if (Input::get("del_id", null) != null) {
         $del_comment = Model_Contactcomment::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_Contactcomment::forge();
         $comment->body = Input::post("body", "");
         $comment->contactforum_id = $id;
         $comment->user_id = $this->user->id;
         $comment->save();
         $data["forum"]->is_read = 0;
         $data["forum"]->save();
     }
     $data["user"] = $this->user;
     $view = View::forge("students/contacts/forum/detail", $data);
     $this->template->content = $view;
 }