public function bandoGoogle()
 {
     $catDB = new CatalogDB();
     $postDB = new PostDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postList = $postDB->getAllPost();
     $postTopRead = $postDB->getTopPopularRead(5);
     $breadcum = "";
     $data = array("CatMenu" => $catMenu, "catList" => $catList, "postList" => $postList, "postTopRead" => $postTopRead->getList());
     $data['catDB'] = $catDB;
     $data['menu'] = $this->CatalogDB->showMenu();
     $this->load->view('lienhe/lien-he', $data);
 }
 public function index($tieudekd = null, $page = 1)
 {
     // Lay id tu tieudekd
     $strid = substr($tieudekd, strlen($tieudekd) - 3);
     $strpos = strpos($strid, '-');
     $idc = substr($strid, $strpos + 1);
     $catDB = new CatalogDB();
     $postBD = new PostDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postList = $postBD->getAllPost();
     //$catParent = $catList->getCatalogParent();
     $cat = $catList->getCatalogIdLoai($idc);
     $catListParent = $catList->getCatalogParent();
     $catParent = $catListParent->getCatalogIdLoai($cat->getParent());
     $postShow = $postList->getBaiViet($idc, 7);
     if (!$catParent) {
         $catFirst = $catList->getCatalogFirst($idc);
         $postTopRead = $postBD->getTopPopularRead(5, $catFirst->getIdLoai());
     } else {
         $postTopRead = $postBD->getTopPopularRead(5, $idc);
     }
     $breadcum = "";
     if ($catParent) {
         $breadcum = "<a href='" . base_url() . "" . $catParent->getTieuDeKD() . "'>" . $catParent->getTieuDe() . "</a> >>";
     }
     if ($cat) {
         $breadcum .= "<a href='" . base_url() . "" . $cat->getTieuDeKD() . "'>" . $cat->getTieuDe() . "</a>";
     } else {
         $breadcum = "<a href='" . base_url() . "" . $cat->getTieuDeKD() . "'>" . $cat->getTieuDe() . "</a>";
     }
     //else $breadcum = "<a href='".  base_url()."index.php/tin-suc-khoe'>Tin sức khỏe</a>";
     if ($catParent) {
         $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, "postShow" => $postShow, "cat" => $cat, 'postTopRead' => $postTopRead->getList());
         $data['page'] = $page;
         $data['hasCatsub'] = false;
         $this->load->view('catalog/index', $data);
     } else {
         // Lay cac menu con
         $catSub = $catList->getCatalogChildren($idc);
         $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, "postList" => $postList, "cat" => $cat, "catSub" => $catSub, 'postTopRead' => $postTopRead->getList());
         $data['page'] = $page;
         $data['hasCatsub'] = true;
         $this->load->view('catalog/list', $data);
     }
 }
 public function all()
 {
     $catDB = new CatalogDB();
     $postDB = new PostDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postList = $postDB->getAllPost();
     $postTopRead = $postDB->getTopPopularRead(5);
     $breadcum = "<a href='" . base_url() . "tin-suc-khoe'>Tin sức khỏe</a>";
     $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, "postList" => $postList, "postTopRead" => $postTopRead->getList());
     $data['catDB'] = $catDB;
     $data['menu'] = $this->CatalogDB->showMenu();
     $this->load->view('catalog/all', $data);
 }
Beispiel #4
0
 public function page($tieudeKD)
 {
     try {
         $pageDB = new PageDB();
         try {
             if ($pageDB->LayID($tieudeKD)) {
                 $id = $pageDB->LayID($tieudeKD)['0']['idPa'];
             } else {
                 if ($tieudeKD == 'quyen-nghia-vu-cua-benh-nhan') {
                     redirect(base_url() . 'gioi-thieu/quyen-va-nghia-vu-cua-benh-nhan.html');
                 } else {
                     redirect(base_url() . 'gioi-thieu/' . $tieudeKD . '.html');
                 }
             }
         } catch (Exception $e) {
             echo $e->getMessage();
         }
         $pageTieuDe = $pageDB->LayTieuDe($id)['0']['TieuDe'];
         $pageNoiDung = $pageDB->LayNoiDung($id)['0']['NoiDung'];
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     // breadcum
     $breadcum = "<a href='" . base_url() . "/page/" . $tieudeKD . ".html'>" . $pageTieuDe . "</a>";
     $postDB = new PostDB();
     $catDB = new CatalogDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postList = $postDB->getAllPost();
     $post = $postList->getPost($id);
     $cat = $catList->getCatalogFirstPost($post->getIdLoai());
     $catParent = null;
     if (isset($cat)) {
         $catParent = $catList->getCatalogFirst($cat->getIdLoai());
     }
     $postTopRead = $postDB->getTopPopularRead(5);
     $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, "postTopRead" => $postTopRead->getList());
     $data['catDB'] = $catDB;
     $data['tieude'] = $pageTieuDe;
     $data['noidung'] = $pageNoiDung;
     $data['menu'] = $this->CatalogDB->showMenu();
     $this->load->view('trangcon/page', $data);
 }
Beispiel #5
0
 public function testPost($tieudekd = null, $title = null)
 {
     if (preg_match('/[\\/0-9a-zA-Z\\-.]$/', $tieudekd)) {
         //echo "<script>console.log('".$tieudekd."')</script>";
         //redirect();
     }
     // Lay id tu tieudekd
     if (preg_match('/-[0-9]$/', $tieudekd)) {
         $strid = substr($tieudekd, strlen($tieudekd) - 2);
         $strpos = strpos($strid, '-');
         $idp = substr($strid, $strpos + 1);
     } else {
         if (preg_match('/-[0-9]{2}$/', $tieudekd)) {
             $strid = substr($tieudekd, strlen($tieudekd) - 3);
             $strpos = strpos($strid, '-');
             $idp = substr($strid, $strpos + 1);
         } else {
             if (preg_match('/-[0-9]{3}$/', $tieudekd)) {
                 // lay sau -123.html => -123
                 $strid = substr($tieudekd, strlen($tieudekd) - 4);
                 // lay vi tri cua -
                 $strpos = strpos($strid, '-');
                 // lay 123
                 $idp = substr($strid, $strpos + 1);
             } else {
                 if (preg_match('/-[0-9]{4}$/', $tieudekd)) {
                     $strid = substr($tieudekd, strlen($tieudekd) - 5);
                     $strpos = strpos($strid, '-');
                     $idp = substr($strid, $strpos + 1);
                     throw new Exception("Not Found Bai viet");
                     return;
                 } else {
                     if (preg_match('/-[0-9]{5}$/', $tieudekd)) {
                         $strid = substr($tieudekd, strlen($tieudekd) - 6);
                         $strpos = strpos($strid, '-');
                         $idp = substr($strid, $strpos + 1);
                         throw new Exception("Not Found Bai viet");
                         return;
                     } else {
                         if (preg_match('/-([a-zA-Z]+)$/', $tieudekd)) {
                             redirect(base_url());
                             throw new Exception("Not Found Bai viet");
                             return;
                         }
                     }
                 }
             }
         }
     }
     if ($idp) {
         if ($idp == '219' || $idp == 219) {
             redirect(base_url() . 'benh-xa-hoi-27');
         }
     } else {
         throw new Exception('Not found');
     }
     // breadcum
     $breadcum = "";
     $postDB = new PostDB();
     $catDB = new CatalogDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postList = $postDB->getAllPost();
     $post = $postList->getPost($idp);
     $cat = $catList->getCatalogFirstPost($post->getIdLoai());
     $catParent = null;
     if (isset($cat)) {
         $catParent = $catList->getCatalogFirst($cat->getIdLoai());
     }
     $postTopRead = $postDB->getTopPopularRead(5);
     if ($catParent) {
         $breadcum .= "<a href='" . base_url() . "" . $catParent->getTieuDeKD() . "'>" . $catParent->getTieuDe() . "</a>";
     }
     if ($cat) {
         $breadcum = "<a href='" . base_url() . "" . $cat->getTieuDeKD() . "'>" . $cat->getTieuDe() . "</a>";
     }
     if ($post) {
         $breadcum .= "<a href='" . base_url() . "" . $post->getTieuDeKD() . ".html'>" . $post->getTieuDe() . "</a>";
     }
     $data = array("post" => $post, "breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, "postTopRead" => $postTopRead->getList());
     $data['catDB'] = $catDB;
     $data['postRelated'] = $catDB->getBaiVietLienQuan($post->getIdCL(), $post->getIdLoai(), $post->getIdGroup(), 0, 10, $post->getIdPO());
     $data['menu'] = $this->CatalogDB->showMenu();
     $this->load->view('test/post', $data);
 }
 public function home()
 {
     $catDB = new CatalogDB();
     $catList = $catDB->getAllCategory();
     $catActive = $catList->getCatalogParent();
     $cat = $catList->findIdLoai(1);
     $postDB = new PostDB();
     $postList = $postDB->getAllPost();
     $postFirst = $postList->getFirstPostDate();
     $postTieuDe = $postList->getTieuDeFirstDate(5);
     $catFirstChildren = $catList->getCatalogFirstPostAB();
     $dataMenu = array("CatMenu" => $catActive->getList(), "cat" => $cat, "PostFirst" => $postFirst, "postTieuDe" => $postTieuDe, "catList" => $catList, "catChildren" => $catFirstChildren, "postDB" => $postDB);
     $dataMenu['menu'] = $catDB->showMenu();
     $this->load->view('pages/hom', $dataMenu);
 }
Beispiel #7
0
 public static function insertCustomer(array $params)
 {
     $options = array("cost" => 10);
     $params["geslo"] = password_hash($params["geslo"], PASSWORD_BCRYPT, $options);
     if (isset($params["aktiven"]) && $params["aktiven"] == 1) {
         $params["aktiven"] = "da";
     } else {
         $params["aktiven"] = "ne";
     }
     if (PostDB::get(["posta" => $params["posta"]]) == null) {
         $posta = PostDB::insert(["posta" => $params["posta"], "kraj" => $params["kraj"]]);
     } else {
         $posta = $params["posta"];
     }
     $result = self::insert(["ime" => $params["ime"], "priimek" => $params["priimek"], "mail" => $params["mail"], "uporabnisko_ime" => $params["uporabnisko_ime"], "geslo" => $params["geslo"], "aktiven" => $params["aktiven"]]);
     //var_dump($result, $params, ["uporabnik_id" => $result, "telefon" => $params["telefon"], "ulica" => $params["ulica"], "stevilka"=> $params["stevilka"], "posta_id" => $posta]);
     return parent::modify("INSERT INTO stranka (uporabnik_id, telefon, ulica, stevilka, posta_id) " . " VALUES (:uporabnik_id, :telefon, :ulica, :stevilka, :posta_id)", ["uporabnik_id" => $result, "telefon" => $params["telefon"], "ulica" => $params["ulica"], "stevilka" => $params["stevilka"], "posta_id" => $posta]);
 }
 public function Dat_hen_kham()
 {
     session_start();
     $postDB = new PostDB();
     $catDB = new CatalogDB();
     $spDB = new SupportDB();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $catList = $catDB->getAllCategory();
     $catMenu = $catList->getCatalogParent();
     $postTopRead = $postDB->getTopPopularRead(5);
     $breadcum = "<a href='" . base_url() . "dat-hen-kham.html'>Đặt hẹn</a>";
     $btnGui = $this->input->post('btnGui');
     if ($btnGui) {
         $sp = new SupportClass();
         $sp->setHoTen($this->input->post('hoten'));
         $sp->setGioiTinh($this->input->post('gioitinh'));
         $sp->setTuoi($this->input->post('ngaysinh'));
         $sp->setDienThoai($this->input->post('dienthoai'));
         $sp->setEmail($this->input->post('email'));
         $sp->setNgayKham($this->input->post('ngaykham'));
         $sp->setGioKham($this->input->post('giokham'));
         $sp->setNoiDung($this->input->post('tinhtrang'));
         $kq = $spDB->Insert_support($sp);
         $message = '';
         if ($kq) {
             $message = 'success';
             $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, 'message' => $message, 'postTopRead' => $postTopRead->getList());
             $data['catDB'] = $catDB;
             $data['menu'] = $this->CatalogDB->showMenu();
             $this->load->view('dat-hen/dat-hen-xu-ly', $data);
         } else {
             $message = 'failed';
             $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, 'message' => $message, 'postTopRead' => $postTopRead->getList());
             $data['catDB'] = $catDB;
             $data['menu'] = $this->CatalogDB->showMenu();
             $this->load->view('dat-hen/dat-hen-kham', $data);
         }
     } else {
         $message = 'failed';
         $data = array("breadcum" => $breadcum, "CatMenu" => $catMenu, "catList" => $catList, 'message' => $message, 'postTopRead' => $postTopRead->getList());
         $data['catDB'] = $catDB;
         $data['err'] = '';
         $data['menu'] = $this->CatalogDB->showMenu();
         $this->load->view('dat-hen/dat-hen-kham', $data);
     }
 }