Exemplo n.º 1
0
function count_static_by_area($url_type, $url_district, $url_areas)
{
    $CI =& get_instance();
    $estates = new Estate();
    $estates->order_by('isVip', 'desc');
    $estates->order_by('created', 'desc');
    $estates->where_related_estatetype('name_none', $url_type);
    $estates->where_related_estatedistrict('name_none', $url_district);
    $estates->where_related_estatearea('url', $url_areas);
    $estates->get();
    return $estates->result_count();
}
Exemplo n.º 2
0
 function tagsDangTin($url)
 {
     $url = $this->uri->segment(2, "");
     $arrUrl = explode('.', $url);
     $title = $arrUrl[0];
     $query_string = explode($arrUrl[0] . '.html&', $this->uri->segment(2, ""));
     parse_str($query_string[1], $_GET);
     $this->load->library('pagination');
     $limit = 20;
     $page = $_GET['per_page'] == "" ? 1 : $_GET['per_page'];
     $offset = ($page - 1) * $limit;
     $tags = explode('-', $title);
     $title = implode(' ', $tags);
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->group_start();
     $estates->like('tag_search', '%' . $title . '%');
     $estates->group_end();
     $estates->get_paged($offset, $limit, TRUE);
     $dis['estates'] = $estates;
     $estatesAll = new Estate();
     $estatesAll->order_by('isVip', 'desc');
     $estatesAll->order_by('created', 'desc');
     $estatesAll->group_start();
     $estatesAll->like('tag_search', '%' . $title . '%');
     $estatesAll->group_end();
     $estatesAll->get_iterated();
     $url = base_url() . $this->uri->segment(1) . '/' . $arrUrl[0] . '.html';
     $config['base_url'] = $url;
     $config['total_rows'] = $estatesAll->result_count();
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['page_query_string'] = TRUE;
     $config['uri_segment'] = 2;
     $config['num_links'] = 2;
     $config['full_tag_open'] = '<div class="news-pagination">';
     $config['full_tag_close'] = "</div>";
     $config['first_link'] = FALSE;
     $config['first_tag_open'] = '';
     $config['first_tag_close'] = '';
     $config['last_link'] = FALSE;
     $config['last_tag_open'] = '';
     $config['last_tag_close'] = '';
     $config['next_link'] = '>';
     $config['next_tag_open'] = '';
     $config['next_tag_close'] = '';
     $config['prev_link'] = '<';
     $config['prev_tag_open'] = '';
     $config['prev_tag_close'] = '';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['cur_tag_open'] = '<span class="active">';
     $config['cur_tag_close'] = '</span>';
     $this->pagination->initialize($config);
     // support seo
     $this->page_title = 'Thông tin ' . $title . ' mới nhất';
     $this->page_description = $title . ' với đầy đủ thông tin giá, hình ảnh, hướng, vị trí...cập nhật nhất';
     $keyword = explode(' ', $this->page_title);
     $this->page_keyword = implode(',', $keyword);
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/tags';
     $this->viewfront($dis);
 }
Exemplo n.º 3
0
 function tagsDangTin($url)
 {
     $title = geturlfromuri($this->uri->segment(2));
     $tags = explode('-', $title);
     $title = implode(' ', $tags);
     $estates = new Estate();
     $estates->order_by('created', 'desc');
     $estates->group_start();
     $estates->like('tag_search', '%' . $title . '%');
     $estates->group_end();
     $estates->get();
     $dis['estates'] = $estates;
     // seo
     $this->page_title = $title . ' | ' . $this->page_title;
     $this->page_description = "Có " . $estates->result_count() . " kết quả tìm kiếm với từ khóa " . $title . ' | ' . $this->page_description;
     $this->page_keyword = $this->page_keyword;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/tags';
     $this->viewfront($dis);
 }
Exemplo n.º 4
0
 function listPostByUser()
 {
     if ($this->session->userdata('userLoginFlag') != 1) {
         redirect(base_url() . 'dang-nhap');
     }
     $customer = new Estateuser($this->session->userdata('userLoginId'));
     if (!$customer->exists()) {
         show_404();
     }
     $dis['customer'] = $customer;
     $level = 1;
     $page = $this->uri->segment($level + 1, "") == "" ? 0 : $this->uri->segment($level + 1);
     $dis['page'] = $page;
     $limit = 15;
     $offset = $page + 1;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $estatecatalogue_id = $this->input->post('estatecatalogue_id');
         $estatetype_id = $this->input->post('estatetype_id');
         $estateprice_id = $this->input->post('estateprice_id');
         $estates = new Estate();
         $estates->where_related_estateuser('id', $this->session->userdata('userLoginId'));
         $estates->where(array('isFree' => 0));
         if ($estatecatalogue_id != 0) {
             $estates->where('estatecatalogue_id', $estatecatalogue_id);
         }
         if ($estatetype_id != 0) {
             $estates->where('estatetype_id', $estatetype_id);
         }
         if ($estateprice_id != 0) {
             $estates->where('estateprice_id', $estateprice_id);
         }
         $estates->order_by('created', 'desc');
         $estates->get_paged($offset, $limit, TRUE);
         $dis['estates'] = $estates;
         setPaginationVb('chinh-sua-tin-da-dang/', $estates->paged->total_rows, $limit, 2);
     } else {
         $estates = new Estate();
         $estates->where_related_estateuser('id', $this->session->userdata('userLoginId'));
         $estates->where('isFree', 0);
         $estates->order_by('created', 'desc');
         $estates->get_paged($offset, $limit, TRUE);
         $dis['estates'] = $estates;
         setPaginationVb('chinh-sua-tin-da-dang/', $estates->paged->total_rows, $limit, 2);
         /*$estatesAll = new Estate();
           $estatesAll->where_related_estateuser('id', $this->session->userdata('userLoginId'));
           $estatesAll->order_by('created','desc');
           $estatesAll->get();
           $total = $estatesAll->result_count();*/
     }
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/user/list-post';
     $this->viewfront($dis);
 }
Exemplo n.º 5
0
 function staticByPrices()
 {
     $url_type = $this->uri->segment(2);
     $cat_type = new Estatetype();
     $cat_type->where('name_none', $url_type)->get();
     $dis['cat_type'] = $cat_type;
     $url_district = $this->uri->segment(3);
     $cat_districts = new Estatedistrict();
     $cat_districts->where('name_none', $url_district)->get();
     $dis['cat_districts'] = $cat_districts;
     $url_price = $this->uri->segment(4);
     $cat_price = new Estateprice();
     $cat_price->where('url', $url_price)->get();
     $dis['cat_price'] = $cat_price;
     $level = 4;
     $page = $this->uri->segment($level + 1, "") == "" ? 1 : $this->uri->segment($level + 1);
     $dis['page'] = $page;
     $limit = 20;
     $offset = ($page - 1) * $limit;
     /*get page estate*/
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->where_related_estatetype('name_none', $url_type);
     $estates->where_related_estatedistrict('name_none', $url_district);
     $estates->where_related_estateprice('url', $url_price);
     $estates->get_paged($offset, $limit, TRUE);
     $dis['estates'] = $estates;
     /*get all estate*/
     $estates = new Estate();
     $estates->order_by('isVip', 'desc');
     $estates->order_by('created', 'desc');
     $estates->where_related_estatetype('name_none', $url_type);
     $estates->where_related_estatedistrict('name_none', $url_district);
     $estates->where_related_estateprice('url', $url_price);
     $estates->get();
     $total = $estates->result_count();
     /*Begin pagination for product*/
     $url = 'thong-ke-theo-muc-gia/' . $url_type . '/' . $url_district . '/' . $url_price;
     $config['base_url'] = site_url($url);
     $config['total_rows'] = $total;
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['uri_segment'] = 5;
     $config['num_links'] = 5;
     $config['full_tag_open'] = '<div class="news-pagination">';
     $config['full_tag_close'] = "</div>";
     $config['first_link'] = FALSE;
     $config['first_tag_open'] = '';
     $config['first_tag_close'] = '';
     $config['last_link'] = FALSE;
     $config['last_tag_open'] = '';
     $config['last_tag_close'] = '';
     $config['next_link'] = '>';
     $config['next_tag_open'] = '';
     $config['next_tag_close'] = '';
     $config['prev_link'] = '<';
     $config['prev_tag_open'] = '';
     $config['prev_tag_close'] = '';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['cur_tag_open'] = '<span class="active">';
     $config['cur_tag_close'] = '</span>';
     $this->pagination->initialize($config);
     /*End pagination for product*/
     $this->page_title = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' | ' . $cat_type->name . ' tại ' . $cat_districts->name;
     $this->page_description = $cat_type->name . ' tại ' . $cat_districts->name . ' giá từ ' . $cat_price->label . ' với đầy đủ hình ảnh, hướng, vị trí khác nhau... để bạn lựa chọn. ' . 'Thông tin ' . $cat_type->name . ' tại ' . $cat_districts->name . ' cập nhật nhất!';
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/estates/by-prices';
     $this->viewfront($dis);
 }
Exemplo n.º 6
0
 function listEstates($user_id)
 {
     $estateuser = new Estateuser($user_id);
     $estates = new Estate();
     $estates->where('estateuser_id', $user_id);
     $estates->order_by('created', 'desc');
     $estates->get_iterated();
     $dis['estates'] = $estates;
     $dis['estateuser'] = $estateuser;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estateuser/list_by_user';
     $dis['menu_active'] = "Thành viên";
     $dis['title'] = 'Danh sách các Tin bất động sản của "' . $estateuser->firstname . ' ' . $estateuser->name . '"';
     $dis['title_table'] = "Trang hiện tại:" . $estates->paged->current_page . '/' . $estates->paged->total_pages;
     $this->viewadmin($dis);
 }
Exemplo n.º 7
0
 function index($offset = 0, $limit = 800)
 {
     $estates = new Estate();
     $estates->where('isFree', 0);
     $estates->order_by('id', 'desc');
     $estates->get_paged($offset, $limit, TRUE);
     $xmlFile = "mitula_feed_" . $offset . "_" . $limit . ".xml";
     $xmlFile = $_SERVER['DOCUMENT_ROOT'] . '/feeds/' . $xmlFile;
     //$f = fopen($xmlFile, 'w');
     //create the xml document
     $xmlDoc = new DOMDocument('1.0', 'UTF-8');
     $root = $xmlDoc->createElement('Mitula');
     $xmlDoc->appendChild($root);
     foreach ($estates as $row) {
         $ad = $xmlDoc->createElement('ad');
         // create id for ad
         $id = $xmlDoc->createElement('id');
         $id->appendChild($xmlDoc->createCDATASection($row->code));
         // create url for ad
         $url = $xmlDoc->createElement('name');
         $url->appendChild($xmlDoc->createCDATASection(base_url() . $row->estatecatalogue->name_none . '/' . $row->estatecity->name_none . '/' . $row->title_none . '.html'));
         // create title for ad
         $title = $xmlDoc->createElement('title');
         $title->appendChild($xmlDoc->createCDATASection($row->title));
         // create type for ad
         $type = $xmlDoc->createElement('type');
         $type->appendChild($xmlDoc->createCDATASection($row->estatetype->name));
         // create content for ad
         $content = $xmlDoc->createElement('content');
         $content->appendChild($xmlDoc->createCDATASection($row->description));
         // create price for ad
         $price = $xmlDoc->createElement('price');
         $period = $xmlDoc->createAttribute('period');
         $period->value = 'monthly';
         $price->appendChild($period);
         $price->appendChild($xmlDoc->createCDATASection($row->price_text . ' ' . getpricetype($row->price_type)));
         // create floor_area for ad
         $floor_area = $xmlDoc->createElement('floor_area');
         $floor_area->appendChild($xmlDoc->createCDATASection($row->area_text . ' m2'));
         // create city for ad
         $city = $xmlDoc->createElement('city');
         $city->appendChild($xmlDoc->createCDATASection($row->estatecity->name));
         // create address for ad
         $address = $xmlDoc->createElement('address');
         $address->appendChild($xmlDoc->createCDATASection($row->address));
         $photos = new Estate_photo();
         $photos->where('estate_id', $row->id);
         $photos->get();
         if ($row->photo != null || $photos->result_count() > 0) {
             $pictures = $xmlDoc->createElement('pictures');
             $picture = $xmlDoc->createElement('picture');
             $pictureTitle = $xmlDoc->createElement('picture_title');
             $pictureTitle->appendChild($xmlDoc->createCDATASection($row->title));
             $pictureUrl = $xmlDoc->createElement('picture_url');
             $pictureUrl->appendChild($xmlDoc->createCDATASection(image($row->photo, 'slide_580_380')));
             $picture->appendChild($pictureUrl);
             $picture->appendChild($pictureTitle);
             if ($photos->result_count() > 0) {
                 foreach ($photos as $photo) {
                     $rowPhoto = new Estate_photo($photo->id);
                     $picture = $xmlDoc->createElement('picture');
                     $pictureTitle = $xmlDoc->createElement('picture_title');
                     $pictureTitle->appendChild($xmlDoc->createCDATASection($row->title));
                     $pictureUrl = $xmlDoc->createElement('picture_url');
                     $pictureUrl->appendChild($xmlDoc->createCDATASection(image($rowPhoto->name, 'slide_580_380')));
                     $picture->appendChild($pictureUrl);
                     $picture->appendChild($pictureTitle);
                     $pictures->appendChild($picture);
                 }
             }
             $pictures->appendChild($picture);
         }
         $ad->appendChild($id);
         $ad->appendChild($url);
         $ad->appendChild($title);
         $ad->appendChild($type);
         $ad->appendChild($content);
         $ad->appendChild($price);
         $ad->appendChild($floor_area);
         $ad->appendChild($city);
         $ad->appendChild($address);
         $ad->appendChild($pictures);
         $root->appendChild($ad);
     }
     //make the output pretty
     $xmlDoc->formatOutput = true;
     // Flush XML from memory to file in one go
     $result = file_put_contents($xmlFile, $xmlDoc->saveXML()) or print_r(error_get_last());
     if ($result == false) {
         echo "Error";
     } else {
         echo $xmlFile . " All good, {$result} bytes written";
     }
     die;
 }
Exemplo n.º 8
0
 function searchFree($params)
 {
     $this->load->library('pagination');
     parse_str(array_pop(explode('?', $_SERVER['REQUEST_URI'], 2)), $_GET);
     $limit = 50;
     $offset = $_GET['per_page'] == "" ? 0 : $_GET['per_page'];
     $estates = new Estate();
     $estates->where('isFree', 1);
     $estates->order_by('id', 'desc');
     if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) {
         $estates->like('code', $_GET['searchKey']);
     }
     if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) {
         $estates->where('estatecatalogue_id', $_GET['estatecatalogue_id']);
     }
     if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) {
         $estates->where('estatetype_id', $_GET['estatetype_id']);
     }
     if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) {
         $estates->where('estateprice_id', $_GET['estateprice_id']);
     }
     if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) {
         $estates->where('estatearea_id', $_GET['estatearea_id']);
     }
     if ($_GET['isReals'] != "" && isset($_GET['isReals'])) {
         if ($_GET['isReals'] != -1) {
             $estates->where('isReals', $_GET['isReals']);
         }
     }
     $estates->get_paged($offset, $limit, TRUE);
     // get all estate search
     $estatesAll = new Estate();
     $estatesAll->where('isFree', 1);
     $estatesAll->order_by('id', 'desc');
     if ($_GET['searchKey'] != "" && isset($_GET['searchKey'])) {
         $estatesAll->like('code', $_GET['searchKey']);
     }
     if ($_GET['estatecatalogue_id'] != "" && isset($_GET['estatecatalogue_id'])) {
         $estatesAll->where('estatecatalogue_id', $_GET['estatecatalogue_id']);
     }
     if ($_GET['estatetype_id'] != "" && isset($_GET['estatetype_id'])) {
         $estatesAll->where('estatetype_id', $_GET['estatetype_id']);
     }
     if ($_GET['estateprice_id'] != "" && isset($_GET['estateprice_id'])) {
         $estatesAll->where('estateprice_id', $_GET['estateprice_id']);
     }
     if ($_GET['estatearea_id'] != "" && isset($_GET['estatearea_id'])) {
         $estatesAll->where('estatearea_id', $_GET['estatearea_id']);
     }
     if ($_GET['isReals'] != "" && isset($_GET['isReals'])) {
         if ($_GET['isReals'] != -1) {
             $estatesAll->where('isReals', $_GET['isReals']);
         }
     }
     $estatesAll->get_iterated();
     $url = $_SERVER['REQUEST_URI'];
     $config['base_url'] = $url;
     $config['total_rows'] = $estatesAll->result_count();
     $config['per_page'] = $limit;
     $config['page_query_string'] = TRUE;
     $this->pagination->initialize($config);
     $estateareas = new Estatearea();
     $estateareas->order_by('position', 'asc');
     $estateareas->get_iterated();
     $dis['estateareas'] = $estateareas;
     $estateusers = new Estateuser();
     $estateusers->order_by('name', 'asc');
     $estateusers->get_iterated();
     $dis['estateusers'] = $estateusers;
     $dis['estates'] = $estates;
     $dis['page_i'] = $offset;
     $dis['base_url'] = base_url();
     $dis['view'] = 'estate/searchFree';
     $dis['menu_active'] = 'Tin bất động sản (miễn phí)';
     $dis['title'] = "Tìm kiếm bất động sản";
     $this->viewadmin($dis);
 }