public static function sendReservedEMail($id) { $reservation = Model_Lessontime::find($id); // for teacher $url = Uri::base() . "teachers/top"; date_default_timezone_set(Config::get("timezone.timezone")[$reservation->teacher->timezone]); $body = View::forge("email/teachers/reserved", ["url" => $url]); $body->set("name", $reservation->teacher->firstname); $body->set("reservation", $reservation); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($reservation->teacher->email); $sendmail->subject("Lesson Booking Confirmation / Game-bootcamp"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); // for student $url = Uri::base() . "students/top"; date_default_timezone_set(Config::get("timezone.timezone")[$reservation->student->timezone]); $body = View::forge("email/students/reserved", ["url" => $url]); $body->set("name", $reservation->student->firstname); $body->set("reservation", $reservation); $sendmail = Email::forge("JIS"); $sendmail->from(Config::get("statics.info_email"), Config::get("statics.info_name")); $sendmail->to($reservation->student->email); $sendmail->subject("Lesson Booking Confirmation / Game-bootcamp"); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); }
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 action_index() { $data["documents"] = Model_Document::find("all", ["where" => [["deleted_at", 0]], "order_by" => [["created_at", "desc"]]]); $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['user'] = $this->user; $view = View::forge("students/documents", $data); $this->template->content = $view; }
public function action_index() { if ($this->user->birthday == "0000-00-00") { Response::redirect("teachers/setting/new"); } $data["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["teacher_id", $this->user->id], ["status", 1], ["freetime_at", ">=", time()]], "order_by" => [["id", "desc"]]]); $data["feedbacks"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["teacher_id", $this->user->id], ["status", "<>", 0], ["status", "<>", 3], ["feedback", ""], ["freetime_at", "<=", time()]], "order_by" => [["id", "desc"]]]); $data["news"] = Model_News::find("all", ["where" => [["deleted_at", 0], ["for_teachers", 1]], "order_by" => [["id", "desc"]], "limit" => 5]); $data["user"] = $this->user; $view = View::forge("teachers/top", $data); $this->template->content = $view; }
public function action_detail($id = 0) { $teacher = Model_User::find($id); if ($teacher == null) { Response::redirect("_404_"); } $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["user"] = $teacher; $view = View::forge("students/teachers/detail", $data); $this->template->content = $view; }
public function action_index() { $data["trial"] = Model_Content::find("all", ["where" => [["type_id", -1], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]); $data["enchantJS"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]); $data["count_text_enchant"] = Model_Content::find("all", ["where" => [["type_id", 0], ["deleted_at", 0], ["text_type_id", 0]], "order_by" => [["number", "asc"], ["text_type_id", "asc"]]]); $data["user"] = $this->user; $data["count_enchant"] = Model_Lessontime::count(["where" => [["language", 0], ["student_id", $this->user->id], ["status", 2], ["deleted_at", 0]]]); $data["done_html"] = Model_Lessontime::count(["where" => [["student_id", $this->user->id], ["status", 2], ["language", 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]]]); $view = View::forge("students/textbooks", $data); $this->template->content = $view; }
public function action_index() { if ($this->user->birthday == "0000-00-00") { Response::redirect("students/setting/new"); } $data["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["student_id", $this->user->id], ["status", 1], ["freetime_at", ">=", time()]], "order_by" => [["id", "desc"]]]); $data["lastClass"] = Model_Lessontime::find("last", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]); $data["lesson"] = Model_Lessontime::find("first", ["where" => [["deleted_at", 0], ["student_id", $this->user->id], ["status", 1], ["freetime_at", "<=", time() + 1800], ["freetime_at", ">=", time() - 1800]]]); $data["news"] = Model_News::find("all", ["where" => [["deleted_at", 0], ["for_students", 1]], "order_by" => [["id", "desc"]], "limit" => 5]); $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["user"] = $this->user; $view = View::forge("students/top", $data); $this->template->content = $view; }
public function action_index() { $is_chenged = false; $data["password_error"] = ""; if (Input::post("place", null) !== null and Security::check_token()) { $this->user->place = Input::post("place", ""); $this->user->save(); $is_chenged = true; } if (Input::post("grameen_student", null) !== null and Security::check_token()) { $this->user->grameen_student = Input::post("grameen_student", ""); $this->user->save(); $is_chenged = true; } if (Input::post("timezone", null) !== null and Security::check_token()) { $this->user->timezone = Input::post("timezone", ""); $this->user->save(); $is_chenged = true; } if (Input::post("need_reservation_email", null) !== null and Security::check_token()) { $this->user->need_reservation_email = Input::post("need_reservation_email", 1); $this->user->need_news_email = Input::post("need_news_email", 1); $this->user->save(); $is_chenged = true; } if (Input::post("password", null) != null and Security::check_token()) { $val = Validation::forge(); $val->add_callable('passwordvalidation'); $val->add_field("password", Lang::get('forgotpassword.password'), "required|match_field[password2]|password"); $val->add_field("password2", Lang::get('forgotpassword.password'), "required|match_field[password]|password"); if ($val->run()) { $this->user->password = Auth::instance()->hash_password(Input::post('password', "")); $this->user->save(); $is_chenged = true; } else { $data["password_error"] = "password does not matched."; } } $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["user"] = $this->user; $data["is_chenged"] = $is_chenged; $view = View::forge("students/setting", $data); $this->template->content = $view; }
public function action_detail($id) { $data["news"] = Model_News::find($id, ["where" => [["deleted_at", 0], ["for_students", 1]]]); $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["news"] == null) { Response::redirect("students/news"); } $is_read = Model_Readnews::find("first", ["where" => [["user_id" => $this->user->id], ["news_id" => $id]]]); if ($is_read == null) { $is_read = Model_Readnews::forge(); $is_read->user_id = $this->user->id; $is_read->news_id = $id; $is_read->save(); } $data["user"] = $this->user; $view = View::forge("students/news/detail", $data); $this->template->content = $view; }
public function post_delreservation() { $code = 0; $message = "ok"; if ($this->auth_status) { $reservation = Model_Lessontime::find(Input::post("id", 0)); if ($reservation != null) { $reservation->deleted_at = time(); $reservation->save(); } else { $code = 404; $message = "Content not found."; } } else { $code = 500; $message = "Auth error."; } $this->response(array('code' => $code, 'message' => $message)); }
public function action_edit($id = 0) { $data["error"] = ""; $data["reservation"] = Model_Lessontime::find($id); if ($data["reservation"] == null) { Response::redirect("/admin/reservations"); } // add if (Input::post("teacher_id", null) != null and Security::check_token()) { $data["reservation"]->teacher_id = Input::post("teacher_id", 0); $data["reservation"]->student_id = Input::post("student_id", 0); $data["reservation"]->freetime_at = strtotime(Input::post("year", 0) . "-" . Input::post("month", 0) . "-" . Input::post("day", 0) . " " . Input::post("hour", 0) . ":00:00"); $data["reservation"]->language = Input::post("language", 0); if ($data["reservation"]->student_id == 0) { $data["reservation"]->status = 0; } else { $data["reservation"]->status = 1; $reserved = Model_Lessontime::find("all", ["where" => [["id", "<>", $data["reservation"]->id], ["student_id", $data["reservation"]->student_id], ["status", 1], ["deleted_at", 0]]]); if ($reserved == null) { $pasts = Model_Lessontime::find("all", ["where" => [["id", "<>", $data["reservation"]->id], ["student_id", $data["reservation"]->student_id], ["status", 2], ["language", Input::post("language", 0)]]]); if ($pasts == null) { $pasts = []; } $data["reservation"]->number = count($pasts) + 1; } else { $data["error"] = "this user already have lesson."; } } $data["reservation"]->url = Input::post("url", ""); if ($data["error"] == null) { $data["reservation"]->save(); if ($data["reservation"]->status == 1) { Model_Lessontime::sendReservedEMail($data["reservation"]->id); } Response::redirect("/admin/reservations/"); } } $data["teachers"] = Model_User::find("all", ["where" => [["group_id", 10], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]); $data["students"] = Model_User::find("all", ["where" => [["group_id", 1], ["deleted_at", 0]], "order_by" => [["id", "desc"]]]); $view = View::forge("admin/reservations/edit", $data); $this->template->content = $view; }
public function action_feedback($id = 0) { $data["reservation"] = Model_Lessontime::find($id); if ($data["reservation"] == null) { Response::redirect("_404_"); } if ($data["reservation"]->status != 1) { Response::redirect("_404_"); } // add if ($data["reservation"]->teacher_id == $this->user->id and Input::post("feedback", null) != null and Security::check_token()) { $data["reservation"]->feedback = Input::post("feedback", ""); $data["reservation"]->status = 2; $data["reservation"]->save(); $query = DB::update('reservation')->set(array('status' => 2))->where('edoo_tutor', $data["reservation"]->edoo_tutor)->where('freetime_at', $data["reservation"]->freetime_at)->where('student_id', $data["reservation"]->student_id)->execute('shared'); Response::redirect("/teachers/lesson/histories"); } $view = View::forge("teachers/lesson/feedback", $data); $this->template->content = $view; }
public function action_index() { $is_chenged = false; if (Input::post("firstname", null) != null and Security::check_token()) { $email = Input::post("email", null); if ($email != $this->user->email) { $check_user = Model_User::find("first", ["where" => [["email" => $email]]]); if ($check_user == null) { $this->email = $email; } else { $data["error"] = "This email is already in use."; } } $config = ["path" => DOCROOT . "assets/img/pictures/", 'randomize' => true, 'auto_rename' => true, 'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png')]; Upload::process($config); if (Upload::is_valid()) { Upload::save(); $saved_result = Upload::get_files(); $file_name = $saved_result[0]['saved_as']; $image = Image::load($config["path"] . $file_name); $image->crop_resize(200, 200)->save($config["path"] . "m_" . $file_name); $image->crop_resize(86, 86)->save($config["path"] . "s_" . $file_name); $this->user->img_path = $file_name; } else { $error = Upload::get_errors(); } if (!isset($data["error"])) { $this->user->firstname = Input::post("firstname", ""); $this->user->middlename = Input::post("middlename", ""); $this->user->lastname = Input::post("lastname", ""); $this->user->save(); $is_chenged = true; } } $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["user"] = $this->user; $data["is_chenged"] = $is_chenged; $view = View::forge("students/profile", $data); $this->template->content = $view; }
public function post_getreservation() { $code = 0; $message = "ok"; $reservation = null; if ($this->auth_status) { $reservation = Model_Lessontime::find("first", ["where" => [["deleted_at", 0], ["student_id", $this->user->id], ["status", 1], ["freetime_at", "<=", time() + 900], ["freetime_at", ">=", time() - 3000]]]); if ($reservation != null) { if ($reservation->freetime_at <= time() + 120) { $reservation->is_ready = true; } else { $reservation->is_ready = false; } } else { $code = 404; $message = "Reservation not found."; } } else { $code = 500; $message = "Auth error."; } $this->response(array('code' => $code, 'message' => $message, 'reservation' => $reservation)); }
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; }
public static function hour() { $reservations = \Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["status", 1], ["freetime_at", "<=", time() + 3600], ["freetime_at", ">=", time()]]]); foreach ($reservations as $reservation) { // for teacher $url = "http://game-bootcamp.com/teachers/top"; $body = \View::forge("email/teachers/reminder_1hour", ["url" => $url]); $sendmail = \Email::forge("JIS"); $sendmail->from(\Config::get("statics.info_email"), \Config::get("statics.info_name")); $sendmail->to($reservation->teacher->email); $sendmail->subject("Your lesson will start."); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); // for student $url = "http://game-bootcamp.com/students/top"; $body = \View::forge("email/students/reminder_1hour", ["url" => $url]); $sendmail = \Email::forge("JIS"); $sendmail->from(\Config::get("statics.info_email"), \Config::get("statics.info_name")); $sendmail->to($reservation->student->email); $sendmail->subject("Your lesson will start."); $sendmail->html_body(htmlspecialchars_decode($body)); $sendmail->send(); } }
<?php echo Html::anchor('/teachers/lesson/add', '<i class="fa fa-plus-circle"></i> '); ?> </div> <div class="profile"> <p class="name"><?php echo $name; ?> </p> <ul class="clearfix"> <li> <h3>This month</h3> <?php $year = date("Y"); $month = date("m"); $lessontimes = Model_Lessontime::find("all", ["where" => [["teacher_id", $this->user->id], ["deleted_at", 0], ["freetime_at", ">=", strtotime("{$year}-{$month}-01")], ["freetime_at", "<", strtotime("{$year}-{$month}-01 +1 month")]]]); $done = 0; $reserved = 0; foreach ($lessontimes as $lessontime) { if ($lessontime->status == 2) { $done++; } $reserved++; } $lastmonth = Model_Lessontime::count(["where" => [["teacher_id", $this->user->id], ["deleted_at", 0], ["status", 2], ["freetime_at", ">=", strtotime("{$year}-{$month}-01 -1 month")], ["freetime_at", "<", strtotime("{$year}-{$month}-01")]]]); ?> <span><?php echo $reserved; ?> </span> classes are reserved, <span><?php echo $done;
public function action_detail($id = 0) { $user = Model_User::find($id); if ($user == null) { Response::redirect("/admin/students"); } $data["user"] = $user; $data["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["student_id", $user->id], ["status", "<>", 0], ["freetime_at", "<", time()]], "order_by" => [["updated_at", "desc"]]]); $view = View::forge("admin/students/detail", $data); $this->template->content = $view; }
public function action_histories() { $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["reservations"] = Model_Lessontime::find("all", ["where" => [["deleted_at", 0], ["student_id", $this->user->id], ["status", "<>", 0], ["freetime_at", "<", time()]], "order_by" => [["updated_at", "desc"]]]); $config = array('pagination_url' => "", 'uri_segment' => "p", 'num_links' => 9, 'per_page' => 20, 'total_items' => count($data["reservations"])); $data["pager"] = Pagination::forge('mypagination', $config); $data["user"] = $this->user; $view = View::forge("students/lesson/histories", $data); $this->template->content = $view; }
<?php $html = Model_Lessontime::count(["where" => [["language", 0], ["student_id", $this->user->id], ["status", 2], ["deleted_at", 0]]]); ?> enchant.js Course (<?php echo $html; ?> /12) <?php } ?> </p> </div> <div class="reserve"> <?php $pasts = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", 0)], ["deleted_at", 0]]]); $donetrial = Model_Lessontime::find("all", ["where" => [["student_id", $this->user->id], ["status", 2], ["language", Input::get("course", -1)], ["deleted_at", 0]]]); ?> <?php if (count($donetrial) < 1 && count($pasts) < 1) { ?> <?php echo Html::anchor('/students/lesson/add?course=-1', '<i class="fa fa-plus-circle"></i> '); ?> <?php } elseif (count($donetrial) == 1 && count($pasts) >= 0 && count($pasts) <= 23) { ?> <?php echo Html::anchor('/students/lesson/add?course=0', '<i class="fa fa-plus-circle"></i> '); ?> <?php } elseif (count($pasts) >= 24 && count($pasts) <= 32) {
echo Html::anchor("admin/students/detail/{$user->id}", $user->email); ?> </p> </td> <td><?php if ($user->place == 1) { echo "Grameen"; } else { echo "Online School"; } ?> </td> <td> <?php $where = [["deleted_at", 0], ["status", 2], ["student_id", $user->id]]; $lesson = Model_Lessontime::find("last", ["where" => $where]); $course = $lesson['language']; $numbers = $lesson['number']; if ($numbers == "") { $number = 0; } else { $number = $numbers; } if ($course == -1) { echo $number . "/1 Trial"; } else { echo $number . "/12 enchant.js"; } ?> </td> <td><?php