function save($object = '', $related_field = '') { if (!$this->exists()) { $o = new Estateuser(); $o->select_max('position'); $o->get(); if (count($o->all) != 0) { $max = $o->position + 1; $this->position = $max; } else { $this->postion = 1; } } return parent::save($object, $related_field); }
function contact() { $customer = new Estateuser($this->session->userdata('userLoginId')); if (!$customer->exists()) { show_404(); } $dis['customer'] = $customer; $news = new Article(1273); $dis['base_url'] = base_url(); $dis['view'] = 'front/user/vip'; $dis['news'] = $news; $this->page_title = "Liên hệ - " . $this->page_title; $this->page_keyword = "Liên hệ "; $this->page_description = "thông tin, địa chỉ liên hệ "; $this->viewfront($dis); }
function phoneCheck() { $mobile = $this->input->post('mobile'); $o = new Estateuser(); $o->get_by_mobile($mobile); if ($o->exists()) { echo 'false'; } else { echo 'true'; } exit; }
function lock($id = 0, $value) { if ($id != 0) { $estateuser = new Estateuser($id); if (!$estateuser->exists()) { show_404(); } $estateuser->isLock = ($estateuser->isLock + 1) % 2; $estateuser->save(); } flash_message('success', "Thao tác thành công."); redirect($_SERVER['HTTP_REFERER']); }
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); }