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); }
function detail($title_none = NULL) { $title_none = $this->uri->segment(3); $arrTitle = explode('.', $title_none); if ($arrTitle[1] == '' || $arrTitle[1] != 'html') { redirect(''); } $title_none = $arrTitle[0]; $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($news->newscatalogue_id); $dis['category'] = $category; $this->page_title = $news->{'title_vietnamese'}; $this->page_description = $news->short_vietnamese; $this->page_keyword = $news->tag; $dis['base_url'] = base_url(); $dis['link'] = base_url() . $_SERVER['REQUEST_URI']; $dis['view'] = 'front/services/news_de'; $this->viewfront($dis); }
function getNewsByCategory($categoryID) { $CI =& get_instance(); $cat_news = new Article(); $cat_news->where(array('recycle' => 0)); $cat_news->where('newscatalogue_id', $categoryID); $cat_news->order_by('created', 'desc'); $cat_news->get(4); return $cat_news; }
function index($category_id = FALSE) { $articles = new Article(); if ($category_id) { $category = new Category($category_id); $articles->where("category_id in (select id from categories where lft >= " . $category->lft . " and rgt <= " . $category->rgt . " and module = '" . $category->module . "')"); } $data['articles'] = $articles->order_by('id', 'desc')->get_page(limit()); $this->template->append_metadata(js_lightbox()); $this->template->build('admin/article_index', $data); }
</p> </a> </div> </div> <?php } } ?> </div> <!-- end cotphainoibat--> </div> <?php foreach ($this->newsCate as $row) { $news = new Article(); $news->where(array('recycle' => 0, 'newscatalogue_id' => $row->id)); $news->order_by('id', 'desc'); $news->get(5); $newsFirst = $news->limit(1); ?> <!--tin con 1 --> <div class="tinthitruong"> <p style="font-size:16px; font-weight:bold; color:#FFFFFF; margin-left:12px; margin-top:8px;"> <a style="color: #FFF;" href="<?php echo $base_url . 'tin-tuc/' . $row->name_none; ?> "> <?php echo $row->name_vietnamese; ?> </a> </p>
static function getAllArticles(&$message, $forceall = false, $orderby = "id") { if (!$forceall && isset($_GET['type']) && $_GET['type'] === "unpublished") { if (Auth::user()->type != 1) { $message = "Showing all unpublished by you"; return Article::where('author_id', '=', Auth::user()->id)->where('status', '=', '0')->order_by($orderby, 'desc'); } else { $message = "Showing all unpublished Articles (by all authors)"; return Article::where('status', '=', '0')->order_by($orderby, 'desc'); } } else { if (!$forceall && Auth::user()->type != 1) { $message = "Showing all articles posted by you"; return Article::where('author_id', '=', Auth::user()->id)->order_by($orderby, 'desc'); } else { $message = "Showing all articles"; return Article::order_by($orderby, 'desc'); } } }
function helpCenter() { $news = new Article(); $news->where('newscatalogue_id', 65); $news->order_by('id', 'desc'); $news->get_iterated(); $dis['news'] = $news; $this->page_title = "Trợ giúp - " . $this->page_title; $dis['base_url'] = base_url(); $dis['view'] = 'helpCenter'; $this->viewfront($dis); }
private function arrange_position_home() { $o = new Article(); $o->where('home_hot', 1); $o->order_by('home_hot_position', 'asc'); $o->get(); $c = $o->count(); $i = 1; foreach ($o as $row) { $i++; $row->home_hot_position = $i; $row->save(); } }
function getProject() { //$type = new Estatetype($this->input->post('typeId')); //$category = new Estatecatalogue($type->estatecatalogue_id); $o = new Article(); $o->where('recycle', 0); $o->where('estatecity_id', $this->input->post('provincesId')); $o->order_by('title_vietnamese', 'asc'); $o->get(); $option = '<option value="">Chọn Dự án</option>'; foreach ($o as $row) { if ($row->id == $this->input->post('priceSelected')) { $option .= '<option selected="selected" value=' . $row->id . '>' . $row->title_vietnamese . '</option>'; } else { $option .= '<option value=' . $row->id . '>' . $row->title_vietnamese . '</option>'; } } echo $option; die; }
function postGuide() { $news = new Article(); $news->where(array('recycle' => 0, 'newscatalogue_id' => 90))->get_iterated(); if (!$news->exists()) { show_404(); } $dis['news'] = $news; // get news view most $newViewMost = new Article(); $newViewMost->where('recycle', 0); $newViewMost->where_in('newscatalogue_id', $this->listAllCat); $newViewMost->order_by('view_count', 'desc'); $newViewMost->get(10); $dis['newViewMost'] = $newViewMost; $this->page_title = "Hướng dẫn đăng tin - " . $this->page_title; $this->menu_active = 'home'; $dis['base_url'] = base_url(); $dis['view'] = 'front/postGuide'; $this->viewfront($dis); }
<div id="footer_f"> <div class="title"> <div class="f_hotline txt fl">Tin tức</div> <div class="f_accessories txt fl">Sản phẩm</div> <div class="txt fl">liên kết</div> <div class="clr"></div> </div> <div class="footer_links"> <div class="f_hotline f_height fl"> <?php $footerNews = new Article(); $footerNews->where('recycle', 0); $footerNews->where('active', 1); $footerNews->where('newscatalogue_id', 58); $footerNews->order_by('created', 'DESC'); $footerNews->get_paged(0, 5, TRUE); ?> <?php foreach ($footerNews as $row) { ?> <div style="height: 21px;width: 185px;overflow: hidden;float:left;clear:both;"><a href="<?php echo $base_url . "tin-tuc/d/" . $row->{'title_none'}; ?> " title="<?php echo $row->title_vietnamese; ?> ">» <?php echo $row->title_vietnamese; ?> </a></div>
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; } }
function editFree($id = 0) { $estate = new estate($id); if ($_SERVER['REQUEST_METHOD'] == "POST") { $this->load->helper('remove_vn_helper'); $this->load->library('file_lib'); $estate->estatecity_id = $this->input->post('estatecity_id'); $estate->estatedistrict_id = $this->input->post('estatedistrict_id'); $estate->estateward_id = $this->input->post('estateward_id'); $estate->estatedirection_id = $this->input->post('estatedirection_id'); $estate->estatecatalogue_id = $this->input->post('estatecatalogue_id'); $estate->estatetype_id = $this->input->post('estatetype_id'); $estate->estatearea_id = $this->input->post('estatearea_id'); $estate->estateprice_id = $this->input->post('estateprice_id'); $estate->address = $this->input->post('address'); $estate->isArea = $this->input->post('IsArea'); $estate->area = $this->input->post('area'); $estate->legally = $this->input->post('legally'); $estate->isPrice = $this->input->post('IsPrice'); $estate->price_text = $this->input->post('price_text'); $estate->estatedirection_id = $this->input->post('estatedirection_id'); $estate->title = $this->input->post('title'); $estate->description = $this->input->post('description'); $estate->price_text = $this->input->post('price_text'); $estate->area_text = $this->input->post('area_text'); $estate->article_id = $this->input->post('article_id'); $estate->price_type = $this->input->post('price_type'); if ($estate->isVip == 0) { $estate->updateTime = date('Y-m-d H:i:s'); } else { $estate->created = $estate->created; $estate->updated = $estate->updated; $estate->updateTime = date('Y-m-d H:i:s'); } $estate->name_contact = $this->input->post('name_contact'); $estate->address_contact = $this->input->post('address_contact'); $estate->phone_contact = $this->input->post('phone_contact'); $estate->mobile_contact = $this->input->post('mobile_contact'); $estate->email_contact = $this->input->post('email_contact'); $estate->tag = $this->input->post('tag'); $tags = remove_vn($this->input->post('tag') . ' ' . $this->input->post('title')); $tags = explode('-', $tags); $estate->tag_search = implode(' ', $tags); $estate->title_none = remove_vn($this->input->post('title')) . $estate->code; // Change images default if ($_FILES['image']['name'] != "") { $folder = 'img/project/'; $dataupload = $this->file_lib->upload('image', $folder, $rename_file = true); if (!is_array($dataupload)) { flash_message('error', $dataupload); $estate->photo = ''; } else { $estate->photo = $folder . $dataupload['file_name']; } } if ($estate->save()) { flash_message('success', 'Bản tin đã được thay đổi thành công.'); redirect($this->admin_url . 'estates/listFree/'); //redirect($this->admin_url.'estates/editFree/'.$estate->id); } else { flash_message('error', 'Đã có lỗi xãy ra !'); //redirect($this->admin_url.'estates/listFree/'); redirect($this->admin_url . 'estates/editFree/' . $estate->id); } } $estateCategory = new Estatecatalogue(); $estateCategory->get_iterated(); $dis['estateCategory'] = $estateCategory; $estateType = new Estatetype(); $estateType->order_by('id'); $estateType->where('estatecatalogue_id', $estate->estatecatalogue_id); $estateType->get_iterated(); $dis['estateType'] = $estateType; $estateAreas = new Estatearea(); $estateAreas->order_by('position'); $estateAreas->get_iterated(); $dis['estateAreas'] = $estateAreas; $estateDirection = new Estatedirection(); $estateDirection->order_by('id'); $estateDirection->get_iterated(); $dis['estateDirection'] = $estateDirection; $estatePrices = new Estateprice(); $estatePrices->where('estatecatalogue_id', $estate->estatecatalogue_id); $estatePrices->order_by('position', 'asc'); $estatePrices->get_iterated(); $dis['estatePrices'] = $estatePrices; $estateCities = new Estatecity(); $estateCities->order_by('id'); $estateCities->get_iterated(); $dis['estateCities'] = $estateCities; $estateDictricts = new Estatedistrict(); $estateDictricts->where('estatecity_id', $estate->estatecity_id); $estateDictricts->order_by('position', 'asc'); $estateDictricts->get_iterated(); $dis['estateDictricts'] = $estateDictricts; $estateWards = new Estateward(); $estateWards->where('estatedistrict_id', $estate->estatedistrict_id); $estateWards->order_by('position'); $estateWards->get_iterated(); $dis['estateWards'] = $estateWards; $project = new Article(); $project->where('recycle', 0); $project->where('estatecity_id', $estate->estatecity_id); $project->order_by('title_vietnamese', 'asc'); $project->get_iterated(); $dis['project'] = $project; $dis['object'] = $estate; $dis['base_url'] = base_url(); $dis['view'] = 'estate/edit_free'; $dis['menu_active'] = 'Tin bất động sản (miễn phí)'; $dis['title'] = "Thêm/Sửa Tin '" . $estate->title . "'"; $dis['nav_menu'] = array(array("type" => "back", "text" => "Quay về", "link" => "{$this->admin_url}estates/listFree", "onclick" => "")); $this->viewadmin($dis); }