145 lines
4.4 KiB
PHP
Executable File
145 lines
4.4 KiB
PHP
Executable File
<?
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class m_bbs_notice extends CI_Model{
|
|
|
|
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
|
function __construct(){
|
|
parent::__construct();
|
|
|
|
$this->load->database();
|
|
$this->load->library('session');
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list
|
|
# CREATE : 2018-05-04
|
|
#---------------------------------------------------------------------------
|
|
function bbs_notice_list($req_data){
|
|
# request
|
|
$offset = $req_data['offset'];
|
|
$limit = $req_data['limit'];
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
|
|
if($search_type=='total' && $search_keyword != '') {
|
|
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
|
}
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('bbs_notice');
|
|
$this->db->limit($limit, $offset);
|
|
$this->db->order_by('reg_date', 'desc');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list - total count
|
|
# CREATE : 2018-05-04
|
|
#---------------------------------------------------------------------------
|
|
function bbs_notice_list_total_count($req_data){
|
|
# request
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
|
|
if($search_type=='total' && $search_keyword != '') {
|
|
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
|
}
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('bbs_notice');
|
|
$row = $this->db->count_all_results();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : select
|
|
# CREATE : 2018-05-04
|
|
#---------------------------------------------------------------------------
|
|
function bbs_notice_select($idx){
|
|
|
|
$this->db->where('idx', $idx);
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('bbs_notice');
|
|
$res = $this->db->get();
|
|
$row = $res->row_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : next_list
|
|
# CREATE : 2018-05-04
|
|
#---------------------------------------------------------------------------
|
|
function bbs_notice_next_list($req_data){
|
|
# request
|
|
$offset = $req_data['offset'];
|
|
$limit = $req_data['limit'];
|
|
$search_type = $req_data['search_type'];
|
|
$search_keyword = $req_data['search_keyword'];
|
|
$idx = $req_data['idx'];
|
|
|
|
if($search_type=='total' && $search_keyword != '') {
|
|
$this->db->where('(title like "%'.$search_keyword.'%" or content like "%'.$search_keyword.'%")');
|
|
}
|
|
|
|
$this->db->where('idx < '.$idx);
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('bbs_notice');
|
|
$this->db->limit($limit, $offset);
|
|
$this->db->order_by('reg_date', 'desc');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function bbs_notice_order_by_reg_date_limit1_select(){
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('bbs_notice');
|
|
$this->db->limit(1, 0);
|
|
$this->db->order_by('reg_date', 'desc');
|
|
$res = $this->db->get();
|
|
$row = $res->row_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
|
|
function bbs_notice_new(){
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->where('reg_date > CURRENT_DATE()');
|
|
$this->db->from('bbs_notice');
|
|
$this->db->order_by('reg_date', 'desc');
|
|
$row = $this->db->count_all_results();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|