Example #1
0
 public function action_index()
 {
     $year = Input::get("year", date("Y"));
     $month = Input::get("month", date("m"));
     $grade = Model_Grade::find("first", ["where" => [["year", $year], ["month", $month]]]);
     if ($grade == null) {
         $grade = Model_Grade::forge();
         $grade->year = $year;
         $grade->month = $month;
         $grade->grade_1 = Config::get("prices")[0];
         $grade->grade_2 = Config::get("prices")[1];
         $grade->grade_3 = Config::get("prices")[2];
         $grade->grade_4 = Config::get("prices")[3];
         $grade->grade_5 = Config::get("prices")[4];
         $grade->save();
     }
     $data["teachers"] = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]);
     foreach ($data["teachers"] as $teacher) {
         $teacher->count = Model_Lessontime::count(["where" => [["deleted_at", 0], ["teacher_id", $teacher->id], ["feedback", "<>", ""], ["freetime_at", ">=", strtotime("{$year}-{$month}-01")], ["freetime_at", "<", strtotime("{$year}-{$month}-01 +1 month")]]]);
     }
     $data["year"] = $year;
     $data["month"] = $month;
     $data["grade"] = $grade;
     $view = View::forge("admin/fee/index", $data);
     $this->template->content = $view;
 }
Example #2
0
 public function action_index()
 {
     $year = Input::get("year", null);
     if ($year == null) {
         $year = date("Y");
     }
     if (Input::post("month", null) != null) {
         $price = Model_Grade::forge();
         $price->year = $year;
         $price->month = Input::post("month", null);
         $price->grade_1 = Input::post("grade_1", 0);
         $price->grade_2 = Input::post("grade_2", 0);
         $price->grade_3 = Input::post("grade_3", 0);
         $price->grade_4 = Input::post("grade_4", 0);
         $price->grade_5 = Input::post("grade_5", 0);
         $price->save();
     }
     $data["prices"] = Model_Grade::find("all", ["where" => [["year", $year]]]);
     $view = View::forge("admin/prices/index", $data);
     $this->template->content = $view;
 }
Example #3
0
 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;
 }