Exemplo n.º 1
0
 public function searchBaiViet($key, $type)
 {
     $key = preg_replace('/\\s\\s+/', ' ', trim($key));
     if ($key != null || $key == "") {
         $currentpage = 1;
         if (Input::has('page')) {
             $currentpage = Input::get('page');
         }
         $threads = TinTuc::Select($type, $this->perpage, $key);
         return View::make('admin.threads.index')->with("threads", $threads)->with('currentpage', $currentpage)->with('perpage', $this->perpage)->with("key", $key)->with("type", $type)->with("title", "Quản lý các bài viết");
     } else {
         return $this->index("baiviet");
     }
 }
Exemplo n.º 2
0
 public function indexModify($type = null, $alias = null)
 {
     $contacts = Contact::Select();
     if ($type == "chienluoc") {
         switch ($alias) {
             case "forex":
                 $forex = TinTuc::Select(1, $this->perpage);
                 //ajax pagingation forex
                 $tintuc['noidung'] = $forex;
                 $tintuc['phantrang'] = $forex->links();
                 if (Request::ajax() && Input::get("type") == "forex") {
                     $html = View::make("guest.chienluoc.forex.ajaxpagination", $tintuc)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation forex
                 //bv xem nhieu
                 $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                 //ajax pagingation bv xem nhieu
                 $xemnhieu['noidung'] = $viewsthreads;
                 $xemnhieu['phantrang'] = $viewsthreads->links();
                 if (Request::ajax() && Input::get("type") == "xemnhieu") {
                     $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation bv xem nhieu
                 return View::make('guest.traders.chienluoc_forex')->with('contacts', $contacts)->with('forex', $forex)->with('viewsthreads', $viewsthreads)->with("title", "Các chiến lược giao dịch Forex");
             case "vang":
                 $kimloaiquy = TinTuc::Select(2, $this->perpage);
                 //ajax pagingation kim loai quy
                 $klq['noidung'] = $kimloaiquy;
                 $klq['phantrang'] = $kimloaiquy->links();
                 if (Request::ajax() && Input::get("type") == "kimloaiquy") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_klq", $klq)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagination kim loai quy
                 $hanghoa = TinTuc::Select(3, $this->perpage);
                 //ajax pagingation hang hoa
                 $hh['noidung'] = $hanghoa;
                 $hh['phantrang'] = $hanghoa->links();
                 if (Request::ajax() && Input::get("type") == "hanghoa") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_hh", $hh)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation hang hoa
                 $cophieu = TinTuc::Select(4, $this->perpage);
                 //ajax pagingation co phieu
                 $cp['noidung'] = $cophieu;
                 $cp['phantrang'] = $cophieu->links();
                 if (Request::ajax() && Input::get("type") == "cophieu") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_cp", $cp)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation co phieu
                 return View::make('guest.traders.chienluoc_vang')->with('contacts', $contacts)->with('kimloaiquy', $kimloaiquy)->with('hanghoa', $hanghoa)->with('cophieu', $cophieu)->with("title", "Các chiến lược giao dịch vàng");
             case "vang_klq":
                 $kimloaiquy = TinTuc::Select(2, $this->perpage);
                 //ajax pagingation kim loai quy
                 $klq['noidung'] = $kimloaiquy;
                 $klq['phantrang'] = $kimloaiquy->links();
                 if (Request::ajax() && Input::get("type") == "kimloaiquy") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_klq", $klq)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagination kim loai quy
                 //bv xem nhieu
                 $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                 //ajax pagingation bv xem nhieu
                 $xemnhieu['noidung'] = $viewsthreads;
                 $xemnhieu['phantrang'] = $viewsthreads->links();
                 if (Request::ajax() && Input::get("type") == "xemnhieu") {
                     $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation bv xem nhieu
                 return View::make('guest.traders.chienluoc_vang_klq')->with('contacts', $contacts)->with('kimloaiquy', $kimloaiquy)->with('viewsthreads', $viewsthreads)->with("title", "Các chiến lược giao dịch vàng với kim loại quý");
             case "vang_hh":
                 $hanghoa = TinTuc::Select(3, $this->perpage);
                 //ajax pagingation hang hoa
                 $hh['noidung'] = $hanghoa;
                 $hh['phantrang'] = $hanghoa->links();
                 if (Request::ajax() && Input::get("type") == "hanghoa") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_hh", $hh)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation hang hoa
                 //bv xem nhieu
                 $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                 //ajax pagingation bv xem nhieu
                 $xemnhieu['noidung'] = $viewsthreads;
                 $xemnhieu['phantrang'] = $viewsthreads->links();
                 if (Request::ajax() && Input::get("type") == "xemnhieu") {
                     $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation bv xem nhieu
                 return View::make('guest.traders.chienluoc_vang_hh')->with('contacts', $contacts)->with('hanghoa', $hanghoa)->with('viewsthreads', $viewsthreads)->with("title", "Các chiến lược giao dịch vàng với hàng hóa");
             case "vang_cp":
                 $cophieu = TinTuc::Select(4, $this->perpage);
                 //ajax pagingation co phieu
                 $cp['noidung'] = $cophieu;
                 $cp['phantrang'] = $cophieu->links();
                 if (Request::ajax() && Input::get("type") == "cophieu") {
                     $html = View::make("guest.chienluoc.chienluocvang.ajaxpagination_cp", $cp)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation co phieu
                 //bv xem nhieu
                 $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                 //ajax pagingation bv xem nhieu
                 $xemnhieu['noidung'] = $viewsthreads;
                 $xemnhieu['phantrang'] = $viewsthreads->links();
                 if (Request::ajax() && Input::get("type") == "xemnhieu") {
                     $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                     return Response::json(array('html' => $html));
                 }
                 //end ajax pagingation bv xem nhieu
                 return View::make('guest.traders.chienluoc_vang_cp')->with('contacts', $contacts)->with('cophieu', $cophieu)->with('viewsthreads', $viewsthreads)->with("title", "Các chiến lược giao dịch vàng với chiến lược");
             default:
                 return $this->index();
                 //trang chủ mặc định
         }
     } else {
         if ($type == "news") {
             switch ($alias) {
                 case "tin_tn":
                     $newsTNs = TinTuc::Select(6, $this->perpage);
                     //ajax pagingation tin tức trong nước
                     $tinTN['noidung'] = $newsTNs;
                     $tinTN['phantrang'] = $newsTNs->links();
                     if (Request::ajax() && Input::get("type") == "tin_tn") {
                         $html = View::make("guest.news.ajaxpagination_tn", $tinTN)->render();
                         return Response::json(array('html' => $html));
                     }
                     //end ajax pagingation tin tức trong nước
                     //bv xem nhieu
                     $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                     //ajax pagingation bv xem nhieu
                     $xemnhieu['noidung'] = $viewsthreads;
                     $xemnhieu['phantrang'] = $viewsthreads->links();
                     if (Request::ajax() && Input::get("type") == "xemnhieu") {
                         $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                         return Response::json(array('html' => $html));
                     }
                     //end ajax pagingation bv xem nhieu
                     return View::make('guest.news.index_tn')->with('contacts', $contacts)->with('newsTNs', $newsTNs)->with('viewsthreads', $viewsthreads)->with("title", "Các tin trong nước");
                 case "tin_nn":
                     $newsNNs = TinTuc::Select(7, $this->perpage);
                     //ajax pagingation tin tức ngoài nước
                     $tinNN['noidung'] = $newsNNs;
                     $tinNN['phantrang'] = $newsNNs->links();
                     if (Request::ajax() && Input::get("type") == "tin_nn") {
                         $html = View::make("guest.news.ajaxpagination_nn", $tinNN)->render();
                         return Response::json(array('html' => $html));
                     }
                     //end ajax pagingation tin tức ngoài nước
                     //bv xem nhieu
                     $viewsthreads = TinTuc::SelectRelate("views", "", null, 5);
                     //ajax pagingation bv xem nhieu
                     $xemnhieu['noidung'] = $viewsthreads;
                     $xemnhieu['phantrang'] = $viewsthreads->links();
                     if (Request::ajax() && Input::get("type") == "xemnhieu") {
                         $html = View::make("guest.relations.ajaxpagination_views", $xemnhieu)->render();
                         return Response::json(array('html' => $html));
                     }
                     //end ajax pagingation bv xem nhieu
                     return View::make('guest.news.index_nn')->with('contacts', $contacts)->with('newsNNs', $newsNNs)->with('viewsthreads', $viewsthreads)->with("title", "Các tin ngoài nước nước");
                 default:
                     return $this->index();
                     //trang chủ mặc định
             }
         } else {
             return $this->index();
             //trang chủ mặc định
         }
     }
 }