Example #1
0
 public function traloiRevenueAction()
 {
     $month = $this->request->get("month", null, date("m"));
     $year = $this->request->get("year", null, date("Y"));
     $user_obj = new \HaiQuan\Backend\Models\CtgTuVanTraLoi();
     $user = $user_obj->getStatistic($month, $year)->toArray();
     $user_chart = \library\Util::mergeStatistic($user, $month, $year);
     $this->view->data = \library\Util::createStatisticData($user_chart);
 }
Example #2
0
 public function editContentAction()
 {
     //Set Layout
     if ($this->request->isPost()) {
         $data_edit = $this->request->getPost("data", null, false);
         $response = array("status" => 0, "message" => "Không Thành Công");
         $content_obj = new \HaiQuan\Backend\Models\CtgVanbang();
         if (!empty($data_edit)) {
             $firt_file = substr($data_edit["vb_file_dinh_kem"], 0, 1);
             if ($firt_file == "/") {
                 $data_edit["vb_file_dinh_kem"] = substr($data_edit["vb_file_dinh_kem"], 1, strlen($data_edit["vb_file_dinh_kem"]));
             }
             $data_edit["vb_seo"] = \library\Util::get_seo($data_edit["vb_title"]);
             $data_edit["vb_edit_date"] = date("Y-m-d H:i:s");
             $data_edit["vb_user_id"] = $this->user['us_id'];
             if (!isset($data_edit["vb_id"]) || empty($data_edit["vb_id"])) {
                 //Insert
                 $id_content = $data_edit["vb_id"];
                 unset($data_edit["vb_id"]);
                 $data_edit["vb_create_date"] = date("Y-m-d H:i:s");
                 $result = $content_obj->save($data_edit);
             } else {
                 $result = $content_obj->updateVanBanByID($data_edit, $data_edit["vb_id"]);
             }
             if ($result) {
                 $response["status"] = 1;
             } else {
                 $response["message"] = implode(";", $content_obj->getMessages());
             }
             //                $data_edit["vb_id"] = $content_obj->vb_id;
             $response["data"] = $data_edit;
         }
         echo json_encode($response);
         exit;
     } else {
         $this->view->header_title = "Edit Content - Managed";
         $this->assets->addCss($this->config['GAME_URL'] . 'public/css/admin/plugin/datetimepicker.css');
         $this->assets->collection("inline")->addJs($this->config['GAME_URL'] . 'public/js/admin/view/edit-vanbang.js');
         $this->assets->collection("head")->addJs($this->config['GAME_URL'] . 'public/js/admin/plugin/bootstrap-datetimepicker.min.js');
         $this->assets->collection("head")->addJs($this->config['GAME_URL'] . 'public/js/admin/plugin/ckeditor/ckeditor.js');
         $this->assets->collection("head")->addJs($this->config['GAME_URL'] . 'public/js/admin/plugin/ckeditor/adapters/jquery.js');
         $this->assets->collection("head")->addJs($this->config['GAME_URL'] . 'public/js/admin/plugin/ckfinder/ckfinder.js');
         $co_id = $this->request->getQuery("id", "int", false);
         $content_obj = new \HaiQuan\Backend\Models\CtgVanbang();
         $content = array();
         if (!empty($co_id)) {
             $content = $content_obj->findFirst("vb_id=" . $co_id)->toArray();
         }
         if (empty($content)) {
             $content = $content_obj->toArray();
         }
         if (empty($content["vb_images"])) {
             $content["vb_images"] = "public/uploads/images/Banner/banner-detail-news.jpg";
         }
         $this->view->content = $content;
     }
 }
Example #3
0
 public function registerAction()
 {
     $response = array("status" => 0, "message" => "Thao tác không thành công");
     if ($this->request->isPost()) {
         $username = $this->request->getPost("username", null, false);
         $email = $this->request->getPost("email", null, false);
         $password = $this->request->getPost("password", null, false);
         $repassword = $this->request->getPost("repassword", null, false);
         $phone = $this->request->getPost("phone", null, false);
         $check = true;
         $user_obj = new \HaiQuan\Frontend\Models\Character();
         $response["message"] = "";
         if (!empty($username) && strlen($username) >= 6) {
             $user = $user_obj->getUserByUsername($username, $password);
             if (!empty($user)) {
                 $check = false;
                 $response["message"] .= " - Username đã tồn tại <br>";
             }
         } else {
             $check = false;
             $response["message"] .= " - Username phải trên 5 kí tự <br>";
         }
         if (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
             $user = $user_obj->getUserByEmail($email);
             if (!empty($user)) {
                 $check = false;
                 $response["message"] .= " - Email đã tồn tại <br>";
             }
         } else {
             $check = false;
             $response["message"] .= " - Email không đúng <br>";
         }
         if (!empty($password) && !empty($repassword) && $password == $repassword) {
             if (strlen($password) < 6) {
                 $check = false;
                 $response["message"] .= " - Mật khẩu phải trên 6 kí tự <br>";
             }
         } else {
             $check = false;
             $response["message"] .= " - Nhập lại mật khẩu không đúng <br>";
         }
         if (!empty($phone) && strlen($phone) > 0) {
             if (!\library\Util::checkPhone($phone)) {
                 $check = false;
             }
             $response["message"] .= " - Số điện thoại không đúng <br>";
         }
         if ($check) {
             $time = time();
             $public_id = substr(md5(\library\Util::getRandomString(10)), 0, 5) . $time;
             $from = $this->session->get("user_from");
             if (!isset($from) || empty($from)) {
                 $from = "direct";
             }
             $user_data = array("ch_public_id" => $public_id, "ch_name" => $username, "ch_secret" => md5($password), "ch_nickname" => $username, "ch_email" => $email, "ch_coins" => 0, "ch_active" => 1, "ch_created_date" => date("Y-m-d H:i:s"), "ch_updated_date" => date("Y-m-d H:i:s"), "ch_from" => $from);
             if (!empty($phone) && strlen($phone) > 0) {
                 $user_data["ch_phone"] = $phone;
             }
             $user_banner = $this->session->get("user_bn");
             if (isset($user_banner) && !empty($user_banner)) {
                 $user_data["ch_link_id"] = $user_banner;
             }
             $user_obj = new \HaiQuan\Frontend\Models\Character();
             $user_obj->save($user_data);
             if (!empty($user_obj->ch_id)) {
                 $this->session->remove("user_from");
                 $this->session->remove("user_bn");
                 $response["status"] = 1;
                 $this->session->set("register_success", 1);
                 $this->loginSuccess($user_obj->toArray());
             } else {
                 $response["message"] = "Đăng kí không thành công";
             }
         }
     }
     echo json_encode($response);
     exit;
 }