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; }
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_index() { $year = date("Y"); $month = date("m"); $price = Model_Grade::find("first", ["where" => [["year", $year], ["month", $month]]]); if ($price == null) { $price = Model_Grade::forge(); $price->year = $year; $price->month = $month; $price->grade_1 = Config::get("prices")[0]; $price->grade_2 = Config::get("prices")[1]; $price->grade_3 = Config::get("prices")[2]; $price->grade_4 = Config::get("prices")[3]; $price->grade_5 = Config::get("prices")[4]; $price->save(); } $data["ym"] = Input::get("ym", date("Y-m")); $data["contacts"] = Model_Contactforum::find("all", ["where" => [["deleted_at", 0]], "order_by" => [["id", "desc"]], "limit" => 5]); $data["payment"] = Model_Payment::find("all", ["where" => [["status", 0]], "order_by" => [["id", "desc"]], "limit" => 5]); $data["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["freetime_at", ">=", strtotime($data["ym"] . "-01")], ["freetime_at", "<", strtotime($data["ym"] . "-01 +1 month")], ["status", ">", 0], ["status", "<>", 3]], "order_by" => [["freetime_at", "asc"]]]); $view = View::forge("admin/top", $data); $this->template->content = $view; }