Files
cm-web-legacy/application/controllers/admin/etc_section.php
2020-06-10 06:19:03 +09:00

3217 lines
132 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 etc_section extends cm_Controller {
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 언론사관리
# CREATE : 2018-02-28
#---------------------------------------------------------------------------
function fn_press_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));
$sort = trim($this->input->get_post('sort', TRUE));
$search_click1 = trim($this->input->get_post('search_click1', TRUE));
if($sort=='') $sort = '1';
switch ($sort) {
case '1': $sort_column = 'reg_date'; break;
case '2': $sort_column = 'article_count'; break;
default : $sort_column = 'reg_date'; break;
}
# 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_click1'] = $search_click1;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_press');
$total_count = $this->m_press->press_list_total_count($req_data);
$result = $this->m_press->press_list($req_data);
$direct_count = $this->m_press->press_is_direct_list_count($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/press_list/6' ;
$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_click1'] = $search_click1;
$return_data['sort'] = $sort;
$return_data['direct_count'] = $direct_count;
$return_data['list'] = $result;
# view
return $this->load->view('/admin/etc_section/press_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 언론사관리 - 저장
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_press_reg_proc() {
# 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));
$sort = trim($this->input->get_post('sort', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$search_click1 = trim($this->input->get_post('search_click1', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$press_name = trim($this->input->get_post('press_name', TRUE));
$homepage = trim($this->input->get_post('homepage', TRUE));
$is_direct = trim($this->input->get_post('is_direct', TRUE));
$display_sort = trim($this->input->get_post('display_sort', TRUE));
$is_del_img = trim($this->input->get_post('is_del_img', TRUE));
$org_logo_img = trim($this->input->get_post('org_logo_img', TRUE));
if($is_direct!='Y') $is_direct = 'N';
# 이미지 삭제
if($is_del_img=='Y') {
unlink('.'.$org_logo_img);
$org_logo_img = '';
}
# 이미지업로드
if($_FILES['logo_img']['name']!='') {
# image upload
$upload_path = './files/press/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('logo_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_logo_img;
}
# update data
$req_data['press_name'] = $press_name;
$req_data['homepage'] = $homepage;
$req_data['is_direct'] = $is_direct;
$req_data['display_sort'] = $display_sort;
$req_data['logo_img'] = $filename;
if($mode=='add') {
# model
$this->load->model('admin/etc_section/m_press');
$result = $this->m_press->press_insert($req_data);
if(!$result) {
gf_alert("언론사등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/press_list/6';
} else if($mode=='edit') {
$req_data['idx'] = $idx;
# model
$this->load->model('admin/etc_section/m_press');
$result = $this->m_press->press_update($req_data);
if(!$result) {
gf_alert("언론사수정에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/press_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&sort='.$sort.'&search_click1='.$search_click1;
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 언론사관리 - 상세정보
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_ajax_press_detail() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_press');
$result = $this->m_press->press_select($idx);
$return_data['result'] = array('result_code' => '9999');
if(count($result) > 0){
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$result[0]);
}
# view
return $this->load->view('/admin/etc_section/press_detail', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 언론사관리 - 삭제
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_press_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_press');
// 이미지 삭제
$result1 = $this->m_press->press_select($idx);
if(count($result1) > 0){
if($result1[0]['logo_img']!=''){
unlink('.'.$result1[0]['logo_img']);
}
}
$req_date[] = $idx;
# model - update
$this->m_press->press_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/etc_section/press_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 언론사관리 - 삭제 (다중)
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_press_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_press');
// 이미지 삭제
$result1 = $this->m_press->press_select_in_idx($arr_idx);
if(count($result1) > 0){
foreach ($result1 as $val) {
if($val['logo_img']!=''){
unlink('.'.$val['logo_img']);
}
}
}
# model - update
$this->m_press->press_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/press_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 리스트
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_main_category_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_category_code1 = trim($this->input->get_post('search_category_code1', TRUE));
$search_category_code2 = trim($this->input->get_post('search_category_code2', 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_category_code1'] = $search_category_code1;
$req_data['search_category_code2'] = $search_category_code2;
$req_data['search_depth'] = '1';
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_main_category');
$total_count = $this->m_main_category->main_category_list_total_count($req_data);
$result = $this->m_main_category->main_category_list($req_data);
$arr_category = $this->m_main_category->main_category_all_list(1);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/main_category_list/6' ;
$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_category_code1'] = $search_category_code1;
$return_data['list'] = $result;
$return_data['arr_category'] = $arr_category;
# view
return $this->load->view('/admin/etc_section/main_category_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 - 저장
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_main_category_reg_proc() {
# 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_category_code1 = trim($this->input->get_post('search_category_code1', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$idx = trim($this->input->get_post('category_idx', TRUE));
$category_name = trim($this->input->get_post('category_name', TRUE));
$is_del_img = trim($this->input->get_post('is_del_img', TRUE));
$org_category_img = trim($this->input->get_post('org_category_img', TRUE));
$p_category_code = trim($this->input->get_post('p_category_code', TRUE));
$display_sort = trim($this->input->get_post('display_sort', TRUE));
# 이미지 삭제
if($is_del_img=='Y') {
unlink('.'.$org_category_img);
$org_category_img = '';
}
# 이미지업로드
if($_FILES['category_img']['name']!='') {
# image upload
$upload_path = './files/main_category/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('category_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_category_img;
}
# update data
$req_data['category_name'] = $category_name;
$req_data['category_img'] = $filename;
$req_data['display_sort'] = $display_sort;
if($mode=='add') {
$depth = '1';
if($p_category_code!='') $depth = '2';
$req_data['p_category_code'] = $p_category_code;
$req_data['depth'] = $depth;
# model
$this->load->model('admin/etc_section/m_main_category');
$result = $this->m_main_category->main_category_insert($req_data);
if(!$result) {
gf_alert("카테고리등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/main_category_list/6';
} else if($mode=='edit') {
$req_data['idx'] = $idx;
# model
$this->load->model('admin/etc_section/m_main_category');
$result = $this->m_main_category->main_category_update($req_data);
if(!$result) {
gf_alert("카테고리수정에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/main_category_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_category_code1='.$search_category_code1;
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 삭제
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_main_category_del_proc() {
# request
$depth = trim($this->input->get_post('depth', TRUE));
$del_key = trim($this->input->get_post('del_key', TRUE));
if($depth == '1') {
$req_data['p_category_code']= $del_key;
$req_data['idx'] = '';
} else {
$req_data['p_category_code']= '';
$req_data['idx'] = $del_key;
}
# model
$this->load->model('admin/etc_section/m_main_category');
$result1 = $this->m_main_category->main_category_select($req_data);
// 이미지 삭제
if(count($result1) > 0){
foreach ($result1 as $val) {
if($val['category_img']!=''){
unlink('.'.$val['category_img']);
}
}
}
# model - update
$this->m_main_category->main_category_is_del_update($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/main_category_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 삭제 (다중)
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_main_category_arr_del_proc() {
# request
$arr_p_category_code = $this->input->get_post('is_del', TRUE);
# model
$this->load->model('admin/etc_section/m_main_category');
// 이미지 삭제
$result1 = $this->m_main_category->main_category_in_p_category_code($arr_p_category_code);
if(count($result1) > 0){
foreach ($result1 as $val) {
if($val['category_img']!=''){
unlink('.'.$val['category_img']);
}
}
}
# model - update
$this->m_main_category->main_category_is_del_where_p_category_code_update($arr_p_category_code);
gf_alert("삭제되었습니다.", '/admin/etc_section/main_category_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 count
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_ajax_main_category_code_count() {
# request
$depth = trim($this->input->get_post('depth', TRUE));
$category_code = trim($this->input->get_post('category_code', TRUE));
$req_date['depth'] = $depth;
$req_date['category_code'] = $category_code;
# model - update
$this->load->model('admin/etc_section/m_main_category');
$count = $this->m_main_category->main_category_code_count($req_date);
$return_data['result'] = $count;
# view
return $this->load->view('/admin/comm/result_html', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 업체리스트
# CREATE : 2018-03-02
#---------------------------------------------------------------------------
function fn_main_category_company_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_category_code1 = trim($this->input->get_post('search_category_code1', TRUE));
$search_category_code2 = trim($this->input->get_post('search_category_code2', 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_category_code1'] = $search_category_code1;
$req_data['search_category_code2'] = $search_category_code2;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_main_category');
$total_count = $this->m_main_category->main_category_company_list_total_count($req_data);
$result = $this->m_main_category->main_category_company_list($req_data);
$category_result = $this->m_main_category->main_category_all_list('');
$arr_category1 = array();
$arr_category2 = array();
foreach ($category_result as $val) {
if($val['depth']=='1') {
$arr_category1[] = array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
} else if($val['depth']=='2') {
$arr_category2[$val['p_category_code']][]= array('category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
}
}
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/main_category_company_list/6' ;
$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_category_code1'] = $search_category_code1;
$return_data['search_category_code2'] = $search_category_code2;
$return_data['list'] = $result;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
# view
return $this->load->view('/admin/etc_section/main_category_company_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 업체 - 저장
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_main_category_company_reg_proc() {
# 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_category_code1 = trim($this->input->get_post('search_category_code1', TRUE));
$search_category_code2 = trim($this->input->get_post('search_category_code2', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$category1 = trim($this->input->get_post('category1', TRUE));
$category2 = trim($this->input->get_post('category2', TRUE));
$company_name = trim($this->input->get_post('company_name', TRUE));
$homepage = trim($this->input->get_post('homepage', TRUE));
$is_direct = trim($this->input->get_post('is_direct', TRUE));
$display_sort = trim($this->input->get_post('display_sort', TRUE));
$is_del_img = trim($this->input->get_post('is_del_img', TRUE));
$org_logo_img = trim($this->input->get_post('org_logo_img', TRUE));
if($is_direct!='Y') $is_direct = 'N';
# 이미지 삭제
if($is_del_img=='Y') {
unlink('.'.$org_logo_img);
$org_logo_img = '';
}
# 이미지업로드
if($_FILES['logo_img']['name']!='') {
# image upload
$upload_path = './files/company/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('logo_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_logo_img;
}
# update data
$req_data['category_code1'] = $category1;
$req_data['category_code2'] = $category2;
$req_data['company_name'] = $company_name;
$req_data['homepage'] = $homepage;
$req_data['is_direct'] = $is_direct;
$req_data['display_sort'] = $display_sort;
$req_data['logo_img'] = $filename;
if($mode=='add') {
# model
$this->load->model('admin/etc_section/m_main_category');
$result = $this->m_main_category->main_category_company_insert($req_data);
if(!$result) {
gf_alert("업체등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/main_category_company_list/6';
} else if($mode=='edit') {
$req_data['idx'] = $idx;
# model
$this->load->model('admin/etc_section/m_main_category');
$result = $this->m_main_category->main_category_company_update($req_data);
if(!$result) {
gf_alert("업체등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/main_category_company_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_category_code1='.$search_category_code1.'&search_category_code2='.$search_category_code2;
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 업체 - 상세정보
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_ajax_main_category_company_detail() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_main_category');
$result = $this->m_main_category->main_category_company_select($idx);
$return_data['result'] = array('result_code' => '9999');
if(count($result) > 0){
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$result[0]);
}
# view
return $this->load->view('/admin/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 업체 - 삭제
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_main_category_company_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_main_category');
// 이미지 삭제
$result1 = $this->m_main_category->main_category_company_select($idx);
if(count($result1) > 0){
if($result1[0]['logo_img']!=''){
unlink('.'.$result1[0]['logo_img']);
}
}
$req_date[] = $idx;
# model - update
$this->m_main_category->main_category_company_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/etc_section/main_category_company_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 카테고리 업체 - 삭제 (다중)
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_main_category_company_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_main_category');
// 이미지 삭제
$result1 = $this->m_main_category->main_category_company_select_in_idx($arr_idx);
if(count($result1) > 0){
foreach ($result1 as $val) {
if($val['logo_img']!=''){
unlink('.'.$val['logo_img']);
}
}
}
# model - update
$this->m_main_category->main_category_company_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/main_category_company_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 추천앱리스트
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_recommend_app_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));
# 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['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_recommend_app');
$total_count = $this->m_recommend_app->recommend_app_list_total_count($req_data);
$result = $this->m_recommend_app->recommend_app_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/recommend_app_list/6' ;
$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['list'] = $result;
# view
return $this->load->view('/admin/etc_section/recommend_app_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 추천앱리스트 - 저장
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_recommend_app_reg_proc() {
# 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));
$mode = trim($this->input->get_post('mode', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$app_name = trim($this->input->get_post('app_name', TRUE));
$market_url = trim($this->input->get_post('market_url', TRUE));
$is_direct = trim($this->input->get_post('is_direct', TRUE));
$display_sort = trim($this->input->get_post('display_sort', TRUE));
$is_del_img = trim($this->input->get_post('is_del_img', TRUE));
$org_icon_img = trim($this->input->get_post('org_icon_img', TRUE));
if($is_direct!='Y') $is_direct = 'N';
# 이미지 삭제
if($is_del_img=='Y') {
unlink('.'.$org_icon_img);
$org_icon_img = '';
}
# 이미지업로드
if($_FILES['icon_img']['name']!='') {
# image upload
$upload_path = './files/app/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('icon_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
$filename = $org_icon_img;
}
# update data
$req_data['app_name'] = $app_name;
$req_data['market_url'] = $market_url;
$req_data['is_direct'] = $is_direct;
$req_data['display_sort'] = $display_sort;
$req_data['icon_img'] = $filename;
if($mode=='add') {
# model
$this->load->model('admin/etc_section/m_recommend_app');
$result = $this->m_recommend_app->recommend_app_insert($req_data);
if(!$result) {
gf_alert("추천어플등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/recommend_app_list/6';
} else if($mode=='edit') {
$req_data['idx'] = $idx;
# model
$this->load->model('admin/etc_section/m_recommend_app');
$result = $this->m_recommend_app->recommend_app_update($req_data);
if(!$result) {
gf_alert("추천어플등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/recommend_app_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword;
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 추천앱리스트 - 상세정보
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_ajax_recommend_app_detail() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_recommend_app');
$result = $this->m_recommend_app->recommend_app_select($idx);
$return_data['result'] = array('result_code' => '9999');
if(count($result) > 0){
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$result[0]);
}
# view
return $this->load->view('/admin/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 추천앱리스트 삭제
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_recommend_app_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_recommend_app');
// 이미지 삭제
$result1 = $this->m_recommend_app->recommend_app_select($idx);
if(count($result1) > 0){
if($result1[0]['icon_img']!=''){
unlink('.'.$result1[0]['icon_img']);
}
}
$req_date[] = $idx;
# model - update
$this->m_recommend_app->recommend_app_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/etc_section/recommend_app_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 추천앱리스트 - 삭제 (다중)
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_recommend_app_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_recommend_app');
// 이미지 삭제
$result1 = $this->m_recommend_app->recommend_app_select_in_idx($arr_idx);
if(count($result1) > 0){
foreach ($result1 as $val) {
if($val['icon_img']!=''){
unlink('.'.$val['icon_img']);
}
}
}
# model - update
$this->m_recommend_app->recommend_app_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/recommend_app_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 오늘의말씀관리
# CREATE : 2018-03-03
#---------------------------------------------------------------------------
function fn_today_word_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));
# 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['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_today_word');
$total_count = $this->m_today_word->today_word_list_total_count($req_data);
$result = $this->m_today_word->today_word_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/today_word_list/6' ;
$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['list'] = $result;
# view
return $this->load->view('/admin/etc_section/today_word_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 오늘의말씀관리 - 저장
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_today_word_reg_proc() {
# 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));
$mode = trim($this->input->get_post('mode', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$word = trim($this->input->get_post('word', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$display_date = trim($this->input->get_post('display_date', TRUE));
$now_date = date("Y-m-d");
if($display_date=='') $display_date = $now_date;
$is_display = 'N';
if($now_date == $display_date) {
$is_display = 'Y';
}
# update data
$req_data['word'] = $word;
$req_data['title'] = $title;
$req_data['display_date'] = $display_date;
$req_data['is_display'] = $is_display;
if($mode=='add') {
# model
$this->load->model('admin/etc_section/m_today_word');
$result = $this->m_today_word->today_word_insert($req_data);
if(!$result) {
gf_alert("오늘의말씀등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/today_word_list/6';
} else if($mode=='edit') {
$req_data['idx'] = $idx;
# model
$this->load->model('admin/etc_section/m_today_word');
$result = $this->m_today_word->today_word_update($req_data);
if(!$result) {
gf_alert("오늘의말씀수정에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/today_word_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword;
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 오늘의말씀관리 - 노출일 변경
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_ajax_today_word_display_date_update() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$display_date = trim($this->input->get_post('display_date', TRUE));
$now_date = date("Y-m-d");
$is_display = 'N';
if($now_date == $display_date) {
$is_display = 'Y';
}
$req_data['idx'] = $idx;
$req_data['display_date'] = $display_date;
$req_data['is_display'] = $is_display;
# model
$this->load->model('admin/etc_section/m_today_word');
$result = $this->m_today_word->today_word_update($req_data);
if(!$result){
$return_data['result'] = array('result_code' => '9999');
} else {
$return_data['result'] = array('result_code' => '0000');
}
# view
return $this->load->view('/admin/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 오늘의말씀관리 - 상세정보
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_ajax_today_word_detail() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_today_word');
$result = $this->m_today_word->today_word_select($idx);
$return_data['result'] = array('result_code' => '9999');
if(count($result) > 0){
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$result[0]);
}
# view
return $this->load->view('/admin/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 오늘의말씀관리 삭제
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_today_word_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_date[] = $idx;
# model
$this->load->model('admin/etc_section/m_today_word');
$this->m_today_word->today_word_is_del_update($req_date);
gf_alert("삭제되었습니다.", '/admin/etc_section/today_word_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 오늘의말씀관리 - 삭제 (다중)
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_today_word_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_today_word');
$this->m_today_word->today_word_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/today_word_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 포토/영상
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_media_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_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$search_content_type = trim($this->input->get_post('search_content_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$search_is_display = trim($this->input->get_post('search_is_display', TRUE));
if($search_etc_section_type== '') $search_etc_section_type = '2';
if($sort=='') $sort = '1';
switch ($sort) {
case '1': $sort_column = 'a.reg_date'; break;
case '2': $sort_column = 'b.hit_count'; break;
case '3': $sort_column = 'b.like_count'; break;
case '4': $sort_column = 'b.comment_count'; break;
default : $sort_column = 'a.reg_date'; break;
}
# 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_etc_section_type']= $search_etc_section_type;
$req_data['search_content_type'] = $search_content_type;
$req_data['sort_column'] = $sort_column;
$req_data['search_is_display'] = $search_is_display;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 카테고리 list
$this->load->model('admin/etc_section/m_etc_section');
$total_count = $this->m_etc_section->etc_section_list_total_count($req_data);
$result = $this->m_etc_section->etc_section_join_vw_content_list($req_data);
$arr_display_count = $this->m_etc_section->etc_section_display_group_by_list($req_data);
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/media_list/6' ;
$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['sort'] = $sort;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['search_content_type'] = $search_content_type;
$return_data['list'] = $result;
$return_data['search_is_display'] = $search_is_display;
$return_data['arr_display_count'] = $arr_display_count;
# view
return $this->load->view('/admin/etc_section/media_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 포토/영상 송출관리
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_media_list_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_content_type = trim($this->input->get_post('search_content_type', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
if($search_etc_section_type=='') $search_etc_section_type = '1';
$req_data = array();
$req_data['etc_section_type'] = $search_etc_section_type;
# 기타섹션 리스트
$this->load->model('admin/etc_section/m_etc_section');
$arr_etc_section = $this->m_etc_section->etc_section_type_list($req_data);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_content_type'] = $search_content_type;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['arr_etc_section'] = $arr_etc_section;
# view
return $this->load->view('/admin/etc_section/media_list_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 포토/영상 - 저장
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_media_list_reg_proc() {
# request
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
include_once ("./static_data/code.php");
$arr_req_data = array();
for($i=1;$i<=$def_arr_etc_section[$etc_section_type]['count'];$i++){
${"content_idx".$i} = trim($this->input->get_post('content_idx'.$i, TRUE));
${"head_title".$i} = trim($this->input->get_post('head_title'.$i, TRUE));
${"title".$i} = trim($this->input->get_post('title'.$i, TRUE));
${"img".$i} = trim($this->input->get_post('img'.$i, TRUE));
${"org_img".$i} = trim($this->input->get_post('org_img'.$i, TRUE));
${"video_url".$i} = trim($this->input->get_post('video_url'.$i, TRUE));
${"content_type".$i} = trim($this->input->get_post('content_type'.$i, TRUE));
if(${"title".$i}!=''){
if(${"video_url".$i} !='') ${"video_url".$i} = 'https://www.youtube.com/embed/'.${"video_url".$i};
# 이미지업로드
$is_file_copy = '';
if($_FILES['main_img'.$i]['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img'.$i)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
$is_file_copy = 'N';
} else {
if(${"img".$i}=='') {
$filename = ${"org_img".$i};
$is_file_copy = 'N';
} else {
$filename = ${"img".$i};
}
}
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
$req_data['content_type'] = ${"content_type".$i};
$req_data['rank'] = $i;
$req_data['content_idx'] = ${"content_idx".$i};
$req_data['filename'] = $filename;
$req_data['is_file_copy'] = $is_file_copy;
$req_data['video_url'] = ${"video_url".$i};
$req_data['is_display'] = 'Y';
$req_data['head_title'] = ${"head_title".$i};
$req_data['title'] = ${"title".$i};
$this->load->library('comm_admin');
$result = $this->comm_admin->fn_etc_section_reg($req_data);
if (!$result) {
gf_alert("기타섹션등록에 실패했습니다.", 'back');
exit;
}
if(${"video_url".$i}!='') {
if(${"content_type".$i} =='1') {
$this->load->model('admin/news/m_news');
$this->m_news->news_video_url_update($req_data);
} else if(${"content_type".$i} =='2') {
$this->load->model('admin/column/m_column');
$this->m_column->column_video_url_update($req_data);
} else if(${"content_type".$i} =='3') {
$this->load->model('admin/life/m_life');
$this->m_life->life_video_url_update($req_data);
}
}
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/media_list/6");
}
#---------------------------------------------------------------------------
# PURPOSE : 포토영상 관리 수정
# CREATE : 2018-03-22
#---------------------------------------------------------------------------
function fn_media_edit() {
# 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_content_type = trim($this->input->get_post('search_content_type', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# model
$this->load->model('admin/etc_section/m_etc_section');
$result = $this->m_etc_section->etc_section_join_content_select($idx);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_content_type'] = $search_content_type;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['idx'] = $idx;
$return_data['result'] = $result[0];
# view
return $this->load->view('/admin/etc_section/media_edit', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 포토영상 수정
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_media_edit_proc() {
# request
$content_idx = trim($this->input->get_post('content_idx', TRUE));
$head_title = trim($this->input->get_post('head_title', TRUE));
$title = trim($this->input->get_post('title', TRUE));
$img = trim($this->input->get_post('img', TRUE));
$org_img = trim($this->input->get_post('org_img', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
$content_type = trim($this->input->get_post('content_type', TRUE));
$video_url = trim($this->input->get_post('video_url', TRUE));
$video_playtime = '';
if($video_url!='') {
$this->load->library('comm_admin');
$video_playtime = $this->comm_admin->fn_youtube_playtime($video_url);
$video_url = 'https://www.youtube.com/embed/'.$video_url;
}
# 이미지업로드
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if($_FILES['main_img']['name']!='') {
# image upload
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
if($img!='') {
# image upload
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $img);
copy('.'.$img, $upload_path.'/'.$arr_new_file[5]);
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$arr_new_file[5];
} else {
$filename = $org_img;
}
}
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['idx'] = $idx;
$req_data['content_idx'] = $content_idx;
$req_data['main_img'] = $filename;
$req_data['video_url'] = $video_url;
$req_data['video_playtime'] = $video_playtime;
$req_data['is_display'] = 'Y';
$req_data['head_title'] = $head_title;
$req_data['title'] = $title;
$this->load->model('admin/etc_section/m_etc_section');
$result = $this->m_etc_section->etc_section_update($req_data);
if (!$result) {
gf_alert("기타섹션등록에 실패했습니다.", 'back');
exit;
}
if($video_url!='') {
if($content_type =='1') {
$this->load->model('admin/news/m_news');
$this->m_news->news_video_url_update($req_data);
} else if($content_type =='2') {
$this->load->model('admin/column/m_column');
$this->m_column->column_video_url_update($req_data);
} else if($content_type =='3') {
$this->load->model('admin/life/m_life');
$this->m_life->life_video_url_update($req_data);
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/media_list/6");
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 > 포토/영상 관리 - 삭제
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_media_reg_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_data[] = $idx;
# model
$this->load->model('admin/etc_section/m_etc_section');
$this->m_etc_section->etc_section_is_del_update($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/media_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션 > 포토/영상 관리 - 삭제 (다중)
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_media_reg_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_etc_section');
$this->m_etc_section->etc_section_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/media_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 영적기상도
# CREATE : 2018-03-05
#---------------------------------------------------------------------------
function fn_weather_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_display_status = trim($this->input->get_post('search_display_status', TRUE));
# paging 설정
if($page == '') $page = 1;
$limit = PAGE_SIZE;
$offset = ($page-1) * $limit;
# 검색
$req_data = array();
$req_data['search_type'] = $search_type;
$req_data['search_keyword'] = addslashes($search_keyword);
$req_data['search_display_status'] = $search_display_status;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - list
$this->load->model('admin/etc_section/m_weather');
$total_count = $this->m_weather->weather_list_total_count($req_data);
$result = $this->m_weather->weather_list($req_data);
$display_status_result = $this->m_weather->weather_list_display_status($req_data);
# model - 아이콘 list
$this->load->model('admin/etc_section/m_weather');
$weather_icon_list = $this->m_weather->weather_icon_list();
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/weather_list/6' ;
$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_display_status'] = $search_display_status;
$return_data['list'] = $result;
$return_data['weather_icon_list'] = $weather_icon_list;
$return_data['display_status_result'] = $display_status_result;
# view
return $this->load->view('/admin/etc_section/weather_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 영적기상도 - 상태,노출일 변경
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_ajax_weather_display_status_update() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$display_status = trim($this->input->get_post('display_status', TRUE));
$req_data = array();
$req_data['idx'] = $idx;
$req_data['display_status'] = $display_status;
# model
$this->load->model('admin/etc_section/m_weather');
$result = $this->m_weather->weather_display_status_update($req_data);
if(!$result){
$return_data['result'] = array('result_code' => '9999');
} else {
$return_data['result'] = array('result_code' => '0000');
}
# view
return $this->load->view('/admin/comm/result_json', $return_data);
}
#---------------------------------------------------------------------------
# PURPOSE : 날씨아이콘 등록
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_icon_add_proc() {
$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_display_status = trim($this->input->get_post('search_display_status', TRUE));
# 이미지업로드
$filename = '';
if($_FILES['weather_icon']['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('weather_icon')) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
}
# model - insert
$this->load->model('admin/etc_section/m_weather');
$result = $this->m_weather->weather_icon_insert($filename);
$url = '/admin/etc_section/weather_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_display_status='.$search_display_status;
gf_alert("등록되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 등록/수정
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_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_display_status = trim($this->input->get_post('search_display_status', TRUE));
$mode = trim($this->input->get_post('mode', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# model - 아이콘 list
$this->load->model('admin/etc_section/m_weather');
$weather_icon_list = $this->m_weather->weather_icon_list();
$result_data = array();
$arr_relation_article = array();
if($mode == 'edit') {
# model
$this->load->model('admin/etc_section/m_weather');
$result = $this->m_weather->weather_select($idx);
$result_data = $result[0];
$req_data = array();
$req_data['content_idx'] = $idx;
$req_data['content_type'] = 5;
# 연관기사
$this->load->model('admin/news/m_news');
$arr_relation_article = $this->m_news->relation_article_join_news_list($req_data);
}
$return_data = array();
$return_data['page'] = $page;
$return_data['mode'] = $mode;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_display_status'] = $search_display_status;
$return_data['idx'] = $idx;
$return_data['weather_icon_list'] = $weather_icon_list;
$return_data['result'] = $result_data;
$return_data['arr_relation_article'] = $arr_relation_article;
# view
return $this->load->view('/admin/etc_section/weather_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 저장
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_reg_proc() {
# request
$continent = trim($this->input->get_post('continent', TRUE));
$country = trim($this->input->get_post('country', TRUE));
$weather_icon = trim($this->input->get_post('weather_icon', TRUE));
$weather_content = trim($this->input->get_post('weather_content', TRUE));
$rank = trim($this->input->get_post('rank', TRUE));
$display_date = trim($this->input->get_post('display_date', TRUE));
$tag = trim($this->input->get_post('tag', TRUE));
$is_auto_setting = trim($this->input->get_post('is_auto_setting', TRUE));
$relation_idxs = $this->input->get_post('relation_idxs', TRUE);
$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));
$now_date = date("Y-m-d");
if($display_date=='') {
$display_date = $now_date;
}
$display_status = '1';
if($display_date > $now_date) {
$display_status = '0'; // 예약
}
# tag
$tag = str_replace(' ','', $tag);
$tag = str_replace(',',' ', $tag);
include_once ("./static_data/continent.php");
$continent_text = '';
if(isset($arr_continent1[$continent])==true){
$continent_text = $arr_continent1[$continent];
}
# update data
$req_data = array();
$req_data['rank'] = $rank;
$this->load->model('admin/etc_section/m_weather');
$rank_result = $this->m_weather->weather_rank_select($req_data);
$rank_count = count($rank_result);
if($rank_count > 0) {
if($idx != $rank_result[0]['idx']){
# update data
$req_data = array();
$req_data['idx'] = $rank_result[0]['idx'];
$req_data['display_status'] = '2';
$this->m_weather->weather_display_status_update($req_data);
}
}
# update data
$req_data = array();
$req_data['continent'] = $continent_text;
$req_data['country'] = $country;
$req_data['weather_icon'] = $weather_icon;
$req_data['weather_content'] = $weather_content;
$req_data['rank'] = $rank;
$req_data['display_date'] = $display_date;
$req_data['tag'] = $tag;
$req_data['is_auto_setting'] = $is_auto_setting;
$req_data['display_status'] = $display_status;
if($mode=='add') {
# model
$idx = $this->m_weather->weather_insert($req_data);
if(!$idx) {
gf_alert("영적기상도 등록에 실패했습니다.", 'back');
exit;
}
$url = '/admin/etc_section/weather_list/6';
} else if($mode=='edit') {
# 영적기상도
$req_data['idx'] = $idx;
$url = '/admin/etc_section/weather_list/6/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword;
# model
$this->load->model('admin/etc_section/m_weather');
$result = $this->m_weather->weather_update($req_data);
if(!$result) {
gf_alert("영적기상도수정에 실패했습니다.", $url);
exit;
}
}
# 관련뉴스
$content_type = 5;
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
# model - 관련뉴스 삭제
$this->load->model('admin/comm/m_relation_article');
$this->m_relation_article->relation_article_delete($req_data);
if($is_auto_setting == 'Y') {
$relation_idxs = array();
$req_data['tag'] = $tag;
# model - 관련뉴스
$this->load->model('admin/news/m_news');
$result = $this->m_news->news_tag_select($req_data);
if(count($result) > 0) {
foreach ($result as $val) {
$relation_idxs[] = $val['idx'];
}
}
}
if(count($relation_idxs) > 0) {
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['relation_idxs'] = $relation_idxs;
# model - 수동등록
$result = $this->m_relation_article->relation_article_insert($req_data);
if(!$result) {
gf_alert("관련뉴스등록에 실패했습니다.", 'back');
exit;
}
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 삭제
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_reg_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_data = array();
$req_data[] = $idx;
# model
$this->load->model('admin/etc_section/m_weather');
$this->m_weather->weather_is_del_update($req_data);
# model - 관련뉴스 삭제
$req_data = array();
$req_data['content_type'] = 5;
$req_data['content_idx'] = $idx;
$this->load->model('admin/comm/m_relation_article');
$this->m_relation_article->relation_article_delete($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/weather_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 삭제 (다중)
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_reg_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_weather');
$this->m_weather->weather_is_del_update($arr_idx);
# model - 관련뉴스 삭제
$req_data = array();
$req_data['content_type'] = 5;
$req_data['content_idx'] = $arr_idx;
$this->load->model('admin/comm/m_relation_article');
$this->m_relation_article->relation_article_arr_delete($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/weather_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 > 송출관리
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_list_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_display_status = trim($this->input->get_post('search_display_status', TRUE));
# model - 아이콘 list
$this->load->model('admin/etc_section/m_weather');
$weather_icon_list = $this->m_weather->weather_icon_list();
# 영적기상도
$this->load->model('admin/etc_section/m_weather');
$arr_weather = $this->m_weather->weather_rank_list();
# 연관기사
$req_data = array();
$req_data['content_type'] = 5;
$arr_relation_article = $this->m_weather->weather_join_relation_article_join_news_list($req_data);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_display_status'] = $search_display_status;
$return_data['arr_weather'] = $arr_weather;
$return_data['weather_icon_list'] = $weather_icon_list;
$return_data['arr_relation_article'] = $arr_relation_article;
# view
return $this->load->view('/admin/etc_section/weather_list_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 영적기상도 - 송출관리 저장
# CREATE : 2018-03-26
#---------------------------------------------------------------------------
function fn_weather_list_reg_proc() {
include_once ("./static_data/code.php");
include_once ("./static_data/continent.php");
$arr_req_data = array();
for($i=1;$i<=10;$i++){
${"continent".$i} = trim($this->input->get_post('continent'.$i, TRUE));
${"country".$i} = trim($this->input->get_post('country'.$i, TRUE));
${"weather_icon".$i} = trim($this->input->get_post('weather_icon'.$i, TRUE));
${"weather_content".$i} = trim($this->input->get_post('weather_content'.$i, TRUE));
${"tag".$i} = trim($this->input->get_post('tag'.$i, TRUE));
${"is_auto_setting".$i} = trim($this->input->get_post('is_auto_setting'.$i, TRUE));
$relation_idxs = $this->input->get_post('relation_idxs'.$i, TRUE);
$rank = $i;
# tag
$tag = str_replace(' ','', ${"tag".$i});
$tag = str_replace(',',' ', $tag);
$continent_text = '';
if(isset($arr_continent1[${"continent".$i}])==true){
$continent_text = $arr_continent1[${"continent".$i}];
}
# update data
$req_data = array();
$req_data['rank'] = $rank;
$this->load->model('admin/etc_section/m_weather');
$rank_result = $this->m_weather->weather_rank_select($req_data);
$rank_count = count($rank_result);
if($rank_count > 0) {
$req_data = array();
$req_data['idx'] = $rank_result[0]['idx'];
$req_data['display_status'] = '2';
$this->m_weather->weather_display_status_update($req_data);
}
$display_date = date("Y-m-d");
$display_status = '1';
$url = '/admin/etc_section/weather_list/6';
if(${"continent".$i}!=''){
# update data
$req_data = array();
$req_data['continent'] = $continent_text;
$req_data['country'] = ${"country".$i};
$req_data['weather_icon'] = ${"weather_icon".$i};
$req_data['weather_content'] = ${"weather_content".$i};
$req_data['rank'] = $rank;
$req_data['display_date'] = $display_date;
$req_data['tag'] = $tag;
$req_data['is_auto_setting'] = ${"is_auto_setting".$i};
$req_data['display_status'] = $display_status;
# model
$idx = $this->m_weather->weather_insert($req_data);
if(!$idx) {
gf_alert("영적기상도 등록에 실패했습니다.", $url);
exit;
}
# 관련뉴스
$content_type = 5;
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
# model - 관련뉴스 삭제
$this->load->model('admin/comm/m_relation_article');
$this->m_relation_article->relation_article_delete($req_data);
if(${"is_auto_setting".$i} == 'Y') {
$relation_idxs = array();
$req_data['tag'] = $tag;
# model - 관련뉴스
$this->load->model('admin/news/m_news');
$result = $this->m_news->news_tag_select($req_data);
if(count($result) > 0) {
foreach ($result as $val) {
$relation_idxs[] = $val['idx'];
}
}
}
if(count($relation_idxs) > 0) {
$req_data = array();
$req_data['content_type'] = $content_type;
$req_data['content_idx'] = $idx;
$req_data['relation_idxs'] = $relation_idxs;
# model - 수동등록
$result = $this->m_relation_article->relation_article_insert($req_data);
if(!$result) {
gf_alert("관련뉴스등록에 실패했습니다.", $url);
exit;
}
}
}
}
gf_alert("저장되었습니다.", $url);
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 리스트
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function fn_channel_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_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$search_category = trim($this->input->get_post('search_category', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
if($search_etc_section_type== '') $search_etc_section_type = '1';
if($sort=='') $sort = '1';
switch ($sort) {
case '1': $sort_column = 'reg_date'; break;
case '2': $sort_column = 'hit_count'; break;
case '3': $sort_column = 'editor_count'; break;
case '4': $sort_column = 'article_count'; break;
default : $sort_column = 'reg_date'; break;
}
# 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_category'] = $search_category;
$req_data['search_etc_section_type']= $search_etc_section_type;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 채널 list
$this->load->model('admin/etc_section/m_life_etc_section');
$total_count = $this->m_life_etc_section->life_etc_section_list_total_count($req_data);
$result = $this->m_life_etc_section->life_etc_section_list($req_data);
# model - 카테고리 list
$this->load->model('admin/life/m_life_category');
$category_list = $this->m_life_category->category_all_list();
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/channel_list/6' ;
$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['sort'] = $sort;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['search_category'] = $search_category;
$return_data['list'] = $result;
$return_data['category_list'] = $category_list;
# view
return $this->load->view('/admin/etc_section/channel_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 포토/영상 송출관리
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_channel_list_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_category = trim($this->input->get_post('search_category', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
if($etc_section_type=='') $etc_section_type = '1';
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
# 기타섹션 리스트
$this->load->model('admin/etc_section/m_life_etc_section');
$arr_etc_section = $this->m_life_etc_section->life_etc_section_type_list($req_data);
$arr_etc_section_detail = $this->m_life_etc_section->life_etc_section_detail_type_list($req_data);
# 카테고리 리스트
$this->load->model('admin/life/m_life_category');
$arr_category1 = $this->m_life_category->category_all_list();
# 채널 리스트
$this->load->model('admin/life/m_life_channel');
$arr_category2 = $this->m_life_channel->channel_all_list();
$req_data = array();
$req_data['member_group_idx'] = 6;
# 에디터 리스트
$this->load->model('admin/member/m_partner');
$arr_category3 = $this->m_partner->partner_list_where_member_group_idx($req_data);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category'] = $search_category;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['etc_section_type'] = $etc_section_type;
$return_data['arr_etc_section'] = $arr_etc_section;
$return_data['arr_etc_section_detail'] = $arr_etc_section_detail;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['arr_category3'] = $arr_category3;
# view
return $this->load->view('/admin/etc_section/channel_list_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 기타섹션관리 > 포토/영상 - 저장
# CREATE : 2018-03-23
#---------------------------------------------------------------------------
function fn_channel_list_reg_proc() {
# request
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
include_once ("./static_data/code.php");
$arr_req_data = array();
for($i=1;$i<=$def_arr_channel_etc_section[$etc_section_type]['count'];$i++){
$category1 = trim($this->input->get_post('category1_'.$i, TRUE));
$category2 = trim($this->input->get_post('category2_'.$i, TRUE));
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
$req_data['rank'] = $i;
$this->load->model('admin/etc_section/m_life_etc_section');
$result = $this->m_life_etc_section->life_etc_section_where_rank_select($req_data);
$idx = '';
if(isset($result[0]['idx'])==true) {
$idx = $result[0]['idx'];
}
$this->m_life_etc_section->life_etc_section_is_del_update($idx);
$this->m_life_etc_section->life_etc_section_detail_is_del_where_section_idx_update($idx);
if($category1!='') {
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
$req_data['category_idx'] = $category1;
$req_data['channel_idx'] = $category2;
$req_data['rank'] = $i;
$this->load->model('admin/etc_section/m_life_etc_section');
$life_etc_section_idx = $this->m_life_etc_section->life_etc_section_insert($req_data);
if(!$life_etc_section_idx) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
for($z=1;$z<=$def_arr_channel_etc_section[$etc_section_type]['detail_count'];$z++){
$head_title = trim($this->input->get_post('head_title_'.$i.'_'.$z, TRUE));
$title = trim($this->input->get_post('title_'.$i.'_'.$z, TRUE));
$img = trim($this->input->get_post('img_'.$i.'_'.$z, TRUE));
$org_img = trim($this->input->get_post('org_img_'.$i.'_'.$z, TRUE));
$content_idx = trim($this->input->get_post('content_idx_'.$i.'_'.$z, TRUE));
$hit_count = trim($this->input->get_post('hit_count_'.$i.'_'.$z, TRUE));
if($title!='') {
# 이미지업로드
if($_FILES['main_img_'.$i.'_'.$z]['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img_'.$i.'_'.$z)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
if($img=='') {
$filename = $org_img;
} else {
$filename = $img;
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $filename);
copy('.' . $filename, $upload_path . '/' . $etc_section_type.$i.$z. '_' . $arr_new_file[5]);
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$etc_section_type.$i.$z.'_'.$arr_new_file[5];
}
}
$req_data = array();
$req_data['life_etc_section_idx'] = $life_etc_section_idx;
$req_data['etc_section_type'] = $etc_section_type;
$req_data['main_img'] = $filename;
$req_data['head_title'] = $head_title;
$req_data['title'] = $title;
$req_data['content_idx'] = $content_idx;
$req_data['rank'] = $z;
$result = $this->m_life_etc_section->life_etc_section_detail_insert($req_data);
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
if($hit_count!='' && $etc_section_type!='1') {
$req_data = array();
$req_data['idx'] = $content_idx;
$req_data['hit_count'] = $hit_count;
$this->load->model('admin/life/m_life');
$this->m_life->life_update($req_data);
}
}
}
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/channel_list/6");
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 관리 수정
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function fn_channel_edit() {
# 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_category = trim($this->input->get_post('search_category', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# 기타섹션 리스트
$this->load->model('admin/etc_section/m_life_etc_section');
$result1 = $this->m_life_etc_section->life_etc_section_select($idx);
$result2 = $this->m_life_etc_section->life_etc_section_detail_list($idx);
# 카테고리 리스트
$this->load->model('admin/life/m_life_category');
$arr_category1 = $this->m_life_category->category_all_list();
# 채널 리스트
$this->load->model('admin/life/m_life_channel');
$arr_category2 = $this->m_life_channel->channel_all_list();
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category'] = $search_category;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['idx'] = $idx;
$return_data['result1'] = $result1[0];
$return_data['result2'] = $result2;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
# view
return $this->load->view('/admin/etc_section/channel_edit', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 수정
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function fn_channel_edit_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$category1 = trim($this->input->get_post('category1', TRUE));
$category2 = trim($this->input->get_post('category2', TRUE));
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
if($category1!='') {
$req_data = array();
$req_data['idx'] = $idx;
$req_data['category_idx'] = $category1;
$req_data['channel_idx'] = $category2;
$this->load->model('admin/etc_section/m_life_etc_section');
$result = $this->m_life_etc_section->life_etc_section_update($req_data);
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
include_once ("./static_data/code.php");
for($z=1;$z<=$def_arr_channel_etc_section[$etc_section_type]['detail_count'];$z++){
$head_title = trim($this->input->get_post('head_title_'.$z, TRUE));
$title = trim($this->input->get_post('title_'.$z, TRUE));
$img = trim($this->input->get_post('img_'.$z, TRUE));
$org_img = trim($this->input->get_post('org_img_'.$z, TRUE));
$content_idx = trim($this->input->get_post('content_idx_'.$z, TRUE));
$hit_count = trim($this->input->get_post('hit_count_'.$z, TRUE));
$list_idx = trim($this->input->get_post('list_idx_'.$z, TRUE));
$req_data = array();
$req_data['life_etc_section_idx'] = $idx;
$req_data['rank'] = $z;
$result = $this->m_life_etc_section->life_etc_section_detail_where_rank_select($req_data);
$db_content_idx = '';
$detail_idx = '';
if(isset($result[0]['content_idx'])==true) {
$db_content_idx = $result[0]['content_idx'];
$detail_idx = $result[0]['idx'];
}
if($db_content_idx != '') {
if($db_content_idx != $content_idx) {
$this->m_life_etc_section->life_etc_section_detail_is_del_update($detail_idx);
}
}
if($title!='') {
# 이미지업로드
if($_FILES['main_img_'.$z]['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img_'.$z)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
if($img=='') {
$filename = $org_img;
} else {
$filename = $img;
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $filename);
copy('.' . $filename, $upload_path . '/' . $etc_section_type.$z. '_' . $arr_new_file[5]);
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$etc_section_type.$z.'_'.$arr_new_file[5];
}
}
$req_data = array();
$req_data['main_img'] = $filename;
$req_data['head_title'] = $head_title;
$req_data['title'] = $title;
$req_data['content_idx'] = $content_idx;
$req_data['rank'] = $z;
if($db_content_idx == $content_idx) {
$req_data['idx'] = $list_idx;
$result = $this->m_life_etc_section->life_etc_section_detail_update($req_data);
} else {
$req_data['life_etc_section_idx'] = $idx;
$req_data['etc_section_type'] = $etc_section_type;
$result = $this->m_life_etc_section->life_etc_section_detail_insert($req_data);
}
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
if($hit_count!='' && $etc_section_type!='1') {
$req_data = array();
$req_data['idx'] = $content_idx;
$req_data['hit_count'] = $hit_count;
$this->load->model('admin/life/m_life');
$this->m_life->life_update($req_data);
}
}
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/channel_list/6");
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - 삭제
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function fn_channel_reg_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_data[] = $idx;
# model
$this->load->model('admin/etc_section/m_life_etc_section');
$this->m_life_etc_section->life_etc_section_and_life_etc_section_detail_is_del_update($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/channel_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 채널 - 삭제 (다중)
# CREATE : 2018-03-27
#---------------------------------------------------------------------------
function fn_channel_reg_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_life_etc_section');
$this->m_life_etc_section->life_etc_section_and_life_etc_section_detail_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/channel_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 리스트
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_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_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$search_category = trim($this->input->get_post('search_category', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
if($search_etc_section_type== '') $search_etc_section_type = '4';
if($sort=='') $sort = '1';
switch ($sort) {
case '1': $sort_column = 'reg_date'; break;
case '2': $sort_column = 'hit_count'; break;
case '3': $sort_column = 'article_count'; break;
default : $sort_column = 'reg_date'; break;
}
# 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_category'] = $search_category;
$req_data['search_etc_section_type']= $search_etc_section_type;
$req_data['sort_column'] = $sort_column;
$req_data['offset'] = $offset;
$req_data['limit'] = $limit;
# model - 채널 list
$this->load->model('admin/etc_section/m_life_etc_section');
$total_count = $this->m_life_etc_section->life_editor_etc_section_list_total_count($req_data);
$result = $this->m_life_etc_section->life_editor_etc_section_list($req_data);
# model - 카테고리 list
$this->load->model('admin/life/m_life_category');
$category_list = $this->m_life_category->category_all_list();
# pagination
$req_data = array();
$req_data['total_count'] = $total_count;
$req_data['limit'] = $limit;
$req_data['base_url'] = '/admin/etc_section/editor_list/6' ;
$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['sort'] = $sort;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['search_category'] = $search_category;
$return_data['list'] = $result;
$return_data['category_list'] = $category_list;
# view
return $this->load->view('/admin/etc_section/editor_list', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 송출관리
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_list_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_category = trim($this->input->get_post('search_category', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
if($etc_section_type=='') $etc_section_type = '4';
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
# 기타섹션 리스트
$this->load->model('admin/etc_section/m_life_etc_section');
$arr_etc_section = $this->m_life_etc_section->life_etc_section_type_list($req_data);
$arr_etc_section_detail = $this->m_life_etc_section->life_etc_section_detail_type_list($req_data);
# 카테고리 리스트
$this->load->model('admin/life/m_life_category');
$arr_category1 = $this->m_life_category->category_all_list();
# 채널 리스트
$this->load->model('admin/life/m_life_channel');
$arr_category2 = $this->m_life_channel->channel_all_list();
# 에디터 리스트
$req_data = array();
$req_data['member_group_idx'] = 6;
$this->load->model('admin/member/m_partner');
$arr_category3 = $this->m_partner->partner_list_where_member_group_idx($req_data);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category'] = $search_category;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['etc_section_type'] = $etc_section_type;
$return_data['arr_etc_section'] = $arr_etc_section;
$return_data['arr_etc_section_detail'] = $arr_etc_section_detail;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['arr_category3'] = $arr_category3;
# view
return $this->load->view('/admin/etc_section/editor_list_reg', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 송출관리 - 저장
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_list_reg_proc() {
# request
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
include_once ("./static_data/code.php");
$arr_req_data = array();
for($i=1;$i<=$def_arr_editor_etc_section[$etc_section_type]['count'];$i++){
$category1 = trim($this->input->get_post('category1_'.$i, TRUE));
$category2 = trim($this->input->get_post('category2_'.$i, TRUE));
$category3 = trim($this->input->get_post('category3_'.$i, TRUE));
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
$req_data['rank'] = $i;
$this->load->model('admin/etc_section/m_life_etc_section');
$result = $this->m_life_etc_section->life_etc_section_where_rank_select($req_data);
$idx = '';
if(isset($result[0]['idx'])==true) {
$idx = $result[0]['idx'];
}
$this->m_life_etc_section->life_etc_section_is_del_update($idx);
$this->m_life_etc_section->life_etc_section_detail_is_del_where_section_idx_update($idx);
if($category1!='') {
$req_data = array();
$req_data['etc_section_type'] = $etc_section_type;
$req_data['category_idx'] = $category1;
$req_data['channel_idx'] = $category2;
$req_data['partner_idx'] = $category3;
$req_data['rank'] = $i;
$this->load->model('admin/etc_section/m_life_etc_section');
$life_etc_section_idx = $this->m_life_etc_section->life_etc_section_insert($req_data);
if(!$life_etc_section_idx) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
for($z=1;$z<=$def_arr_editor_etc_section[$etc_section_type]['detail_count'];$z++){
$head_title = trim($this->input->get_post('head_title_'.$i.'_'.$z, TRUE));
$title = trim($this->input->get_post('title_'.$i.'_'.$z, TRUE));
$img = trim($this->input->get_post('img_'.$i.'_'.$z, TRUE));
$org_img = trim($this->input->get_post('org_img_'.$i.'_'.$z, TRUE));
$content_idx = trim($this->input->get_post('content_idx_'.$i.'_'.$z, TRUE));
$hit_count = trim($this->input->get_post('hit_count_'.$i.'_'.$z, TRUE));
if($title!='') {
# 이미지업로드
if($_FILES['main_img_'.$i.'_'.$z]['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img_'.$i.'_'.$z)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
if($img=='') {
$filename = $org_img;
} else {
$filename = $img;
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $filename);
copy('.' . $filename, $upload_path . '/' . $etc_section_type.$i.$z. '_' . $arr_new_file[5]);
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$etc_section_type.$i.$z.'_'.$arr_new_file[5];
}
}
$req_data = array();
$req_data['life_etc_section_idx'] = $life_etc_section_idx;
$req_data['etc_section_type'] = $etc_section_type;
$req_data['main_img'] = $filename;
$req_data['head_title'] = $head_title;
$req_data['title'] = $title;
$req_data['content_idx'] = $content_idx;
$req_data['rank'] = $z;
$result = $this->m_life_etc_section->life_etc_section_detail_insert($req_data);
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
if($hit_count!='' && $etc_section_type=='5') {
$req_data = array();
$req_data['idx'] = $content_idx;
$req_data['hit_count'] = $hit_count;
$this->load->model('admin/life/m_life');
$this->m_life->life_update($req_data);
}
}
}
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/editor_list/6");
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 - 삭제
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_reg_del_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$req_data[] = $idx;
# model
$this->load->model('admin/etc_section/m_life_etc_section');
$this->m_life_etc_section->life_etc_section_and_life_etc_section_detail_is_del_update($req_data);
gf_alert("삭제되었습니다.", '/admin/etc_section/editor_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 삭제 (다중)
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_reg_arr_del_proc() {
# request
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
# model
$this->load->model('admin/etc_section/m_life_etc_section');
$this->m_life_etc_section->life_etc_section_and_life_etc_section_detail_is_del_update($arr_idx);
gf_alert("삭제되었습니다.", '/admin/etc_section/editor_list/6');
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 관리 수정
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_edit() {
# 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_category = trim($this->input->get_post('search_category', TRUE));
$search_etc_section_type= trim($this->input->get_post('search_etc_section_type', TRUE));
$sort = trim($this->input->get_post('sort', TRUE));
$idx = trim($this->input->get_post('idx', TRUE));
# 기타섹션 리스트
$this->load->model('admin/etc_section/m_life_etc_section');
$result1 = $this->m_life_etc_section->life_etc_section_select($idx);
$result2 = $this->m_life_etc_section->life_etc_section_detail_list($idx);
# 카테고리 리스트
$this->load->model('admin/life/m_life_category');
$arr_category1 = $this->m_life_category->category_all_list();
# 채널 리스트
$this->load->model('admin/life/m_life_channel');
$arr_category2 = $this->m_life_channel->channel_all_list();
# 에디터 리스트
$req_data = array();
$req_data['member_group_idx'] = 6;
$this->load->model('admin/member/m_partner');
$arr_category3 = $this->m_partner->partner_list_where_member_group_idx($req_data);
$return_data = array();
$return_data['page'] = $page;
$return_data['search_type'] = $search_type;
$return_data['search_keyword'] = $search_keyword;
$return_data['search_category'] = $search_category;
$return_data['search_etc_section_type'] = $search_etc_section_type;
$return_data['sort'] = $sort;
$return_data['idx'] = $idx;
$return_data['result1'] = $result1[0];
$return_data['result2'] = $result2;
$return_data['arr_category1'] = $arr_category1;
$return_data['arr_category2'] = $arr_category2;
$return_data['arr_category3'] = $arr_category3;
# view
return $this->load->view('/admin/etc_section/editor_edit', $return_data, true);
}
#---------------------------------------------------------------------------
# PURPOSE : 에디터 수정
# CREATE : 2018-03-28
#---------------------------------------------------------------------------
function fn_editor_edit_proc() {
# request
$idx = trim($this->input->get_post('idx', TRUE));
$category1 = trim($this->input->get_post('category1', TRUE));
$category2 = trim($this->input->get_post('category2', TRUE));
$category3 = trim($this->input->get_post('category3', TRUE));
$etc_section_type = trim($this->input->get_post('etc_section_type', TRUE));
if($category1!='') {
$req_data = array();
$req_data['idx'] = $idx;
$req_data['category_idx'] = $category1;
$req_data['channel_idx'] = $category2;
$req_data['partner_idx'] = $category3;
$this->load->model('admin/etc_section/m_life_etc_section');
$result = $this->m_life_etc_section->life_etc_section_update($req_data);
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
include_once ("./static_data/code.php");
for($z=1;$z<=$def_arr_editor_etc_section[$etc_section_type]['detail_count'];$z++){
$head_title = trim($this->input->get_post('head_title_'.$z, TRUE));
$title = trim($this->input->get_post('title_'.$z, TRUE));
$img = trim($this->input->get_post('img_'.$z, TRUE));
$org_img = trim($this->input->get_post('org_img_'.$z, TRUE));
$content_idx = trim($this->input->get_post('content_idx_'.$z, TRUE));
$hit_count = trim($this->input->get_post('hit_count_'.$z, TRUE));
$list_idx = trim($this->input->get_post('list_idx_'.$z, TRUE));
$req_data = array();
$req_data['life_etc_section_idx'] = $idx;
$req_data['rank'] = $z;
$result = $this->m_life_etc_section->life_etc_section_detail_where_rank_select($req_data);
$db_content_idx = '';
$detail_idx = '';
if(isset($result[0]['content_idx'])==true) {
$db_content_idx = $result[0]['content_idx'];
$detail_idx = $result[0]['idx'];
}
if($db_content_idx != '') {
if($db_content_idx != $content_idx) {
$this->m_life_etc_section->life_etc_section_detail_is_del_update($detail_idx);
}
}
if($title!='') {
# 이미지업로드
if($_FILES['main_img_'.$z]['name']!='') {
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$config['upload_path'] = $upload_path;
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if ( ! $this->upload->do_upload('main_img_'.$z)) {
$error = array('error' => $this->upload->display_errors());
gf_alert("이미지 업로드에 실패했습니다.", 'back');
exit;
}
$arr_upload_data = $this->upload->data();
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
} else {
if($img=='') {
$filename = $org_img;
} else {
$filename = $img;
# image upload
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
if (!is_dir($upload_path)) {
mkdir($upload_path, 0777, TRUE);
}
$arr_new_file = explode('/', $filename);
copy('.' . $filename, $upload_path . '/' . $etc_section_type.$z. '_' . $arr_new_file[5]);
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$etc_section_type.$z.'_'.$arr_new_file[5];
}
}
$req_data = array();
$req_data['main_img'] = $filename;
$req_data['head_title'] = $head_title;
$req_data['title'] = $title;
$req_data['content_idx'] = $content_idx;
$req_data['rank'] = $z;
if($db_content_idx == $content_idx) {
$req_data['idx'] = $list_idx;
$result = $this->m_life_etc_section->life_etc_section_detail_update($req_data);
} else {
$req_data['life_etc_section_idx'] = $idx;
$req_data['etc_section_type'] = $etc_section_type;
$result = $this->m_life_etc_section->life_etc_section_detail_insert($req_data);
}
if(!$result) {
gf_alert("채널 등록에 실패했습니다.", 'back');
exit;
}
if($hit_count!='' && $etc_section_type=='5') {
$req_data = array();
$req_data['idx'] = $content_idx;
$req_data['hit_count'] = $hit_count;
$this->load->model('admin/life/m_life');
$this->m_life->life_update($req_data);
}
}
}
}
gf_alert("저장되었습니다.", "/admin/etc_section/editor_list/6");
}
}
?>