Files
2020-06-10 06:19:03 +09:00

356 lines
12 KiB
PHP
Executable File

<?
defined('BASEPATH') OR exit('No direct script access allowed');
class m_theme extends CI_Model{
// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - rank count
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_rank_count($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$this->db->where('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$this->db->from('theme');
$row = $this->db->count_all_results();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_rank_is_del_update($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
if($user_id=='') $user_id = 'system';
$update_data['is_del'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$this->db->where('is_display', 'Y');
$row = $this->db->update('theme', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 insert
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_insert($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['reg_id'] = $user_id;
$req_data['reg_date'] = $now_date;
$req_data['update_id'] = $user_id;
$req_data['update_date']= $now_date;
$row = $this->db->insert('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_content_idx_select($req_data){
# request
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx - list
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_content_idx_list($req_data){
# request
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$search_type = $req_data['search_type'];
$search_key = $req_data['search_key'];
if($search_type!='' && $search_key!='') $this->db->where($search_type, $search_key);
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 type list - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_type_list($req_data){
# request
$content_type = $req_data['content_type'];
$theme_type = $req_data['theme_type'];
$this->db->where('content_type', $content_type);
$this->db->where('theme_type', $theme_type);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_where_idx_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_update($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$rank = $req_data['rank'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('theme_type', $theme_type);
$this->db->where('content_type', $content_type);
$this->db->where('rank', $rank);
$this->db->where('is_del', 'N');
$row = $this->db->update('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - select
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_select($req_data){
# request
$idx = $req_data;
$this->db->where('idx', $idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 is_del update
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_is_del_update($req_data){
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($req_data as $key=>$val) {
$arr_update_data[$key]['idx'] = $val;
$arr_update_data[$key]['is_del'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$this->db->update_batch('theme', $arr_update_data, 'idx');
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - select in idx
# CREATE : 2018-03-06
#---------------------------------------------------------------------------
function theme_select_in_idx($req_data){
# request
$arr_idx = $req_data;
$this->db->where_in('idx', $arr_idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update where content_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_is_display_where_content_idx_update($req_data){
# request
$content_idx = $req_data['content_idx'];
$content_type = $req_data['content_type'];
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$update_data['is_display'] = 'Y';
$update_data['update_id'] = $user_id;
$update_data['update_date'] = $now_date;
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_display', 'N');
$this->db->where('is_del', 'N');
$row = $this->db->update('theme', $update_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 content_idx
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_rank_content_idx_select($req_data){
# request
$theme_type = $req_data['theme_type'];
$content_type = $req_data['content_type'];
$content_idx = $req_data['content_idx'];
$rank = $req_data['rank'];
$this->db->select('idx');
$this->db->where('theme_type', $theme_type);
$this->db->where('rank', $rank);
$this->db->where('content_type', $content_type);
$this->db->where('content_idx', $content_idx);
$this->db->where('is_del', 'N');
$this->db->from('theme');
$res = $this->db->get();
$row = $res->result_array();
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : 테마 - update
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function theme_item_update($req_data){
# request
$idx = $req_data['idx'];
unset($req_data['idx']);
$user_id = $this->session->userdata('Adm_Id');
$now_date = date("Y-m-d H:i:s");
$req_data['update_id'] = $user_id;
$req_data['update_date'] = $now_date;
$this->db->where('idx', $idx);
$row = $this->db->update('theme', $req_data);
return $row;
}
#---------------------------------------------------------------------------
# PURPOSE : is_display update batch - 스케쥴에서 사용중
# CREATE : 2018-03-30
#---------------------------------------------------------------------------
function theme_is_display_update_batch($req_data){
$user_id = 'system';
$now_date = date("Y-m-d H:i:s");
$arr_update_data = array();
foreach($req_data as $key=>$val) {
$arr_update_data[$key]['idx'] = $val['idx'];
$arr_update_data[$key]['is_display'] = 'Y';
$arr_update_data[$key]['update_id'] = $user_id;
$arr_update_data[$key]['update_date'] = $now_date;
}
$row = $this->db->update_batch('theme', $arr_update_data, 'idx');
return $row;
}
}
?>