function detail($title_none = NULL) { $cat_news_url = $this->uri->segment(1); $cat_news = new Newscatalogue(); $cat_news->where(array('name_none' => $cat_news_url))->get(); if (!$cat_news->exists()) { show_404(); } $dis['cat_news'] = $cat_news; $cat = $this->uri->segment(2); $category = new Newscatalogue(); $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $title_none = geturlfromuri($this->uri->segment(3)); $news = new Article(); $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id)); $news->get(); if (!$news->exists()) { redirect(base_url() . $this->uri->segment(1, '') . '/' . $this->uri->segment(2, '')); die; } $dis['news'] = $news; $tag = $news->tag; $dis['tag'] = explode(',', $tag); $news->view_count = $news->view_count + 1; $news->save(); //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 15, TRUE); $dis['related_news'] = $related_news; $arrayCateNewsId = array(); foreach ($this->guideCate as $row) { $arrayCateNewsId[] = $row->id; } $arrayCateNewsId = array(); foreach ($this->guideCate as $row) { $arrayCateNewsId[] = $row->id; } // get news view most $newViewMost = new Article(); $newViewMost->where('recycle', 0); $newViewMost->where_in('newscatalogue_id', $arrayCateNewsId); $newViewMost->order_by('view_count', 'desc'); $newViewMost->get(5); $dis['newViewMost'] = $newViewMost; // get news view most $newView = new Article(); $newView->where('recycle', 0); $newView->where_in('newscatalogue_id', $arrayCateNewsId); $newView->order_by('created', 'desc'); $newView->get(5); $dis['newView'] = $newView; $this->page_title = $news->{'title_vietnamese'} . ' | SotayNhadat.vn'; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $this->url = base_url() . substr($this->uri->uri_string, 1, strlen($this->uri->uri_string)); $this->isRobotFollow = 1; $dis['base_url'] = base_url(); $dis['view'] = 'front/guides/news_de'; $this->viewfront($dis); }
function detail($url) { $urlcat = $this->uri->segment(1); $category = new Newscatalogue(); $category->where(array('recycle' => 0, 'name_none' => $urlcat))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $url = geturlfromuri($this->uri->segment(2)); $news = new Article(); $news->where(array('title_none' => $url, 'recycle' => 0)); $news->get(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; $this->page_title = $news->title_vietnamese; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 10, TRUE); $dis['related_news'] = $related_news; $dis['base_url'] = base_url(); $dis['view'] = 'front/newsother/news_de'; $this->viewfront($dis); }
<div style="width:300px; padding: 10px;" > <form method="post" action="<?php echo $this->admin_url; ?> cnews/copy_2_cat/<?php echo $object->id; ?> "> <div align="center"><h2><strong>Copy</strong></h2><br></div> <table width="100%" class="table_input"> <tr> <td width="49%"><div align="left">Danh mục: </div></td> <td width="51%"> <?php $cat = new Newscatalogue(); $cat->where('parentcat_id !=', 'NULL'); $cat->get_iterated(); ?> <select name="copy_newscatalogue" class="smallInput"> <option value="0" >Tất cả</option> <?php foreach ($cat as $row) { ?> <option value="<?php echo $row->id; ?> " ><?php echo $row->name_vietnamese; ?> </option> <?php
/** * Cnews::dosearch() * * @param string $st * @param integer $offset * @param integer $limit * @return */ function dosearch($st = "", $offset = 0, $limit = 5) { $this->load->helper('text'); $separate = "aaaaaaa23423dddeeeeee838234eeeeefffffff99923ffffffsdfsdfsdfsdf"; $sep = "239847293dlkfaslf::sdflksdf::sdkfjsldf"; $this->load->helper('remove_vn'); $logged_role = $this->logged_in_user->adminrole->id; if ($_SERVER['REQUEST_METHOD'] == "GET") { $key_list = explode($sep, $st); $news = new article(); if ($key_list[0] != $separate) { $news->like('title_vietnamese', $key_list[0]); } if ($key_list[1] != $separate) { $news->where('newscatalogue_id', $key_list[1]); } else { $news->where_related_newscatalogue('parentcat_id', 7); } if ($key_list[2] != $separate) { $news->where('created >', $key_list[2]); $news->where('created <', $key_list[3]); } if ($key_list[4] != 3) { $news->where('active', $key_list[4]); } if ($key_list[5] != 3) { $news->where('hot', $key_list[5]); } if ($key_list[6] != 3) { $news->where('home_hot', $key_list[6]); } $news->where('recycle', $key_list[7]); //arrange by switch ($key_list[8]) { case "thoigian": $news->order_by('id', $key_list[9]); break; case "docnhieu": $news->order_by('view_count', $key_list[9]); break; } $news->get_paged($offset, $key_list[10], TRUE); // $this->firephp->log($news->check_last_query()); setPagination($this->admin . 'cnews/dosearch/' . $st, $news->paged->total_rows, $key_list[10], 5); $dis['base_url'] = base_url(); $dis['view'] = 'news/search'; $dis['news'] = $news; $dis['search_result'] = 1; $dis['menu_active'] = "Tìm kiếm"; $dis['title_table'] = "Trang hiện tại:" . $news->paged->current_page . '/' . $news->paged->total_pages; $dis['title'] = "Kết quả tìm kiếm"; $dis['searchkey'] = $key_list[0] != $separate ? $key_list[0] : ""; $dis['catalogue_id'] = $key_list[1]; $dis['date_start'] = $key_list[2] != $separate ? $key_list[2] : ""; $dis['date_end'] = $key_list[3] != $separate ? $key_list[3] : ""; $dis['active'] = $key_list[4]; $dis['hot_cat'] = $key_list[5]; $dis['hot_home'] = $key_list[6]; $dis['recycle'] = $key_list[7]; $dis['arrange_by'] = $key_list[8]; $dis['arrange_direct'] = $key_list[9]; $dis['showperpage'] = $key_list[10]; $newscatalogue = new Newscatalogue(); $newscatalogue->where('parentcat_id', 7); $newscatalogue->order_by('position', 'asc'); $newscatalogue->get(); $dis['newscatalogue'] = $newscatalogue; $this->viewadmin($dis); } else { $searchkey = trim($this->input->post('searchkey')); $catalogue_id = $this->input->post('newscatalogue'); $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); $active = $this->input->post('active'); $hot_cat = $this->input->post('hot_cat'); $hot_home = $this->input->post('hot_home'); $arrange_by = $this->input->post('arrange_by'); $arrange_direct = $this->input->post('arrange_direct'); $showperpage = $this->input->post('showperpage'); $recycle = $this->input->post('recycle') == 1 ? $this->input->post('recycle') : 0; //create string uri query $search_string = ""; $search_string .= $searchkey == "" ? $separate : $searchkey; $search_string .= $sep . ($catalogue_id ? $catalogue_id : $separate); $search_string .= $sep . ($date_start != "" ? $date_start : $separate); $search_string .= $sep . ($date_end != "" ? $date_end : $separate); $search_string .= $sep . $active; $search_string .= $sep . $hot_cat; $search_string .= $sep . $hot_home; $search_string .= $sep . $recycle; $search_string .= $sep . $arrange_by; $search_string .= $sep . $arrange_direct; $search_string .= $sep . $showperpage; $this->firephp->log($search_string); redirect($this->admin . 'cnews/dosearch/' . $search_string . '/0/' . $showperpage); } }
function detail($title_none = NULL) { //echo 'lien minh';exit; $news = new Article(); $news->where('title_none', $title_none); $news->get(); //print_r($this->db->last_query());exit(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 10, TRUE); $dis['related_news'] = $related_news; $category = new Newscatalogue(); $category->where(array('id' => $news->newscatalogue_id))->get(); if ($category->name_none == "khuyen-mai") { $this->menu_active = "khuyen-mai"; } $this->page_title = $news->{'title_vietnamese'}; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $dis['base_url'] = base_url(); $dis['link'] = gen_seo_url($this->lang->line('news')) . '/'; $dis['view'] = 'front/recruit/recruit_de'; $this->viewfront($dis); }
function detail($title_none = NULL) { $cat_news_url = $this->uri->segment(1); $cat_news = new Newscatalogue(); $cat_news->where(array('name_none' => $cat_news_url, 'parentcat_id' => NULL))->get(); if (!$cat_news->exists()) { show_404(); } $dis['cat_news'] = $cat_news; $cat = $this->uri->segment(2); $category = new Newscatalogue(); $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get(); if (!$category->exists()) { show_404(); } $dis['category'] = $category; $title_none = geturlfromuri($this->uri->segment(3)); $news = new Article(); $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id)); $news->get(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; $tag = $news->tag; $dis['tag'] = explode(',', $tag); $news->view_count = $news->view_count++; $news->save(); //related news $related_news = new Article(); $related_news->where('recycle', 0); $related_news->where('newscatalogue_id', $news->newscatalogue_id); $related_news->where("id !=", $news->id); $related_news->order_by('created', 'DESC'); $related_news->get_paged(0, 10, TRUE); $dis['related_news'] = $related_news; $this->page_title = $news->{'title_vietnamese'} . ' | Dự án ' . $category->name_vietnamese . ' ' . $news->{'title_vietnamese'} . ' | SotayNhadat.vn'; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $this->isRobotFollow = 1; $dis['base_url'] = base_url(); $dis['view'] = 'front/project/news_de'; $this->viewfront($dis); }
function MY_Controller() { parent::Controller(); $this->load->library('enum'); $this->load->config('fireignition'); $this->load->helper('language'); $this->lang->load('site'); $this->load->library('hit_counter'); $this->load->library('FirePHP'); if ($this->config->item('fireignition_enabled')) { if (floor(phpversion()) < 5) { log_message('error', 'PHP 5 is required to run fireignition'); } else { $this->load->library('FirePHP'); } } else { $this->load->library('Firephp_fake'); $this->firephp =& $this->firephp_fake; } //redirect from old website $this->redirectList(); $cauhinh = new cauhinh(); $cauhinh->get(); $this->cauhinh = $cauhinh; if ($this->uri->segment(1, "") == "admin") { $this->logged_in_user = $this->_get_user(); $this->admin = $this->config->item('admin'); $this->admin_url = $this->config->item('admin_url'); $this->admin_images = base_url() . "images/admin/"; //LOAD HELPER $this->load_admin_resource(); //check maintenance admin , only webmaster can login $this->resetNewsViewMost(); } else { //check login user //$this->flogged_in_user=$this->_fget_user(); $this->isCache = true; $this->userLoginFlag = 0; $userLogin = $this->session->userdata('userLogin'); $userToken = $this->session->userdata('userToken'); $customer = new Customer(); $customer->get_by_username($userLogin); if ($customer->exists() && md5($customer->id) == trim($userToken)) { $loginUsername = $customer->username; $this->customer = $customer; if ($this->session->userdata('userloginFlag') == "1") { $this->userLoginFlag = 1; $this->session->set_userdata('userloginFlag', "0"); } } else { $loginUsername = ""; } $this->loginUsername = $loginUsername; $this->loginUser = $customer; $this->page_title = getconfigkey("defaultPageTitle"); $this->load->helper('language'); $this->show_analytic = TRUE; $this->page_keyword = getconfigkey("defaultKeyword"); $this->page_description = getconfigkey("defaultDescription"); $this->isRobotFollow = true; //------------------------------------------------ // get data handler //------------------------------------------------ $listAllCat = array(); $newsCate = new Newscatalogue(); $newsCate->order_by('position'); $newsCate->where(array('recycle' => 0, 'parentcat_id' => 58)); $newsCate->get_iterated(); $this->newsCate = $newsCate; foreach ($newsCate as $row) { array_push($listAllCat, $row->id); } /*Get all business cat*/ $businessCat = new Newscatalogue(); $businessCat->order_by('position'); $businessCat->where(array('recycle' => 0, 'parentcat_id' => 91)); $businessCat->get_iterated(); $this->businessCat = $businessCat; $guideCate = new Newscatalogue(); $guideCate->order_by('position'); $guideCate->where(array('recycle' => 0, 'parentcat_id' => 76)); $guideCate->get_iterated(); $this->guideCate = $guideCate; foreach ($guideCate as $row) { array_push($listAllCat, $row->id); } $this->listAllCat = $listAllCat; $projectsCate = new Newscatalogue(); $projectsCate->order_by('position'); $projectsCate->where(array('recycle' => 0, 'parentcat_id' => 83)); $projectsCate->get_iterated(); $this->projectsCate = $projectsCate; $arrayCateNewsId = array(); foreach ($this->projectsCate as $row) { $arrayCateNewsId[] = $row->id; } $this->arrCateProject = $arrayCateNewsId; // project hot $projectHot = new Article(); $projectHot->where('recycle', 0); $projectHot->where('hot', 1); $projectHot->where_in('newscatalogue_id', $arrayCateNewsId); $projectHot->order_by('created', 'desc'); $projectHot->get(3); $this->projectHot = $projectHot; //get all housesale $typeHouseSale = new Estatetype(); $typeHouseSale->where('estatecatalogue_id', 1); $typeHouseSale->order_by('position'); $typeHouseSale->get_iterated(); $this->typeHouseSale = $typeHouseSale; //get all houselease $typeHouseLease = new Estatetype(); $typeHouseLease->where('estatecatalogue_id', 2); $typeHouseLease->order_by('position'); $typeHouseLease->get_iterated(); $this->typeHouseLease = $typeHouseLease; //get all housedemand $typeHouseDemand = new Estatetype(); $typeHouseDemand->where('estatecatalogue_id', 3); $typeHouseDemand->order_by('position'); $typeHouseDemand->get_iterated(); $this->typeHouseDemand = $typeHouseDemand; // get all province $estateProvince = new Estatecity(); $estateProvince->order_by('position', 'asc'); $estateProvince->get_iterated(); $this->estateProvince = $estateProvince; // get all Direction $estateDirection = new Estatedirection(); $estateDirection->order_by('id', 'desc'); $estateDirection->get_iterated(); $this->estateDirection = $estateDirection; // get all Estatecatalogues $estateCatalogues = new Estatecatalogue(); $estateCatalogues->order_by('position', 'asc'); $estateCatalogues->get_iterated(); $this->estateCatalogues = $estateCatalogues; // get all business world $businessWorld = new Article(); $businessWorld->order_by('id', 'desc'); $businessWorld->where(array('recycle' => 0, 'newscatalogue_id' => 78)); $businessWorld->get(20); $this->businessWorld = $businessWorld; // get all project news $projectNews = new Article(); $projectNews->order_by('id', 'desc'); $projectNews->where(array('recycle' => 0, 'newscatalogue_id' => 71)); $projectNews->get(6); $this->projectNews = $projectNews; $this->projectNewsFirst = $projectNews->limit(1); // get all legal advice $legalAdvices = new Article(); $legalAdvices->order_by('id', 'desc'); $legalAdvices->where(array('recycle' => 0, 'newscatalogue_id' => 82)); $legalAdvices->get(11); $this->legalAdvices = $legalAdvices; // get all new STND $newsPrivate = new Article(); $newsPrivate->order_by('id', 'desc'); $newsPrivate->where(array('recycle' => 0, 'newscatalogue_id' => 75)); $newsPrivate->get_iterated(); $this->newsPrivate = $newsPrivate; // get all estateareas $estateareas = new Estatearea(); $estateareas->order_by('position', 'asc'); $estateareas->get_iterated(); $this->estateareas = $estateareas; // get all estateprices $estateprices = new Estateprice(); $estateprices->order_by('position', 'asc'); $estateprices->get_iterated(); $this->estateprices = $estateprices; //------------------------------------------------ // Top Advertise //------------------------------------------------ $banner = new banner(); $banner->where('bannercat_id', 1); $banner->get_iterated(); $this->banner = $banner; $bannerAdversiting = new Banner(); $bannerAdversiting->where('bannercat_id', 19); $bannerAdversiting->get_iterated(); $this->bannerAdversiting = $bannerAdversiting; $bannerLeft = new Banner(); $bannerLeft->where('bannercat_id', 21); $bannerLeft->get_iterated(); $this->bannerLeft = $bannerLeft; $bannerFooter = new Banner(); $bannerFooter->where('bannercat_id', 20); $bannerFooter->get_iterated(); $this->bannerFooter = $bannerFooter; $menu = new menu(); $menu->order_by('position', 'asc'); $menu->get_iterated(8); $this->menu = $menu; $productFooter = new menuitem(); $productFooter->where('menu_id', 9); $productFooter->order_by('position', 'asc'); $productFooter->get_iterated(); $this->productFooter = $productFooter; $relation = new menuitem(); $relation->order_by('position', 'asc'); $relation->where('menu_id', 10); $relation->get_iterated(); $this->relation = $relation; $this->_increaseVisiter(); //load product manufacture $productManufacture = new Productmanufacture(); $productManufacture->order_by('name', 'asc'); $productManufacture->get_iterated(); $this->productManufacture = $productManufacture; $adverHeader = new Banner(); $adverHeader->where('bannercat_id', 25); $adverHeader->get(1); $this->adverHeader = $adverHeader; // get estates hot $newsHot = new Article(); $newsHot->where_in('newscatalogue_id', array(71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82)); $newsHot->order_by('id', 'desc'); $newsHot->where('hotHome', 1); $newsHot->get(5); $this->newsHot = $newsHot; } }