94 lines
2.6 KiB
PHP
Executable File
94 lines
2.6 KiB
PHP
Executable File
<?
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class m_channel extends CI_Model{
|
|
|
|
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
|
|
function __construct(){
|
|
parent::__construct();
|
|
|
|
$this->load->database();
|
|
$this->load->library('session');
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list
|
|
# CREATE : 2018-04-11
|
|
#---------------------------------------------------------------------------
|
|
function channel_list($req_data){
|
|
# request
|
|
$offset = $req_data['offset'];
|
|
$limit = $req_data['limit'];
|
|
$sort_column = $req_data['sort_column'];
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('channel');
|
|
$this->db->limit($limit, $offset);
|
|
$this->db->order_by($sort_column, 'desc');
|
|
$res = $this->db->get();
|
|
$row = $res->result_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : list - total count
|
|
# CREATE : 2018-04-11
|
|
#---------------------------------------------------------------------------
|
|
function channel_list_total_count(){
|
|
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('channel');
|
|
$row = $this->db->count_all_results();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : select
|
|
# CREATE : 2018-04-30
|
|
#---------------------------------------------------------------------------
|
|
function channel_select($idx){
|
|
|
|
$this->db->where('idx', $idx);
|
|
$this->db->where('is_del', 'N');
|
|
$this->db->from('channel');
|
|
$res = $this->db->get();
|
|
$row = $res->row_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : join category select
|
|
# CREATE : 2018-04-30
|
|
#---------------------------------------------------------------------------
|
|
function channel_join_category_select($idx){
|
|
|
|
$this->db->select('a.*, b.category_name');
|
|
$this->db->where('a.idx', $idx);
|
|
$this->db->where('a.is_del', 'N');
|
|
$this->db->where('b.is_del', 'N');
|
|
$this->db->from('channel as a');
|
|
$this->db->join('category as b', 'a.category_idx=b.idx');
|
|
$res = $this->db->get();
|
|
$row = $res->row_array();
|
|
|
|
return $row;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
?>
|