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

230 lines
9.7 KiB
PHP
Executable File

<?php defined('BASEPATH') OR exit('No direct script access allowed');
header("Content-Type: text/html; charset=UTF-8");
/**
* 인클루드 class
*
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
*/
include_once(APPPATH.'core/admin/cm_controller.php');
class design extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 리스트
# CREATE : 2018-02-22
#---------------------------------------------------------------------------
function fn_design_popup_list() {
# request
$page = $this->uri->segment(5);
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['search_menu_code'] = $search_menu_code;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/design/m_design');
$total_count = $this->m_design->popup_list_total_count($req_data);
$result = $this->m_design->popup_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/design/design_popup_list/4' ;
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
$this->load->library('comm_admin');
$pagination = $this->comm_admin->fn_pagination($req_data);
# view data
$return_data['pagination'] = $pagination;
$return_data['page'] = $page;
$return_data['limit'] = $limit;
$return_data['total_count'] = $total_count;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_menu_code'] = $search_menu_code;
$return_data['list'] = $result;
# view
return $this->load->view('/admin/design/design_popup_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function fn_design_popup_reg() {
# request
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$result = array();
if($mode == 'edit') {
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_select($idx);
if(count($result) == 0) {
gf_alert("잘못된 접근입니다.", '/admin/design/design_popup_list/8');
exit;
}
$result = $result[0];
}
# view data
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_menu_code'] = $search_menu_code;
$return_data['mode'] = $mode;
$return_data['result'] = $result;
# view
return $this->load->view('/admin/design/design_popup_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 저장
# CREATE : 2018-02-26
#---------------------------------------------------------------------------
function fn_design_popup_reg_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$page = trim($this->input->get_post('page', TRUE));;
$search_type = trim($this->input->get_post('search_type', TRUE));
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
$popup_type_name = trim($this->input->get_post('popup_type_name', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$menu_code = trim($this->input->get_post('menu_code', TRUE));
$top_margin = trim($this->input->get_post('top_margin', TRUE));
$left_margin = trim($this->input->get_post('left_margin', TRUE));
$width_size = trim($this->input->get_post('width_size', TRUE));
$height_size = trim($this->input->get_post('height_size', TRUE));
$link_url = trim($this->input->get_post('link_url', TRUE));
$content = trim($this->input->get_post('content', FALSE));
$start_date = trim($this->input->get_post('start_date', TRUE));
$end_date = trim($this->input->get_post('end_date', TRUE));
$start_time1 = trim($this->input->get_post('start_time1', TRUE));
$start_time2 = trim($this->input->get_post('start_time2', TRUE));
$end_time1 = trim($this->input->get_post('end_time1', TRUE));
$end_time2 = trim($this->input->get_post('end_time2', TRUE));
$is_display = trim($this->input->get_post('is_display', TRUE));
$prev_img = trim($this->input->get_post('img_path', TRUE));
if($start_time1=='') $start_time1 = '00';
if($start_time2=='') $start_time2 = '00';
if($end_time1=='') $end_time1 = '00';
if($end_time2=='') $end_time2 = '00';
$start_time = $start_time1.':'.$start_time2;
$end_time = $end_time1.':'.$end_time2;
$start_date = $start_date.' '.$start_time;
$end_date = $end_date.' '.$end_time;
# req data
$req_data['idx'] = $idx;
$req_data['popup_type_name']= $popup_type_name;
$req_data['title'] = $title;
$req_data['menu_code'] = $menu_code;
$req_data['top_margin'] = $top_margin;
$req_data['left_margin'] = $left_margin;
$req_data['width_size'] = $width_size;
$req_data['height_size'] = $height_size;
$req_data['link_url'] = $link_url;
$req_data['content'] = $content;
$req_data['start_date'] = $start_date;
$req_data['end_date'] = $end_date;
$req_data['is_display'] = $is_display;
$req_data['prev_img'] = $prev_img;
if($mode == 'add') { // 등록
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_insert($req_data);
$go_url = '/admin/design/design_popup_list/8/';
} else if($mode == 'edit') { // 수정
# model
$this->load->model('admin/design/m_design');
$result = $this->m_design->popup_update($req_data);
$go_url = '/admin/design/design_popup_list/8/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_menu_code='.$search_menu_code;
}
if(!$result) {
gf_alert("저장에 실패했습니다.", 'back');
exit;
}
gf_alert("저장되었습니다.", $go_url);
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리
# CREATE : 2018-02-27
#---------------------------------------------------------------------------
function fn_design_popup_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_date[] = $idx;
# model - update
$this->load->model('admin/design/m_design');
$this->m_design->popup_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
}
#---------------------------------------------------------------------------
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리 (다중)
# CREATE : 2018-02-20
#---------------------------------------------------------------------------
function fn_design_popup_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model - update
# model - update
$this->load->model('admin/design/m_design');
$this->m_design->popup_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
}
}
?>