function send_mail_all() { if ($_SERVER['REQUEST_METHOD'] == "POST") { $title = $this->input->post('title'); $content = $this->input->post('txtFull_vietnamese'); $name_form = getconfigkey('name_contact'); $email_form = getconfigkey('email_contact'); $estateusers = new Estateuser(); $estateusers->where('active', 1); $estateusers->get_iterated(); $list_error = array(); foreach ($estateusers as $row) { if (!$this->sendemail($title, $content, $row->email)) { array_push($list_error, $row->name); } } if (count($list_error) == 0) { flash_message('success', 'Gửi mail thành công.'); redirect($this->admin . 'estateusers/list_all'); } else { flash_message('error', 'Có lỗi trong quá trình gửi mail đến các thành viên sau:'); foreach ($list_error as $row) { flash_message('error', $row); } redirect($this->admin . 'estateusers/list_all'); } } $sitelanguage = new Sitelanguage(); $sitelanguage->order_by('position', 'asc'); $sitelanguage->get(); $dis['sitelanguage'] = $sitelanguage; $dis['base_url'] = base_url(); $dis['view'] = 'estateuser/send_mail_all'; $dis['menu_active'] = 'Gửi mail'; $dis['title'] = "Gửi mail đến tất cả thành viên"; $this->viewadmin($dis); }
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); }