first commit
This commit is contained in:
72
application/controllers/admin/admin_member.php
Executable file
72
application/controllers/admin/admin_member.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class admin_member extends cm_controller {
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 관리자 수정
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_member_edit() {
|
||||
# view
|
||||
return $this->load->view('/admin/admin_member/member_edit', '', true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 관리자 수정 실행
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_member_edit_proc() {
|
||||
|
||||
# Request
|
||||
$org_user_pwd = trim($this->input->get_post('org_user_pwd', TRUE)); // 기존비밀번호
|
||||
$new_user_pwd = trim($this->input->get_post('new_user_pwd', TRUE)); // 신규비밀번호
|
||||
|
||||
|
||||
|
||||
# valid Check
|
||||
if (empty($org_user_pwd) == true) {
|
||||
gf_alert('이전 비밀번호를 입력해주세요.', '/admin/admin_member/member_edit');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($new_user_pwd) == true) {
|
||||
gf_alert('신규 비밀번호를 입력해주세요.', '/admin/admin_member/member_edit');
|
||||
exit;
|
||||
}
|
||||
|
||||
$req_data['org_user_pwd'] = addslashes($org_user_pwd);
|
||||
$req_data['new_user_pwd'] = addslashes($new_user_pwd);
|
||||
|
||||
# model - 이전 비밀번호 확인
|
||||
$this->load->model('admin/admin_member/m_admin_member');
|
||||
$return_data = $this->m_admin_member->member_edit_proc($req_data);
|
||||
|
||||
if($return_data == '') {
|
||||
gf_alert('기존 비밀번호가 다릅니다.', '/admin/admin_member/member_edit');
|
||||
exit;
|
||||
}
|
||||
|
||||
# model - 신규 비밀번호 업데이트
|
||||
$this->load->model('admin/admin_member/m_admin_member');
|
||||
$this->m_admin_member->member_passwd_update($req_data);
|
||||
|
||||
|
||||
gf_alert('수정되었습니다.', '/admin/main');
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
316
application/controllers/admin/advertisement.php
Executable file
316
application/controllers/admin/advertisement.php
Executable file
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class advertisement extends cm_controller {
|
||||
|
||||
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
|
||||
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
|
||||
|
||||
/*
|
||||
title : 광고 페이지 관리 (목록)
|
||||
*/
|
||||
public function fn_1($page=1) {
|
||||
$this->load->database();
|
||||
$query = $this->db->get($this->ad_page_tb_name);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['row'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/advertisement/ads', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
public function fn_ad_page_arr_del_proc() {
|
||||
$is_del = $this->input->post('is_del');
|
||||
foreach($is_del as $v) {
|
||||
if($v>0) {
|
||||
$where_in[] = $v;
|
||||
}
|
||||
}
|
||||
if(count($where_in)>0) {
|
||||
$this->load->database();
|
||||
$this->db->where_in('idx',$where_in);
|
||||
$ret = $this->db->delete($this->ad_page_tb_name);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_ad_page_edit() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE) {
|
||||
$this->load->database();
|
||||
$query = $this->db->get_where($this->ad_page_tb_name, array('idx'=>$idx));
|
||||
$row = $query->row_array();
|
||||
$row['result'] = 'success';
|
||||
} else {
|
||||
$row['result'] = 'fail';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* [ad_page_proc register ad page]
|
||||
* @return [boolean]
|
||||
*/
|
||||
public function fn_ad_page_proc() {
|
||||
$page_key = $this->input->post('page_key');
|
||||
$page_name = $this->input->post('page_name');
|
||||
$ad_pos_key = $this->input->post('ad_pos_key');
|
||||
$ad_pos_name = $this->input->post('ad_pos_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('page_key','페이지 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
|
||||
$this->form_validation->set_rules('page_name','페이지 이름',array('required'));
|
||||
$this->form_validation->set_rules('ad_pos_key','광고 위치 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
|
||||
$this->form_validation->set_rules('ad_pos_name','광고 위치 이름',array('required'));
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$this->load->database();
|
||||
$data = ['page_key'=>$page_key,
|
||||
'page_name'=>$page_name,
|
||||
'ad_pos_key'=>$ad_pos_key,
|
||||
'ad_pos_name'=>$ad_pos_name];
|
||||
if($mode=='upt' && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$this->db->update($this->ad_page_tb_name,$data);
|
||||
$message = '수정되었습니다';
|
||||
} else {
|
||||
$this->db->insert($this->ad_page_tb_name,$data);
|
||||
$message = '등록되었습니다';
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
} else {
|
||||
echo "<script>alert('적합한 데이터를 입력해 주십시오.');exit;</script>";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// 개별광고페이지
|
||||
public function fn_ad_detail(){
|
||||
$this->load->database();
|
||||
// $this->db->select('*');
|
||||
// $this->db->from($this->ad_code_tb_name);
|
||||
// $this->db->join($this->ad_page_tb_name, $this->ad_page_tb_name.'.idx = '.$this->ad_code_tb_name.'.ad_idx');
|
||||
// $query = $this->db->get();
|
||||
$query = $this->db->query("SELECT a.idx, b.page_name, b.ad_pos_name, a.ad_code, a.ad_file FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['row'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/advertisement/ad_detail',$return_data,true);
|
||||
}
|
||||
|
||||
// 개별광고페이지 등록 및 수정 form
|
||||
public function fn_ad_register(){
|
||||
$this->load->database();
|
||||
//page_list 만들기
|
||||
$query = $this->db->get($this->ad_page_tb_name);
|
||||
$i=0;
|
||||
$return_data = array();
|
||||
$result=$query->result_array();
|
||||
foreach($result as $v){
|
||||
$page_list[]=$v['page_name'];
|
||||
}
|
||||
|
||||
$return_data['page_name']=array_values(array_unique($page_list)); //page_name list
|
||||
|
||||
//page_list array 에 광고 위치 push
|
||||
$x = count($return_data['page_name']);
|
||||
$return_data['ad_pos_name']=array();
|
||||
$y=0;
|
||||
foreach($return_data['page_name'] as $row2) {
|
||||
foreach($result as $row) {
|
||||
if($row['page_name']==$row2){
|
||||
$return_data['ad_pos_name'][$y][]=$row['ad_pos_name'];
|
||||
}
|
||||
}
|
||||
$y++;
|
||||
}
|
||||
|
||||
//수정btn으로 이동했을 시
|
||||
if($this->input->post('mode')=='modify'){
|
||||
$return_data['mode']='modify';
|
||||
$select ='a.*, b.page_name, b.ad_pos_name';
|
||||
$query = $this->db->query("SELECT $select FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['edit_data'] = $row;
|
||||
}
|
||||
}else{
|
||||
$return_data['mode']='reg';
|
||||
}
|
||||
|
||||
// row -> 전체 배열
|
||||
// page_name -> page_name list
|
||||
// ad_pos_name -> ad_pos_name list
|
||||
// mode -> 수정 등록 구분
|
||||
// edit_data -> 수정일 때 data
|
||||
|
||||
return $this->load->view('/admin/advertisement/ad_reg', $return_data , true);
|
||||
}
|
||||
|
||||
//개별광고 등록
|
||||
public function fn_ad_detail_reg(){
|
||||
$page_name = $this->input->post('page_title');
|
||||
$ad_pos_name = $this->input->post('ad_pos');
|
||||
|
||||
$ad_option = $this->input->post('ad_option'); // $ad_option 0: 광고 파일 등록 1:광고 코드 등록
|
||||
$ad_lending = $this->input->post('ad_lending');
|
||||
$ad_code = htmlspecialchars($this->input->post('ad_code'));
|
||||
|
||||
$where=array('page_name' => $page_name, 'ad_pos_name' => $ad_pos_name);
|
||||
|
||||
$this->load->database();
|
||||
$query = $this->db->get_where($this->ad_page_tb_name, $where);
|
||||
$ad_idx; //ad_idx 찾기
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
$ad_idx = $row->idx;
|
||||
}
|
||||
//이미지 업로드
|
||||
if($_FILES['ad_file']['name']!='') {
|
||||
$upload_path = './files/advertisement/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
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);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('ad_file')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
exit;
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$ad_file = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
|
||||
}
|
||||
|
||||
// 이미 존재하는 데이터이면 수정 함
|
||||
$where=array('ad_idx' => $ad_idx);
|
||||
$query = $this->db->get_where($this->ad_code_tb_name, $where);
|
||||
$result = $query->result();
|
||||
empty($result[0]->idx)?$isdata=false:$isdata=true;
|
||||
|
||||
if($isdata){
|
||||
if(!empty($ad_file)){
|
||||
$update_data = array(
|
||||
'ad_idx' => $ad_idx,
|
||||
'ad_option' => $ad_option,
|
||||
'ad_file' => $ad_file,
|
||||
'ad_lending' => $ad_lending,
|
||||
'ad_code' => $ad_code,
|
||||
);
|
||||
}else{
|
||||
$update_data = array(
|
||||
'ad_idx' => $ad_idx,
|
||||
'ad_option' => $ad_option,
|
||||
'ad_lending' => $ad_lending,
|
||||
'ad_code' => $ad_code,
|
||||
);
|
||||
}
|
||||
$this->db->where('idx', $result[0]->idx);
|
||||
$this->db->update($this->ad_code_tb_name, $update_data);
|
||||
}else{
|
||||
if(!empty($ad_file)){
|
||||
$insert_data = array(
|
||||
'ad_idx' => $ad_idx,
|
||||
'ad_option' => $ad_option,
|
||||
'ad_file' => $ad_file,
|
||||
'ad_lending' => $ad_lending,
|
||||
'ad_code' => $ad_code,
|
||||
);
|
||||
}else{
|
||||
$insert_data = array(
|
||||
'ad_idx' => $ad_idx,
|
||||
'ad_option' => $ad_option,
|
||||
'ad_lending' => $ad_lending,
|
||||
'ad_code' => $ad_code,
|
||||
);
|
||||
}
|
||||
$this->db->insert($this->ad_code_tb_name, $insert_data);
|
||||
}
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('advertisement_lib',$params);
|
||||
$this->advertisement_lib->create_ad_cache();
|
||||
$this->load->helper('url');
|
||||
redirect('https://crossmap.co.kr/admin/advertisement/ad_detail');
|
||||
}
|
||||
|
||||
//광고 개별 관리 삭제
|
||||
public function fn_ad_detail_arr_del_proc() {
|
||||
$is_del = $this->input->post('is_del');
|
||||
foreach($is_del as $v) {
|
||||
if($v>0) {
|
||||
$where_in[] = $v;
|
||||
}
|
||||
}
|
||||
if(count($where_in)>0) {
|
||||
$this->load->database();
|
||||
$this->db->where_in('idx',$where_in);
|
||||
$ret = $this->db->delete($this->ad_code_tb_name);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('advertisement_lib',$params);
|
||||
$this->advertisement_lib->create_ad_cache();
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_ad_create_cache(){
|
||||
$this->load->database();
|
||||
$query = $this->db->query("SELECT a.idx, b.page_key, b.ad_pos_key, a.ad_option, a.ad_code, a.ad_file,a.ad_lending FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
|
||||
$i=array();
|
||||
foreach($query->result_array() as $v){
|
||||
$i[$v['page_key']][$v['ad_pos_key']]=array('option'=>$v['ad_option'],'ad_code'=>$v['ad_code'],'ad_file'=>$v['ad_file'],'ad_lending'=>$v['ad_lending']);
|
||||
}
|
||||
|
||||
$json_data=json_encode($i);
|
||||
|
||||
print_r($i);
|
||||
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('advertisement_lib',$params);
|
||||
|
||||
if($json_data!=FALSE) {
|
||||
$this->advertisement_lib->write_ad_cache($json_data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
40
application/controllers/admin/advertisement_ajax.php
Executable file
40
application/controllers/admin/advertisement_ajax.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class advertisement_ajax extends CI_Controller {
|
||||
|
||||
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
|
||||
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
|
||||
|
||||
// find ad_detail by page_name, pos_name
|
||||
public function ajax_call_ad_detail_ad_idx(){
|
||||
$this->load->database();
|
||||
|
||||
$page_name = $this->input->get_post('page_name');
|
||||
$pos_name = $this->input->get_post('pos_name');
|
||||
|
||||
$select ='a.*, b.page_name, b.ad_pos_name';
|
||||
|
||||
|
||||
$where = "b.page_name='".$page_name."' AND b.ad_pos_name= '".$pos_name."'";
|
||||
$db_query ="SELECT $select FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx WHERE $where";
|
||||
$result = $this->db->query($db_query);
|
||||
$data=null;
|
||||
foreach($result->result_object() as $row) {
|
||||
$data = $row;
|
||||
|
||||
}
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1154
application/controllers/admin/column.php
Executable file
1154
application/controllers/admin/column.php
Executable file
File diff suppressed because it is too large
Load Diff
805
application/controllers/admin/cs.php
Executable file
805
application/controllers/admin/cs.php
Executable file
@@ -0,0 +1,805 @@
|
||||
<?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 cs extends cm_Controller {
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 list
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_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_click1 = trim($this->input->get_post('search_click1', TRUE));
|
||||
$search_click2 = trim($this->input->get_post('search_click2', 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_click1'] = $search_click1;
|
||||
$req_data['search_click2'] = $search_click2;
|
||||
|
||||
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
# model - 카테고리 list
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
$total_count = $this->m_bbs_question->bbs_question_list_total_count($req_data);
|
||||
$result = $this->m_bbs_question->bbs_question_list($req_data);
|
||||
|
||||
$new_count = $this->m_bbs_question->bbs_question_new_count($req_data);
|
||||
$is_reply_count = $this->m_bbs_question->bbs_question_group_by_is_reply($req_data);
|
||||
|
||||
$arr_is_reply_count = array();
|
||||
foreach($is_reply_count as $val) {
|
||||
$arr_is_reply_count[$val['is_reply']] = $val['cnt'];
|
||||
}
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $total_count;
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['base_url'] = '/admin/cs/cs_question_list/7' ;
|
||||
$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;
|
||||
$return_data['new_count'] = $new_count;
|
||||
$return_data['arr_is_reply_count'] = $arr_is_reply_count;
|
||||
$return_data['search_click1'] = $search_click1;
|
||||
$return_data['search_click2'] = $search_click2;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_question_list', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 reply add
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_reply_add() {
|
||||
# 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));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
$return_data = $this->m_bbs_question->bbs_question_select($idx);
|
||||
if(count($return_data) == 0) {
|
||||
gf_alert("잘못된 접근입니다.", '/admin/main');
|
||||
}
|
||||
|
||||
# view data
|
||||
$return_data['page'] = $page;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['idx'] = $idx;
|
||||
$return_data['result'] = $return_data[0];
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_question_reply_add', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 reply add - 저장
|
||||
# CREATE : 2018-02-21
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_reply_add_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));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$title = trim($this->input->get_post('title', TRUE));
|
||||
$content = trim($this->input->get_post('content', FALSE));
|
||||
|
||||
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
|
||||
# select
|
||||
$result = $this->m_bbs_question->bbs_question_select($idx);
|
||||
if(count($result)==0) {
|
||||
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_question_list/7');
|
||||
exit;
|
||||
}
|
||||
$member_id = $result[0]['member_id'];
|
||||
|
||||
$req_data = array();
|
||||
$req_data['p_idx'] = $idx;
|
||||
$req_data['title'] = $title;
|
||||
$req_data['content'] = $content;
|
||||
$req_data['member_id'] = $member_id;
|
||||
|
||||
# insert
|
||||
$result1 = $this->m_bbs_question->bbs_question_reply_insert($req_data);
|
||||
if(!$result1) {
|
||||
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_question_list/7');
|
||||
exit;
|
||||
}
|
||||
|
||||
# is_reply update
|
||||
$this->m_bbs_question->bbs_question_is_reply_update($idx);
|
||||
|
||||
|
||||
gf_alert("등록되었습니다.", '/admin/cs/cs_question_list/7');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 reply 삭제 - 저장
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_reply_del_proc() {
|
||||
# request
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
$req_date[] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
$this->m_bbs_question->bbs_question_is_del_update($req_date);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_question_list/7');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 reply 삭제 - 저장 (다중)
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_reply_arr_del_proc() {
|
||||
# request
|
||||
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
$this->m_bbs_question->bbs_question_is_del_update($arr_idx);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_question_list/7');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 1:1문의 view
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_question_view() {
|
||||
# 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_is_reply = trim($this->input->get_post('search_is_reply', TRUE));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_question');
|
||||
$return_data = $this->m_bbs_question->bbs_question_select($idx);
|
||||
if(count($return_data) == 0) {
|
||||
gf_alert("잘못된 접근입니다.", '/admin/main');
|
||||
}
|
||||
|
||||
# view data
|
||||
$return_data['page'] = $page;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['search_is_reply'] = $search_is_reply;
|
||||
$return_data['idx'] = $idx;
|
||||
$return_data['result'] = $return_data[0];
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_question_view', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 list
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_notice_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_click = trim($this->input->get_post('search_click', 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_click'] = $search_click;
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
# model - 카테고리 list
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$total_count = $this->m_bbs_notice->bbs_notice_list_total_count($req_data);
|
||||
$result = $this->m_bbs_notice->bbs_notice_list($req_data);
|
||||
$new_count = $this->m_bbs_notice->bbs_notice_new_count();
|
||||
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $total_count;
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['base_url'] = '/admin/cs/cs_notice_list/7' ;
|
||||
$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_click'] = $search_click;
|
||||
$return_data['list'] = $result;
|
||||
$return_data['new_count'] = $new_count;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_notice_list', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 select
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_notice_reg() {
|
||||
# request
|
||||
$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));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
if($mode == '') $mode = 'add';
|
||||
|
||||
$return_data = array();
|
||||
if($mode == 'edit') {
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$result = $this->m_bbs_notice->bbs_notice_select($idx);
|
||||
$return_data['result'] = $result[0];
|
||||
}
|
||||
|
||||
$return_data['mode'] = $mode;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['idx'] = $idx;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_notice_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 - 저장
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_notice_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));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$title = trim($this->input->get_post('title', TRUE));
|
||||
$content = trim($this->input->get_post('content', FALSE));
|
||||
$mode = trim($this->input->get_post('mode', TRUE));;
|
||||
|
||||
$req_data['title'] = $title;
|
||||
$req_data['content'] = $content;
|
||||
|
||||
|
||||
if($mode == 'add') {
|
||||
# model - insert
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$result = $this->m_bbs_notice->bbs_notice_insert($req_data);
|
||||
|
||||
|
||||
} else if($mode == 'edit') {
|
||||
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
# model - insert
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$result = $this->m_bbs_notice->bbs_notice_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
if(!$result) {
|
||||
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_notice_list/7/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/cs/cs_notice_list/7/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 삭제 - 저장
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_notice_del_proc() {
|
||||
# request
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
$req_date[] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$this->m_bbs_notice->bbs_notice_is_del_update($req_date);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_notice_list/7');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 삭제 (다중)
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_notice_arr_del_proc() {
|
||||
# request
|
||||
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_notice');
|
||||
$this->m_bbs_notice->bbs_notice_is_del_update($arr_idx);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_notice_list/7');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - faq list
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_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_code = trim($this->input->get_post('search_category_code', TRUE));
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
if($search_category_code=='') {
|
||||
$search_category_code = '27';
|
||||
}
|
||||
|
||||
$search_category1 = substr($search_category_code, 0, 2);
|
||||
$search_category2 = substr($search_category_code, 2, 2);
|
||||
|
||||
|
||||
# 검색
|
||||
$req_data['search_type'] = $search_type;
|
||||
$req_data['search_keyword'] = addslashes($search_keyword);
|
||||
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['search_category1'] = $search_category1;
|
||||
$req_data['search_category2'] = $search_category2;
|
||||
|
||||
|
||||
# model - 카테고리 list
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$total_count = $this->m_bbs_faq->bbs_faq_list_total_count($req_data);
|
||||
$result = $this->m_bbs_faq->bbs_faq_list($req_data);
|
||||
$category_result = $this->m_bbs_faq->faq_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/cs/cs_faq_list/7' ;
|
||||
$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_category1'] = $search_category1;
|
||||
$return_data['search_category2'] = $search_category2;
|
||||
$return_data['search_category_code']= $search_category_code;
|
||||
$return_data['list'] = $result;
|
||||
$return_data['arr_category1'] = $arr_category1;
|
||||
$return_data['arr_category2'] = $arr_category2;
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_faq_list', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 faq - 등록 / 수정
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_reg() {
|
||||
# request
|
||||
$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));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
|
||||
|
||||
if($mode == '') $mode = 'add';
|
||||
|
||||
# model - 카테고리 list
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$category_result = $this->m_bbs_faq->faq_category_all_list();
|
||||
|
||||
$arr_category1 = 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[]= array('p_category_code' => $val['p_category_code'], 'category_code'=>$val['category_code'], 'category_name'=>$val['category_name']);
|
||||
}
|
||||
}
|
||||
|
||||
$return_data = array();
|
||||
if($mode == 'edit') {
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$result = $this->m_bbs_faq->bbs_faq_select($idx);
|
||||
$return_data['result'] = $result[0];
|
||||
}
|
||||
|
||||
$return_data['mode'] = $mode;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['search_category_code']= $search_category_code;
|
||||
$return_data['arr_category1'] = $arr_category1;
|
||||
$return_data['arr_category2'] = $arr_category2;
|
||||
$return_data['idx'] = $idx;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_faq_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - faq - 저장
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_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_code = trim($this->input->get_post('search_category_code', 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));
|
||||
$title = trim($this->input->get_post('title', TRUE));
|
||||
$content = trim($this->input->get_post('content', FALSE));
|
||||
$mode = trim($this->input->get_post('mode', TRUE));;
|
||||
|
||||
$category_code = $category1.$category2;
|
||||
|
||||
$req_data['title'] = $title;
|
||||
$req_data['content'] = $content;
|
||||
$req_data['faq_category_code1'] = $category1;
|
||||
$req_data['faq_category_code2'] = $category2;
|
||||
|
||||
|
||||
|
||||
if($mode == 'add') {
|
||||
# model - insert
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$result = $this->m_bbs_faq->bbs_faq_insert($req_data);
|
||||
|
||||
|
||||
} else if($mode == 'edit') {
|
||||
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
# model - insert
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$result = $this->m_bbs_faq->bbs_faq_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
if(!$result) {
|
||||
gf_alert("저장에 실패했습니다. 다시시도해 주세요.", '/admin/cs/cs_faq_list/7/'.$page.'?search_category_code='.$search_category_code.'&search_type='.$search_type.'&search_keyword='.$search_keyword);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/cs/cs_faq_list/7/'.$page.'?search_category_code='.$search_category_code.'&search_type='.$search_type.'&search_keyword='.$search_keyword);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - faq 삭제
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_del_proc() {
|
||||
# request
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
|
||||
|
||||
$req_date[] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$this->m_bbs_faq->bbs_faq_is_del_update($req_date);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_list/7?search_category_code='.$search_category_code);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - 공지사항 삭제 (다중)
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_arr_del_proc() {
|
||||
# request
|
||||
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
|
||||
$search_category_code = trim($this->input->get_post('search_category_code', TRUE));
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$this->m_bbs_faq->bbs_faq_is_del_update($arr_idx);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_list/7?search_category_code='.$search_category_code);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 faq 카테고리별 count
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_ajax_cs_faq_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/cs/m_bbs_faq');
|
||||
$count = $this->m_bbs_faq->bbs_faq_category_code_count($req_date);
|
||||
|
||||
|
||||
$return_data['result'] = $count;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_faq_category_code_count', $return_data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 - faq 카테고리 리스트
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_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));
|
||||
|
||||
# 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/cs/m_bbs_faq');
|
||||
$total_count = $this->m_bbs_faq->faq_category_list_total_count($req_data);
|
||||
$result = $this->m_bbs_faq->faq_category_list($req_data);
|
||||
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $total_count;
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['base_url'] = '/admin/cs/cs_faq_category_list/4' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
|
||||
|
||||
|
||||
|
||||
# view data
|
||||
$return_data['pagination'] = $pagination;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['limit'] = $limit;
|
||||
$return_data['total_count'] = $total_count;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['list'] = $result;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/cs/cs_faq_category_list', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 faq 카테고리 - 저장
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_ajax_cs_faq_category_reg_proc() {
|
||||
# request
|
||||
$mode = trim($this->input->get_post('mode', TRUE));
|
||||
$category_name = trim($this->input->get_post('category_name', TRUE));
|
||||
$p_category_code = trim($this->input->get_post('p_category_code', TRUE));
|
||||
$category_idx = trim($this->input->get_post('category_idx', TRUE));
|
||||
|
||||
$req_data['category_name'] = $category_name;
|
||||
|
||||
if($mode == 'add') {
|
||||
$depth = '1';
|
||||
if($p_category_code!='') $depth = '2';
|
||||
|
||||
$req_data['p_category_code'] = $p_category_code;
|
||||
$req_data['depth'] = $depth;
|
||||
|
||||
# model - insert
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$result = $this->m_bbs_faq->bbs_faq_category_insert($req_data);
|
||||
$result_code = '0000';
|
||||
if(!$result) {
|
||||
$result_code = '9999';
|
||||
}
|
||||
|
||||
} else if($mode == 'edit') {
|
||||
$req_data['idx'] = $category_idx;
|
||||
|
||||
# model
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$result = $this->m_bbs_faq->bbs_faq_category_update($req_data);
|
||||
$result_code = '0000';
|
||||
if(!$result) {
|
||||
$result_code = '9999';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$return_data['result'] = $result_code;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/comm/result_html', $return_data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 고객센터 faq 카테고리 삭제 - 저장
|
||||
# CREATE : 2018-02-28
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_cs_faq_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_date['p_category_code']= $del_key;
|
||||
$req_date['idx'] = '';
|
||||
} else {
|
||||
$req_date['p_category_code']= '';
|
||||
$req_date['idx'] = $del_key;
|
||||
}
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/cs/m_bbs_faq');
|
||||
$this->m_bbs_faq->bbs_faq_category_is_del_update($req_date);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/cs/cs_faq_category_list/7');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
118
application/controllers/admin/delete.later/advertisement_bak190227.php
Executable file
118
application/controllers/admin/delete.later/advertisement_bak190227.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class advertisement extends cm_controller {
|
||||
|
||||
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
|
||||
var $ad_code_tb_name = ''; // 광고 코드 테이블 이름
|
||||
|
||||
/*
|
||||
title : 광고 페이지 관리 (목록)
|
||||
*/
|
||||
public function fn_1($page=1) {
|
||||
$this->load->database();
|
||||
$query = $this->db->get($this->ad_page_tb_name);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['row'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/advertisement/ads', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
public function fn_ad_page_arr_del_proc() {
|
||||
$is_del = $this->input->post('is_del');
|
||||
foreach($is_del as $v) {
|
||||
if($v>0) {
|
||||
$where_in[] = $v;
|
||||
}
|
||||
}
|
||||
if(count($where_in)>0) {
|
||||
$this->load->database();
|
||||
$this->db->where_in('idx',$where_in);
|
||||
$ret = $this->db->delete($this->ad_page_tb_name);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_ad_page_edit() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE) {
|
||||
$this->load->database();
|
||||
$query = $this->db->get_where($this->ad_page_tb_name, array('idx'=>$idx));
|
||||
$row = $query->row_array();
|
||||
$row['result'] = 'success';
|
||||
} else {
|
||||
$row['result'] = 'fail';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* [ad_page_proc register ad page]
|
||||
* @return [boolean]
|
||||
*/
|
||||
public function fn_ad_page_proc() {
|
||||
$page_key = $this->input->post('page_key');
|
||||
$page_name = $this->input->post('page_name');
|
||||
$ad_pos_key = $this->input->post('ad_pos_key');
|
||||
$ad_pos_name = $this->input->post('ad_pos_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('page_key','페이지 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
|
||||
$this->form_validation->set_rules('page_name','페이지 이름',array('required'));
|
||||
$this->form_validation->set_rules('ad_pos_key','광고 위치 키',array('required','regex_match[/^[a-zA-Z]+$/]'));
|
||||
$this->form_validation->set_rules('ad_pos_name','광고 위치 이름',array('required'));
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$this->load->database();
|
||||
$data = ['page_key'=>$page_key,
|
||||
'page_name'=>$page_name,
|
||||
'ad_pos_key'=>$ad_pos_key,
|
||||
'ad_pos_name'=>$ad_pos_name];
|
||||
if($mode=='upt' && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$this->db->update($this->ad_page_tb_name,$data);
|
||||
$message = '수정되었습니다';
|
||||
} else {
|
||||
$this->db->insert($this->ad_page_tb_name,$data);
|
||||
$message = '등록되었습니다';
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
} else {
|
||||
echo "<script>alert('적합한 데이터를 입력해 주십시오.');exit;</script>";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
545
application/controllers/admin/delete.later/cron01.php
Executable file
545
application/controllers/admin/delete.later/cron01.php
Executable file
@@ -0,0 +1,545 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
* 컨텐츠관련 스케쥴
|
||||
*/
|
||||
class cron01 extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 언론사 등록기사 업데이트
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
function press_article_count_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] press_article_count_update start'.chr(10);
|
||||
|
||||
# model - 뉴스 count
|
||||
$this->load->model('admin/news/m_news');
|
||||
$result1 = $this->m_news->news_group_by_press_idx();
|
||||
|
||||
# model - press update
|
||||
$this->load->model('admin/etc_section/m_press');
|
||||
$result2 = $this->m_press->press_article_count_update($result1);
|
||||
|
||||
$contents.= $result2.'개 업데이트 완료'.chr(10);
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] press_article_count_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 예약글 노출 - 테마도 같이 해줄까?
|
||||
# CREATE : 2018-03-30
|
||||
#---------------------------------------------------------------------------
|
||||
function reservation_article_display_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
|
||||
|
||||
|
||||
$this->load->model('admin/news/m_news');
|
||||
$this->load->model('admin/life/m_life');
|
||||
$this->load->model('admin/column/m_column');
|
||||
$arr = array('1', '2', '3');
|
||||
foreach ($arr as $content_type) {
|
||||
if($content_type == '1') {
|
||||
$result1 = $this->m_news->news_reservation_article_list();
|
||||
if(count($result1) > 0) $this->m_news->news_is_display_update_batch($result1);
|
||||
} else if($content_type == '2') {
|
||||
$result1 = $this->m_column->column_reservation_article_list();
|
||||
if(count($result1) > 0) $this->m_column->column_is_display_update_batch($result1);
|
||||
} else if($content_type == '3') {
|
||||
$result1 = $this->m_life->life_reservation_article_list();
|
||||
if(count($result1) > 0) $this->m_life->life_is_display_update_batch($result1);
|
||||
}
|
||||
|
||||
foreach ($result1 as $val) {
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = $content_type;
|
||||
$req_data['content_idx'] = $val['idx'];
|
||||
$req_data['search_type'] = 'is_display';
|
||||
$req_data['search_key'] = 'N';
|
||||
|
||||
// 테마
|
||||
$this->load->library('comm_admin');
|
||||
$this->comm_admin->fn_theme_change_is_display($req_data);
|
||||
|
||||
// 기타테마
|
||||
$this->load->library('comm_admin');
|
||||
$this->comm_admin->fn_etc_section_change_is_display($req_data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$contents.= $content_type.'-----------------------------------------------------------------------------------'.chr(10);
|
||||
|
||||
ob_flush();
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 랭킹관리 노출 - 뉴스 라이프
|
||||
# CREATE : 2018-03-30
|
||||
#---------------------------------------------------------------------------
|
||||
function article_rank_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] article_rank_update start'.chr(10);
|
||||
|
||||
|
||||
|
||||
$this->load->model('admin/comm/m_ranking');
|
||||
$this->load->model('admin/news/m_news');
|
||||
$this->load->model('admin/life/m_life');
|
||||
|
||||
$this->m_ranking->rank_all_copy_ranking_log(1); // 로그로 이동
|
||||
$this->m_ranking->rank_all_copy_ranking_log(3); // 로그로 이동
|
||||
|
||||
|
||||
$ranking_date = date("Y-m-d");
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
|
||||
$this->m_ranking->rank_where_ranking_date_delete($ranking_date);
|
||||
|
||||
|
||||
# 뉴스
|
||||
$arr_orderby = array('hit_count', 'comment_count', 'review_count1');
|
||||
$z=1;
|
||||
foreach ($arr_orderby as $val0) {
|
||||
$req_data = array();
|
||||
$req_data['order_by'] = $val0;
|
||||
$result1 = $this->m_news->news_rank_list($req_data);
|
||||
if(count($result1) > 0) {
|
||||
$i=1;
|
||||
foreach ($result1 as $val) {
|
||||
$org_file = $val['main_img'];
|
||||
$filename = '';
|
||||
if($org_file!='') {
|
||||
# image copy
|
||||
$upload_path = './files/ranking/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$arr_new_file = explode('/', $org_file);
|
||||
copy('.' . $org_file, $upload_path . '/ranking_type'.$z.$i. '_' . $arr_new_file[5]);
|
||||
$filename = '/files/ranking/'.date("Y").'/'.date("m").'/ranking_type'.$z.$i. '_' . $arr_new_file[5];
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['ranking_date'] = $ranking_date;
|
||||
$req_data['ranking_type'] = $z;
|
||||
$req_data['content_type'] = '1';
|
||||
$req_data['rank'] = $i;
|
||||
$req_data['title'] = $val['title'];
|
||||
$req_data['main_img'] = $filename;
|
||||
$req_data['content_idx'] = $val['idx'];
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->m_ranking->ranking_all_insert($req_data);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$z++;
|
||||
|
||||
}
|
||||
|
||||
# 라이프
|
||||
$arr_orderby = array('hit_count', 'comment_count', 'like_count');
|
||||
$z=1;
|
||||
foreach ($arr_orderby as $val0) {
|
||||
$req_data = array();
|
||||
$req_data['order_by'] = $val0;
|
||||
$result1 = $this->m_life->life_rank_list($req_data);
|
||||
if(count($result1) > 0) {
|
||||
$i=1;
|
||||
foreach ($result1 as $val) {
|
||||
$org_file = $val['main_img'];
|
||||
$filename = '';
|
||||
if($org_file!='') {
|
||||
# image copy
|
||||
$upload_path = './files/ranking/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$arr_new_file = explode('/', $org_file);
|
||||
copy('.' . $org_file, $upload_path . '/ranking_type'.$z.$i. '_' . $arr_new_file[5]);
|
||||
$filename = '/files/ranking/'.date("Y").'/'.date("m").'/ranking_type'.$z.$i. '_' . $arr_new_file[5];
|
||||
}
|
||||
|
||||
|
||||
$req_data = array();
|
||||
$req_data['ranking_date'] = $ranking_date;
|
||||
$req_data['ranking_type'] = $z;
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['rank'] = $i;
|
||||
$req_data['head_title'] = $val['head_title'];
|
||||
$req_data['title'] = $val['title'];
|
||||
$req_data['main_img'] = $filename;
|
||||
$req_data['content_idx'] = $val['idx'];
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->m_ranking->ranking_all_insert($req_data);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$z++;
|
||||
|
||||
}
|
||||
|
||||
$delete_date = date("Y-m-d", strtotime("-1 day"));
|
||||
$this->m_ranking->rank_where_org_ranking_date_delete($delete_date);
|
||||
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] article_rank_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 실시간검색어
|
||||
# CREATE : 2018-03-27
|
||||
#---------------------------------------------------------------------------
|
||||
function realtime_keyword_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] realtime_keyword_update start'.chr(10);
|
||||
|
||||
|
||||
# model - realtime_keyword_setting 가져오기
|
||||
$idx = 1;
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_realtime_keyword');
|
||||
$result1 = $this->m_realtime_keyword->realtime_keyword_setting_select($idx);
|
||||
$base_hour = $result1[0]['base_hour'];
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
|
||||
$result2 = $this->m_realtime_keyword->realtime_keyword_max_reg_date();
|
||||
if(isset($result2[0]['reg_date'])==true){
|
||||
$date1 = strtotime($now_date);
|
||||
$date2 = strtotime($result2[0]['reg_date']);
|
||||
$diff_hour = floor(($date1 - $date2) / 3600);
|
||||
} else {
|
||||
$diff_hour = $base_hour;
|
||||
$date1 = $now_date;
|
||||
$date2 = date("Y-m-d H:i:s", strtotime ("-".$base_hour." hours"));
|
||||
}
|
||||
|
||||
if($base_hour <= $diff_hour) {
|
||||
|
||||
$this->m_realtime_keyword->realtime_keyword_move_log();
|
||||
|
||||
$req_data = array();
|
||||
$req_data['start_date'] = $date2;
|
||||
$req_data['end_date'] = $date1;
|
||||
|
||||
$this->load->model('admin/comm/m_search_keyword_log');
|
||||
$result3 = $this->m_search_keyword_log->search_keyword_log_group_by_keyword($req_data);
|
||||
|
||||
$i=1;
|
||||
foreach ($result3 as $val) {
|
||||
$arr_keyword = $this->m_realtime_keyword->realtime_keyword_where_keyword_select($val['keyword']);
|
||||
$rank = 0;
|
||||
if(count($arr_keyword)>0) {
|
||||
$rank = $arr_keyword['rank'];
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['keyword'] = $val['keyword'];
|
||||
$req_data['search_count'] = $val['cnt'];
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
$req_data['last_rank'] = $rank;
|
||||
$req_data['rank'] = $i;
|
||||
|
||||
$this->m_realtime_keyword->realtime_keyword_insert($req_data);
|
||||
|
||||
$i++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->m_realtime_keyword->realtime_keyword_where_reg_date_delete($date2);
|
||||
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] realtime_keyword_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 오늘의 말씀, 영적기상도 노출
|
||||
# CREATE : 2018-03-30
|
||||
#---------------------------------------------------------------------------
|
||||
function reservation_etc_display_update() {
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] reservation_etc_display_update start'.chr(10);
|
||||
|
||||
|
||||
|
||||
# 예약글 가져오기 - display = 'N' && display_date <= now()
|
||||
$this->load->model('admin/etc_section/m_today_word');
|
||||
$this->m_today_word->today_word_reservation_update();
|
||||
|
||||
# 예약글 가져오기 - display = 'N' && display_date <= now()
|
||||
$this->load->model('admin/etc_section/m_weather');
|
||||
$this->m_weather->weather_reservation_update();
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] reservation_etc_display_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 인기수 업데이트 - 컨텐츠
|
||||
# CREATE : 2018-03-27
|
||||
#---------------------------------------------------------------------------
|
||||
function article_popular_count_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] article_popular_count_update start'.chr(10);
|
||||
|
||||
|
||||
$this->load->model('admin/news/m_news');
|
||||
$this->load->model('admin/life/m_life');
|
||||
$this->load->model('admin/column/m_column');
|
||||
|
||||
$start_date = date("Y-m-d H:i:s", strtotime ("-30 day"));
|
||||
$delete_date = date("Y-m-d", strtotime ("-30 day"));
|
||||
|
||||
$this->m_news->news_popular_count_where_display_date_update($delete_date);
|
||||
$this->m_life->life_popular_count_where_display_date_update($delete_date);
|
||||
$this->m_column->column_popular_count_where_display_date_update($delete_date);
|
||||
|
||||
|
||||
$arr_news = $this->m_news->news_where_display_date_list($start_date);
|
||||
foreach ($arr_news as $val) {
|
||||
$hit_count = 0; $like_count = 0; $comment_count = 0;
|
||||
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
|
||||
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
|
||||
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
|
||||
|
||||
$hit_count = $hit_count * 3;
|
||||
$like_count = $like_count * 200;
|
||||
$comment_count = $comment_count * 400;
|
||||
|
||||
$popular_count = $hit_count + $like_count + $comment_count;
|
||||
|
||||
# 인기수 업데이트
|
||||
$req_data = array();
|
||||
$req_data['idx'] = $val['idx'];
|
||||
$req_data['popular_count'] = $popular_count;
|
||||
$this->m_news->news_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$arr_column = $this->m_column->column_where_display_date_list($start_date);
|
||||
foreach ($arr_column as $val) {
|
||||
$hit_count = 0; $like_count = 0; $comment_count = 0;
|
||||
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
|
||||
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
|
||||
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
|
||||
|
||||
$hit_count = $hit_count * 3;
|
||||
$like_count = $like_count * 200;
|
||||
$comment_count = $comment_count * 400;
|
||||
|
||||
$popular_count = $hit_count + $like_count + $comment_count;
|
||||
|
||||
# 인기수 업데이트
|
||||
$req_data = array();
|
||||
$req_data['idx'] = $val['idx'];
|
||||
$req_data['popular_count'] = $popular_count;
|
||||
$this->m_column->column_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$arr_life = $this->m_life->life_where_display_date_list($start_date);
|
||||
foreach ($arr_life as $val) {
|
||||
$hit_count = 0; $like_count = 0; $comment_count = 0;
|
||||
if(isset($val['hit_count'])==true) $hit_count = (int)$val['hit_count'];
|
||||
if(isset($val['like_count'])==true) $like_count = (int)$val['like_count'];
|
||||
if(isset($val['comment_count'])==true) $comment_count = (int)$val['comment_count'];
|
||||
|
||||
$hit_count = $hit_count * 3;
|
||||
$like_count = $like_count * 200;
|
||||
$comment_count = $comment_count * 400;
|
||||
|
||||
$popular_count = $hit_count + $like_count + $comment_count;
|
||||
|
||||
# 인기수 업데이트
|
||||
$req_data = array();
|
||||
$req_data['idx'] = $val['idx'];
|
||||
$req_data['popular_count'] = $popular_count;
|
||||
$this->m_life->life_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] article_popular_count_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 인기수 업데이트 - 채널, 에디터
|
||||
# CREATE : 2018-03-27
|
||||
#---------------------------------------------------------------------------
|
||||
function life_popular_count_update() {
|
||||
|
||||
if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] life_popular_count_update start'.chr(10);
|
||||
|
||||
$start_date = date("Y-m-d H:i:s", strtotime ("-30 day"));
|
||||
|
||||
# 채널
|
||||
$this->load->model('admin/comm/m_delivery');
|
||||
$this->load->model('admin/life/m_life');
|
||||
$this->load->model('admin/life/m_life_channel');
|
||||
$this->load->model('admin/comm/m_delivery');
|
||||
$arr_channel = $this->m_life_channel->channel_all_list();
|
||||
foreach ($arr_channel as $val) {
|
||||
# 배달수
|
||||
$req_data = array();
|
||||
$req_data['start_date'] = $start_date;
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['main_idx'] = $val['idx'];
|
||||
$delivery_count = $this->m_delivery->delivery_where_content_type_content_idx_count($req_data);
|
||||
$delivery_count = $delivery_count * 700;
|
||||
|
||||
# 조회수, 좋아요, 댓글
|
||||
$req_data = array();
|
||||
$req_data['start_date'] = $start_date;
|
||||
$req_data['channel_idx'] = $val['idx'];
|
||||
$arr_sum_count = $this->m_life->life_where_channel_idx_sum_count($req_data);
|
||||
|
||||
$hit_count = 0; $like_count = 0; $comment_count = 0;
|
||||
if(isset($arr_sum_count['hit_count'])==true) $hit_count = (int)$arr_sum_count['hit_count'];
|
||||
if(isset($arr_sum_count['like_count'])==true) $like_count = (int)$arr_sum_count['like_count'];
|
||||
if(isset($arr_sum_count['comment_count'])==true) $comment_count = (int)$arr_sum_count['comment_count'];
|
||||
|
||||
$hit_count = $hit_count * 3;
|
||||
$like_count = $like_count * 200;
|
||||
$comment_count = $comment_count * 400;
|
||||
|
||||
$popular_count = $delivery_count + $hit_count + $like_count + $comment_count;
|
||||
|
||||
# 인기수 업데이트
|
||||
$req_data = array();
|
||||
$req_data['idx'] = $val['idx'];
|
||||
$req_data['popular_count'] = $popular_count;
|
||||
$this->m_life_channel->channel_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
# 에디터
|
||||
# model
|
||||
$this->load->model('admin/member/m_partner');
|
||||
$req_data = array();
|
||||
$req_data['member_group_idx'] = '6';
|
||||
$arr_editor = $this->m_partner->partner_list_where_member_group_idx($req_data);
|
||||
foreach ($arr_editor as $val) {
|
||||
|
||||
# 북마크
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['start_date'] = $start_date;
|
||||
$req_data['partner_idx'] = $val['idx'];
|
||||
$bookmark_count = $this->m_life->life_join_bookmark_editor_count($req_data);
|
||||
$bookmark_count = $bookmark_count * 700;
|
||||
|
||||
# 조회수, 좋아요, 댓글
|
||||
$req_data = array();
|
||||
$req_data['start_date'] = $start_date;
|
||||
$req_data['partner_idx'] = $val['idx'];
|
||||
$arr_sum_count = $this->m_life->life_where_partner_idx_sum_count($req_data);
|
||||
|
||||
$hit_count = 0; $like_count = 0; $comment_count = 0;
|
||||
if(isset($arr_sum_count['hit_count'])==true) $hit_count = (int)$arr_sum_count['hit_count'];
|
||||
if(isset($arr_sum_count['like_count'])==true) $like_count = (int)$arr_sum_count['like_count'];
|
||||
if(isset($arr_sum_count['comment_count'])==true) $comment_count = (int)$arr_sum_count['comment_count'];
|
||||
|
||||
|
||||
$popular_count = $bookmark_count + $hit_count + $like_count + $comment_count;
|
||||
|
||||
# 인기수 업데이트
|
||||
$req_data = array();
|
||||
$req_data['idx'] = $val['idx'];
|
||||
$req_data['popular_count'] = $popular_count;
|
||||
$this->m_partner->partner_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] life_popular_count_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
224
application/controllers/admin/delete.later/cron02.php
Executable file
224
application/controllers/admin/delete.later/cron02.php
Executable file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
* 회원글관련 스케쥴
|
||||
*/
|
||||
class cron02 extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 좋아요수 셋팅해놓은 갯수 이상이면 배댓
|
||||
# CREATE : 2018-05-14
|
||||
#---------------------------------------------------------------------------
|
||||
function best_comment_update() {
|
||||
|
||||
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] best_comment_update start'.chr(10);
|
||||
|
||||
|
||||
# model
|
||||
$this->load->model('admin/comm/m_comment');
|
||||
$this->m_comment->comment_is_best_all_update();
|
||||
|
||||
$this->load->model('admin/setting/m_comment_setting');
|
||||
$arr_comment_setting = $this->m_comment_setting->comment_setting_list();
|
||||
foreach ($arr_comment_setting as $val) {
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = $val['setting_type'];
|
||||
$req_data['like_count'] = $val['best_comment_like_count'];
|
||||
$req_data['limit'] = $val['max_best_comment_count'];
|
||||
|
||||
$this->m_comment->comment_is_best_update($req_data);
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] best_comment_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 블라인드 처리
|
||||
# CREATE : 2018-05-14
|
||||
#---------------------------------------------------------------------------
|
||||
function blind_update() {
|
||||
|
||||
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] blind_update start'.chr(10);
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
$this->load->model('admin/setting/m_comment_setting');
|
||||
$this->load->model('admin/setting/m_blind');
|
||||
$this->load->model('admin/comm/m_comment');
|
||||
$this->load->model('admin/comm/m_spam');
|
||||
$arr_comment_setting = $this->m_comment_setting->comment_setting_list();
|
||||
foreach ($arr_comment_setting as $val) {
|
||||
|
||||
if($val['block_call_type']=='1'){ // 블라인드
|
||||
$blind_comment = $val['block_blind_conent'];
|
||||
$blind_code ='2';
|
||||
} else if($val['block_call_type']=='2'){ // 자동삭제
|
||||
$blind_comment = $val['block_del_conent'];
|
||||
$blind_code ='3';
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = $val['setting_type'];
|
||||
$req_data['block_call_count'] = $val['block_call_count'];
|
||||
|
||||
$arr_blind_list = $this->m_spam->spam_where_block_list($req_data);
|
||||
|
||||
if(count($arr_blind_list) > 0) {
|
||||
foreach ($arr_blind_list as $val2) {
|
||||
|
||||
$arr_comment = $this->m_comment->comment_select($val2['comment_idx']);
|
||||
|
||||
if($arr_comment['comment_status']!='1') continue;
|
||||
|
||||
$req_data = array();
|
||||
$req_data['comment_status'] = $blind_code;
|
||||
$req_data['comment'] = $blind_comment;
|
||||
$req_data['comment_org'] = $arr_comment['comment'];
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
$req_data['del_date'] = $now_date;
|
||||
$req_data['idx'] = $val2['comment_idx'];
|
||||
|
||||
$this->m_comment->comment_update($req_data);
|
||||
|
||||
$req_data = array();
|
||||
$req_data['blind_type'] = '1';
|
||||
$req_data['content_type'] = $val['setting_type'];
|
||||
$req_data['content_idx'] = $arr_comment['content_idx'];
|
||||
$req_data['comment_idx'] = $val2['comment_idx'];
|
||||
$req_data['blind_id'] = $arr_comment['write_id'];
|
||||
$req_data['blind_name'] = $arr_comment['write_name'];
|
||||
$req_data['blind_comment'] = $arr_comment['comment'];
|
||||
$req_data['blind_status'] = '1';
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
|
||||
$this->m_blind->blind_insert($req_data);
|
||||
$this->m_spam->spam_is_blind_where_comment_idx_update($val2['comment_idx']);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] blind_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 블라인드 제재처리
|
||||
# CREATE : 2018-05-14
|
||||
#---------------------------------------------------------------------------
|
||||
function blind_limit_update() {
|
||||
|
||||
if (!is_dir('./logs/cron02/'.date("Ym"))) mkdir('./logs/cron02/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] blind_limit_update start'.chr(10);
|
||||
|
||||
$this->load->model('admin/setting/m_blind');
|
||||
$this->load->model('admin/member/m_member');
|
||||
$this->load->model('admin/setting/m_blind_setting');
|
||||
$this->load->model('admin/setting/m_blind_limit');
|
||||
$arr_blind_setting = $this->m_blind_setting->blind_setting_list();
|
||||
|
||||
|
||||
foreach ($arr_blind_setting as $val) {
|
||||
|
||||
if($val['limit_count']==0) continue;
|
||||
|
||||
$req_data = array();
|
||||
$req_data['cnt'] = $val['limit_count'];
|
||||
|
||||
$arr_blind_list = $this->m_blind->blind_group_by_count_list($req_data);
|
||||
|
||||
if(count($arr_blind_list)>0) {
|
||||
foreach ($arr_blind_list as $val2){
|
||||
$arr_member = $this->m_member->member_where_member_id_select($val2['blind_id']);
|
||||
$member_name = ''; $member_email = '';
|
||||
if(isset($arr_member['member_name'])==true) {
|
||||
$member_name = $arr_member['member_name'];
|
||||
$member_email = $arr_member['member_email'];
|
||||
}
|
||||
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
if($val['limit_status'] == '2') {
|
||||
$end_date = $now_date;
|
||||
} else {
|
||||
$end_date = date("Y-m-d H:i:s", strtotime("+".$val['limit_day']." days"));
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $val2['blind_id'];
|
||||
$req_data['member_name'] = $member_name;
|
||||
$req_data['limit_type'] = $val['limit_type'];
|
||||
$req_data['limit_status'] = $val['limit_status'];
|
||||
$req_data['limit_day'] = $val['limit_day'];
|
||||
$req_data['start_date'] = $now_date;
|
||||
$req_data['end_date'] = $end_date;
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
$req_data['update_id'] = 'system';
|
||||
$req_data['update_date'] = $now_date;
|
||||
$req_data['blind_setting_idx'] = $val['idx'];
|
||||
|
||||
$this->m_blind_limit->blind_limit_insert($req_data);
|
||||
|
||||
// 제제 완료 처리 update
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $val2['blind_id'];
|
||||
$req_data['cnt'] = $val['limit_count'];
|
||||
|
||||
$this->m_blind->blind_group_by_count_update($req_data);
|
||||
|
||||
$req_data = array();
|
||||
$req_data['limit_content'] = $val['limit_content'];
|
||||
$req_data['limit_count'] = $val['limit_count'];
|
||||
$req_data['member_email'] = $member_email;
|
||||
$req_data['member_id'] = $val2['blind_id'];
|
||||
$req_data['limit_type'] = $val['limit_type'];
|
||||
$req_data['end_date'] = $end_date;
|
||||
$req_data['member_name'] = $member_name;
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$this->comm_admin->fn_blind_limit_proc($req_data);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] blind_limit_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron02/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
96
application/controllers/admin/delete.later/cron03.php
Executable file
96
application/controllers/admin/delete.later/cron03.php
Executable file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
* 그외 스케쥴
|
||||
*/
|
||||
class cron03 extends CI_Controller {
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 티날씨 스케쥴
|
||||
# CREATE : 2018-03-30
|
||||
#---------------------------------------------------------------------------
|
||||
function t_weather_proc() {
|
||||
|
||||
if (!is_dir('./logs/cron03/'.date("Ym"))) mkdir('./logs/cron03/'.date("Ym"), 0777, TRUE);
|
||||
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] t_weather_proc start'.chr(10);
|
||||
|
||||
# t 날씨 가져오기
|
||||
require_once ("./static_data/main_code.php");
|
||||
|
||||
$arr_public_weather = array();
|
||||
foreach ($def_arr_position as $val) {
|
||||
$latitude = $val['latitude'];
|
||||
$longitude = $val['longitude'];
|
||||
|
||||
$url = 'https://apis.sktelecom.com/v1/weather/status?latitude='.$latitude.'&longitude='.$longitude;
|
||||
$ch = curl_init(); //curl 사용 전 초기화 필수(curl handle)
|
||||
curl_setopt($ch, CURLOPT_URL, $url); //URL 지정하기
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'TDCProjectKey: 5cceabfc-f5a3-4a1c-a2c6-3e98e72c90bd')); //header 지정하기
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
$response = curl_exec ($ch);
|
||||
if($response!='') {
|
||||
|
||||
$result = json_decode($response, true);
|
||||
|
||||
if(isset($result['weatherStatusCode'])==true){
|
||||
switch ($result['weatherModifyCode']) {
|
||||
case '0': $temperatures = '-'; break;
|
||||
case '1': $temperatures = '한파'; break;
|
||||
case '2': $temperatures = '추움'; break;
|
||||
case '3': $temperatures = '쌀쌀'; break;
|
||||
case '4': $temperatures = '포근'; break;
|
||||
case '5': $temperatures = '따뜻'; break;
|
||||
case '6': $temperatures = '선선'; break;
|
||||
case '7': $temperatures = '더움'; break;
|
||||
case '8': $temperatures = '폭염'; break;
|
||||
default : $temperatures = ''; break;
|
||||
}
|
||||
|
||||
if($result['weatherStatusDescription']=='알수없음') $result['weatherStatusDescription'] = '-';
|
||||
$weather_img = '/img/web/pweather_icon_'.$result['weatherStatusCode'].'.png';
|
||||
$arr_public_weather[] = array('location'=>$val['position_name'], 'weather_img'=>$weather_img, 'weather_status'=>$result['weatherStatusDescription'], 'temperatures'=>$temperatures);
|
||||
}
|
||||
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
}
|
||||
$now_date = date("Y-m-d H:i:s");
|
||||
if(count($arr_public_weather) > 0) {
|
||||
|
||||
$this->load->model('admin/comm/m_t_weather');
|
||||
$this->m_t_weather->t_weather_tuncate();
|
||||
|
||||
foreach ($arr_public_weather as $val) {
|
||||
$req_data = array();
|
||||
$req_data['location'] = $val['location'];
|
||||
$req_data['weather_img'] = $val['weather_img'];
|
||||
$req_data['weather_status'] = $val['weather_status'];
|
||||
$req_data['temperatures'] = $val['temperatures'];
|
||||
$req_data['reg_id'] = 'system';
|
||||
$req_data['reg_date'] = $now_date;
|
||||
|
||||
|
||||
$this->m_t_weather->t_weather_insert($req_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] t_weather_proc end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron03/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
146
application/controllers/admin/delete.later/cron_cd.php
Executable file
146
application/controllers/admin/delete.later/cron_cd.php
Executable file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
ini_set('display_errors',0);
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
//header("Content-Type: text/html; charset=UTF-8");
|
||||
|
||||
#include_once(APPPATH.'core/web/cm_exceptions.php');
|
||||
class cron_cd extends CI_Controller{
|
||||
|
||||
var $tb_name = 'news_from_christiandaily'; // db table name
|
||||
var $news_tb_name = 'news';
|
||||
var $limit = 10; // max # of crawled article to migrate data into news table.
|
||||
|
||||
|
||||
function get_file_name($fname) {
|
||||
if(trim($fname)!='') {
|
||||
$tmp = explode('/',$fname);
|
||||
$fname = trim(array_pop($tmp));
|
||||
return $fname;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cd article crawler from rss link
|
||||
*/
|
||||
function index() {
|
||||
|
||||
$rss_link = 'http://kr.christianitydaily.com/rss/articles/topnews/all.rss';
|
||||
$rss = file_get_contents($rss_link);
|
||||
|
||||
if($rss==false) {
|
||||
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$this->load->database();
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->loadXML($rss);
|
||||
|
||||
$i = 0;
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
$ret = [];
|
||||
|
||||
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
|
||||
foreach($row->childNodes as $nodename) {
|
||||
$retdate = date("Y-m-d H:i:s");
|
||||
if($nodename->nodeName=='title') {
|
||||
$ret[$i]['title'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='description') {
|
||||
$ret[$i]['description'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='link') {
|
||||
$ret[$i]['link'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='media:content') {
|
||||
$ret[$i]['image'] = $nodename->getAttribute('url');
|
||||
} else if($nodename->nodeName=='pubDate') {
|
||||
$ret[$i]['pubdate'] = $nodename->nodeValue;
|
||||
$regdate = strtotime($ret[$i]['pubdate']);
|
||||
if($regdate>0) {
|
||||
$regdate = date("Y-m-d H:i:s",$regdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//upload main image
|
||||
$dest_file_name = '';
|
||||
if($ret[$i]['image']!='') {
|
||||
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
|
||||
$dest_file_name = $upload_path.'/'.$fname;
|
||||
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
|
||||
echo "\nfile not restored\n";
|
||||
$dest_file_name = '';
|
||||
}
|
||||
}
|
||||
|
||||
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
|
||||
|
||||
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
|
||||
"title, content, main_img, ".
|
||||
"origin_url, regdate) VALUES (".
|
||||
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
|
||||
"'".$ret[$i]['link']."', '$regdate')";
|
||||
$return = $this->db->query($sql);
|
||||
if($return==true) {
|
||||
$cnt++;
|
||||
} else {
|
||||
$fail_cnt++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
}
|
||||
|
||||
function migrate_cd_article_to_news() {
|
||||
$this->load->database();
|
||||
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
|
||||
|
||||
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
|
||||
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
|
||||
"ORDER BY idx ASC LIMIT ".$this->limit;
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
foreach($query->result_array() as $row) {
|
||||
if($row['main_img']!='') {
|
||||
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".$this->news_tb_name." (".
|
||||
"category_code, news_type, title, ".
|
||||
"sub_title, main_img, press_idx, ".
|
||||
"press_name, content, org_url, ".
|
||||
"is_del, is_display) VALUES (".
|
||||
"'12', 1, '".addslashes($row['title'])."', ".
|
||||
"'".addslashes($row['title'])."', '".addslashes($row['main_img'])."', 30, ".
|
||||
"'기독일보', '".addslashes($row['content'])."', '".$row['origin_url']."', ".
|
||||
"'N', 'N')";
|
||||
|
||||
echo $sql."\n";
|
||||
$ret = $this->db->query($sql);
|
||||
if($ret==true) {
|
||||
$idx = $row['idx'];
|
||||
$sql = "UPDATE ".$this->tb_name." SET ".
|
||||
"registered_tf=1 WHERE idx='$idx'";
|
||||
$this->db->query($sql);
|
||||
$cnt++;
|
||||
}else{
|
||||
$fail_cnt++;
|
||||
//echo $sql."\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
148
application/controllers/admin/delete.later/cron_cd_kr.php
Executable file
148
application/controllers/admin/delete.later/cron_cd_kr.php
Executable file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
ini_set('display_errors',0);
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
//header("Content-Type: text/html; charset=UTF-8");
|
||||
|
||||
#include_once(APPPATH.'core/web/cm_exceptions.php');
|
||||
class cron_cd_kr extends CI_Controller{
|
||||
|
||||
var $tb_name = 'news_from_christiandaily_kr'; // db table name
|
||||
var $news_tb_name = 'news';
|
||||
var $limit = 10; // max # of crawled article to migrate data into news table.
|
||||
|
||||
|
||||
function get_file_name($fname) {
|
||||
if(trim($fname)!='') {
|
||||
$tmp = explode('/',$fname);
|
||||
$fname = trim(array_pop($tmp));
|
||||
return $fname;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cd article crawler from rss link
|
||||
*/
|
||||
function index() {
|
||||
|
||||
$rss_link = 'http://www.christiandaily.co.kr/rss/articles/topnews/all.rss';
|
||||
$rss = file_get_contents($rss_link);
|
||||
|
||||
if($rss==false) {
|
||||
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$this->load->database();
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->loadXML($rss);
|
||||
|
||||
$i = 0;
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
$ret = [];
|
||||
|
||||
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
|
||||
foreach($row->childNodes as $nodename) {
|
||||
$retdate = date("Y-m-d H:i:s");
|
||||
if($nodename->nodeName=='title') {
|
||||
$ret[$i]['title'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='description') {
|
||||
$ret[$i]['description'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='link') {
|
||||
$ret[$i]['link'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='media:content') {
|
||||
$ret[$i]['image'] = $nodename->getAttribute('url');
|
||||
} else if($nodename->nodeName=='pubDate') {
|
||||
$ret[$i]['pubdate'] = $nodename->nodeValue;
|
||||
$regdate = strtotime($ret[$i]['pubdate']);
|
||||
if($regdate>0) {
|
||||
$regdate = date("Y-m-d H:i:s",$regdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//upload main image
|
||||
$dest_file_name = '';
|
||||
if($ret[$i]['image']!='') {
|
||||
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
|
||||
$dest_file_name = $upload_path.'/'.$fname;
|
||||
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
|
||||
echo "\nfile not restored\n";
|
||||
$dest_file_name = '';
|
||||
}
|
||||
}
|
||||
|
||||
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
|
||||
|
||||
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
|
||||
"title, content, main_img, ".
|
||||
"origin_url, regdate) VALUES (".
|
||||
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
|
||||
"'".$ret[$i]['link']."', '$regdate')";
|
||||
$return = $this->db->query($sql);
|
||||
|
||||
if($return==true) {
|
||||
$cnt++;
|
||||
|
||||
} else {
|
||||
$fail_cnt++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
}
|
||||
|
||||
function migrate_cd_article_to_news() {
|
||||
$this->load->database();
|
||||
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
|
||||
|
||||
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
|
||||
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
|
||||
"ORDER BY idx ASC LIMIT ".$this->limit;
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
foreach($query->result_array() as $row) {
|
||||
if($row['main_img']!='') {
|
||||
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".$this->news_tb_name." (".
|
||||
"category_code, news_type, title, ".
|
||||
"sub_title, main_img, press_idx, ".
|
||||
"press_name, content, org_url, ".
|
||||
"is_del, is_display) VALUES (".
|
||||
"'12', 1, '".addslashes($row['title'])."', ".
|
||||
"'".addslashes($row['title'])."', '".addslashes($row['main_img'])."', 30, ".
|
||||
"'기독일보', '".addslashes($row['content'])."', '".$row['origin_url']."', ".
|
||||
"'N', 'N')";
|
||||
|
||||
echo $sql."\n";
|
||||
$ret = $this->db->query($sql);
|
||||
if($ret==true) {
|
||||
$idx = $row['idx'];
|
||||
$sql = "UPDATE ".$this->tb_name." SET ".
|
||||
"registered_tf=1 WHERE idx='$idx'";
|
||||
$this->db->query($sql);
|
||||
$cnt++;
|
||||
}else{
|
||||
$fail_cnt++;
|
||||
//echo $sql."\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
138
application/controllers/admin/delete.later/cron_ct.php
Executable file
138
application/controllers/admin/delete.later/cron_ct.php
Executable file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
ini_set('display_errors',0);
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
//header("Content-Type: text/html; charset=UTF-8");
|
||||
|
||||
#include_once(APPPATH.'core/web/cm_exceptions.php');
|
||||
class cron_ct extends CI_Controller{
|
||||
|
||||
var $tb_name = 'news_from_christiantoday'; // db table name
|
||||
var $news_tb_name = 'news';
|
||||
var $limit = 10; // max # of crawled article to migrate data into news table.
|
||||
|
||||
|
||||
function get_file_name($fname) {
|
||||
if(trim($fname)!='') {
|
||||
$tmp = explode('/',$fname);
|
||||
$fname = trim(array_pop($tmp));
|
||||
return $fname;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ct article crawler from rss link
|
||||
*/
|
||||
function index() {
|
||||
$rss_link = 'http://www.christiantoday.co.kr/rss/articles/topnews/all.rss';
|
||||
$rss = file_get_contents($rss_link);
|
||||
|
||||
if($rss==false) {
|
||||
echo date("Y-m-d H:i:s")." can not crawl rss feed.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->load->database();
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->loadXML($rss);
|
||||
$i = 0;
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
$ret = [];
|
||||
while(is_object($row = $dom->getElementsByTagName('item')->item($i))) {
|
||||
foreach($row->childNodes as $nodename) {
|
||||
$retdate = date("Y-m-d H:i:s");
|
||||
if($nodename->nodeName=='title') {
|
||||
$ret[$i]['title'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='description') {
|
||||
$ret[$i]['description'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='link') {
|
||||
$ret[$i]['link'] = $nodename->nodeValue;
|
||||
} else if($nodename->nodeName=='media:content') {
|
||||
$ret[$i]['image'] = $nodename->getAttribute('url');
|
||||
} else if($nodename->nodeName=='pubDate') {
|
||||
$ret[$i]['pubdate'] = $nodename->nodeValue;
|
||||
$regdate = strtotime($ret[$i]['pubdate']);
|
||||
if($regdate>0) {
|
||||
$regdate = date("Y-m-d H:i:s",$regdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// upload main image
|
||||
$dest_file_name = '';
|
||||
if($ret[$i]['image']!='') {
|
||||
$upload_path = '/home/crossmap/files/news/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$fname = date("Ymd-His-").$this->get_file_name($ret[$i]['image']);
|
||||
$dest_file_name = $upload_path.'/'.$fname;
|
||||
if(file_put_contents($dest_file_name, file_get_contents($ret[$i]['image']))==false) {
|
||||
echo "\nfile not restored\n";
|
||||
$dest_file_name = '';
|
||||
}
|
||||
}
|
||||
|
||||
$dest_file_name = ($dest_file_name!='') ? str_replace('/home/crossmap','',$dest_file_name) : '';
|
||||
|
||||
$sql = "INSERT IGNORE INTO ".$this->tb_name." (".
|
||||
"title, content, main_img, ".
|
||||
"origin_url, regdate) VALUES (".
|
||||
"'".addslashes($ret[$i]['title'])."', '".addslashes($ret[$i]['description'])."', '".$dest_file_name."', ".
|
||||
"'".$ret[$i]['link']."', '$regdate')";
|
||||
$return = $this->db->query($sql);
|
||||
if($return==true) {
|
||||
$cnt++;
|
||||
} else {
|
||||
$fail_cnt++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / success : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
}
|
||||
|
||||
function migrate_ct_article_to_news() {
|
||||
$this->load->database();
|
||||
$ten_days_before = date("Y-m-d",(time()-(60*60*24*10))).' 00:00:00';
|
||||
|
||||
$sql = "SELECT idx, title, content, main_img, origin_url, regdate FROM ".$this->tb_name." ".
|
||||
"WHERE registered_tf=0 AND crawldate>='$ten_days_before' ".
|
||||
"ORDER BY idx ASC LIMIT ".$this->limit;
|
||||
$query = $this->db->query($sql);
|
||||
$cnt = 0;
|
||||
$fail_cnt = 0;
|
||||
foreach($query->result_array() as $row) {
|
||||
if($row['main_img']!='') {
|
||||
$row['content'] = nl2br(addslashes('<p style="line-height: 1.8;"><span style="font-family: 나눔고딕코딩, NanumGothicCoding, sans-serif; font-size: 9pt;"><img src="'.$row['main_img'].'" /></span></p><br style="clear:both;">'.$row['content']));
|
||||
}
|
||||
$sql = "INSERT INTO ".$this->news_tb_name." (".
|
||||
"category_code, news_type, title, ".
|
||||
"sub_title, main_img, press_idx, ".
|
||||
"press_name, content, org_url, ".
|
||||
"is_del, is_display) VALUES (".
|
||||
"'12', 1, '".$row['title']."', ".
|
||||
"'".$row['title']."', '".$row['main_img']."', 29, ".
|
||||
"'크리스천투데이', '".$row['content']."', '".$row['origin_url']."', ".
|
||||
"'N', 'N')";
|
||||
//echo $sql."\n";
|
||||
$ret = $this->db->query($sql);
|
||||
if($ret==true) {
|
||||
$idx = $row['idx'];
|
||||
$sql = "UPDATE ".$this->tb_name." SET ".
|
||||
"registered_tf=1 WHERE idx='$idx'";
|
||||
$this->db->query($sql);
|
||||
$cnt++;
|
||||
}
|
||||
else {
|
||||
$fail_cnt++;
|
||||
//echo $sql."\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
echo date("Y-m-d H:i:s").' / succeess : '.$cnt.' / fail cnt : '.$fail_cnt."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
110
application/controllers/admin/delete.later/cron_ep.php
Executable file
110
application/controllers/admin/delete.later/cron_ep.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class cron_ep_view_ranking extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
|
||||
# CREATE : 2019-03-26
|
||||
# 실행주기 : 1시간
|
||||
#---------------------------------------------------------------------------
|
||||
function maptoon_view_rank_update() {
|
||||
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
|
||||
|
||||
# model -create rank array
|
||||
$this->load->database();
|
||||
$num=0;
|
||||
$_time=1;
|
||||
$result;
|
||||
while($num==0){
|
||||
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
|
||||
$num=$result->num_rows();
|
||||
$_time++;
|
||||
}
|
||||
|
||||
$row=$result->result_array();
|
||||
|
||||
$rank_list=array();
|
||||
$y=0;
|
||||
$ep_idx=0;
|
||||
foreach($row as $val){
|
||||
if($ep_idx!=$val['ep_idx']){
|
||||
$ep_idx=$val['ep_idx'];
|
||||
$y=0;
|
||||
}
|
||||
array_push($rank_list,$ep_idx);
|
||||
}
|
||||
$rank_list=array_count_values($rank_list);
|
||||
arsort($rank_list); //ep_idx view count sort
|
||||
|
||||
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
|
||||
|
||||
$insert_date=array();
|
||||
$rank=1;//순위
|
||||
foreach($ep_idx_rank_list as $val){
|
||||
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
|
||||
$rank++;
|
||||
}
|
||||
|
||||
if(count($ep_idx_rank_list)<10){
|
||||
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
|
||||
$row = $result->result_array();
|
||||
foreach($row as $val){
|
||||
$is_same=false;
|
||||
foreach($ep_idx_rank_list as $val2){
|
||||
if($val['idx']==$val2){
|
||||
$is_same=true;
|
||||
}
|
||||
}
|
||||
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
|
||||
if(count($insert_date)==10){break;}
|
||||
}
|
||||
};
|
||||
|
||||
print_r($row);
|
||||
|
||||
# insert_data;
|
||||
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
|
||||
|
||||
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 예약 조회 후 업데이트
|
||||
# CREATE : 2019-04-09
|
||||
# 실행주기 : 매분
|
||||
#---------------------------------------------------------------------------
|
||||
function epsiode_reservation(){
|
||||
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$result = $this->m_maptoon->get_epsiodes_reservation_list();
|
||||
if(count($result)>0){
|
||||
$num =$this->m_maptoon->episodes_is_display_update_batch($result);
|
||||
}
|
||||
|
||||
$num>0?$contents.= $content_type.$num.'개 업데이트-----------------------------------------------------------------------------'.chr(10):$contents.= $content_type.'-----------------------------------------------------------------------------'.chr(10);
|
||||
|
||||
ob_flush();
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_maptoon/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
89
application/controllers/admin/delete.later/cron_ep_view_ranking.php
Executable file
89
application/controllers/admin/delete.later/cron_ep_view_ranking.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
* 맵툰 스케줄 1시간 마다 실행 됨
|
||||
*/
|
||||
class cron_ep_view_ranking extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
|
||||
# CREATE : 2019-03-26
|
||||
#---------------------------------------------------------------------------
|
||||
// function maptoon_view_rank_update() {
|
||||
function index() {
|
||||
|
||||
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
|
||||
|
||||
# model -create rank array
|
||||
$this->load->database();
|
||||
$num=0;
|
||||
$_time=1;
|
||||
$result;
|
||||
while($num==0){
|
||||
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
|
||||
$num=$result->num_rows();
|
||||
$_time++;
|
||||
}
|
||||
|
||||
$row=$result->result_array();
|
||||
|
||||
$rank_list=array();
|
||||
$y=0;
|
||||
$ep_idx=0;
|
||||
foreach($row as $val){
|
||||
if($ep_idx!=$val['ep_idx']){
|
||||
$ep_idx=$val['ep_idx'];
|
||||
$y=0;
|
||||
}
|
||||
array_push($rank_list,$ep_idx);
|
||||
}
|
||||
$rank_list=array_count_values($rank_list);
|
||||
arsort($rank_list); //ep_idx view count sort
|
||||
|
||||
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
|
||||
|
||||
$insert_date=array();
|
||||
$rank=1;//순위
|
||||
foreach($ep_idx_rank_list as $val){
|
||||
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
|
||||
$rank++;
|
||||
}
|
||||
|
||||
if(count($ep_idx_rank_list)<10){
|
||||
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
|
||||
$row = $result->result_array();
|
||||
foreach($row as $val){
|
||||
$is_same=false;
|
||||
foreach($ep_idx_rank_list as $val2){
|
||||
if($val['idx']==$val2){
|
||||
$is_same=true;
|
||||
}
|
||||
}
|
||||
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
|
||||
if(count($insert_date)==10){break;}
|
||||
}
|
||||
};
|
||||
|
||||
print_r($row);
|
||||
|
||||
# insert_data;
|
||||
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
|
||||
|
||||
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
function epsiode_reservation(){
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$result = $this->m_maptoon->get_epsiode_reservation_list();
|
||||
print_r($result);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
157
application/controllers/admin/delete.later/cron_maptoon.php
Executable file
157
application/controllers/admin/delete.later/cron_maptoon.php
Executable file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class cron_maptoon extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 실시간 맵툰 에피소드 조회 순위 등록
|
||||
# CREATE : 2019-03-26
|
||||
# 실행주기 : 1시간
|
||||
#---------------------------------------------------------------------------
|
||||
function maptoon_view_rank_update() {
|
||||
if (!is_dir('./logs/cron_mt_ep_ranking/'.date("Ym"))) mkdir('./logs/cron_mt_ep_ranking/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] mt_ep_ranking_work start'.chr(10);
|
||||
|
||||
# model -create rank array
|
||||
$this->load->database();
|
||||
$num=0;
|
||||
$_time=1;
|
||||
$result;
|
||||
while($num==0){
|
||||
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
|
||||
$num=$result->num_rows();
|
||||
$_time++;
|
||||
}
|
||||
|
||||
$row=$result->result_array();
|
||||
|
||||
$rank_list=array();
|
||||
$y=0;
|
||||
$ep_idx=0;
|
||||
foreach($row as $val){
|
||||
if($ep_idx!=$val['ep_idx']){
|
||||
$ep_idx=$val['ep_idx'];
|
||||
$y=0;
|
||||
}
|
||||
array_push($rank_list,$ep_idx);
|
||||
}
|
||||
$rank_list=array_count_values($rank_list);
|
||||
arsort($rank_list); //ep_idx view count sort
|
||||
|
||||
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
|
||||
|
||||
$insert_date=array();
|
||||
$rank=1;//순위
|
||||
foreach($ep_idx_rank_list as $val){
|
||||
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
|
||||
$rank++;
|
||||
}
|
||||
|
||||
if(count($ep_idx_rank_list)<10){
|
||||
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
|
||||
$row = $result->result_array();
|
||||
foreach($row as $val){
|
||||
$is_same=false;
|
||||
foreach($ep_idx_rank_list as $val2){
|
||||
if($val['idx']==$val2){
|
||||
$is_same=true;
|
||||
}
|
||||
}
|
||||
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
|
||||
if(count($insert_date)==10){break;}
|
||||
}
|
||||
};
|
||||
|
||||
print_r($row);
|
||||
|
||||
# insert_data;
|
||||
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
|
||||
|
||||
$contents.= date("Y-m-d H:i:s",strtotime ("-$_time hours")).' 업데이트 완료'.chr(10);
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] episode veiw count ranking end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_mt_ep_ranking/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 예약 조회 후 업데이트
|
||||
# CREATE : 2019-04-09
|
||||
# 실행주기 : 매분
|
||||
#---------------------------------------------------------------------------
|
||||
function episode_reservation_update(){
|
||||
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
# file helper
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] reservation_article_display_update start'.chr(10);
|
||||
$num=0;
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$result = $this->m_maptoon->get_epsiodes_reservation_list();
|
||||
if(count($result)>0){
|
||||
$num =$this->m_maptoon->episodes_is_display_update_batch($result);
|
||||
}
|
||||
|
||||
$num>0?$contents.= $num.'개 업데이트-----------------------------------------------------------------------------'.chr(10):$contents.= '-----------------------------------------------------------------------------'.chr(10);
|
||||
|
||||
ob_flush();
|
||||
flush();
|
||||
sleep(1);
|
||||
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] reservation_article_display_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_maptoon/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
|
||||
}
|
||||
|
||||
public function episode_in_category_update_caching() {
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
if (!is_dir('./logs/cron_maptoon/'.date("Ym"))) mkdir('./logs/cron_maptoon/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
$contents = 'log description';
|
||||
$this->load->helper('file');
|
||||
$contents = '['.date("Y-m-d H:i:s").'] episode_in_category_update_caching start'.chr(10);
|
||||
|
||||
$this->load->database();
|
||||
|
||||
$query = "SELECT idx,mt_episodes_idx FROM mt_categories";
|
||||
$result = $this->db->query($query);
|
||||
foreach ($result->result_array() as $row){
|
||||
$episodes_idx = explode(",",$row['mt_episodes_idx']);
|
||||
$str = $row['mt_episodes_idx'];
|
||||
$idx = $row['idx'];
|
||||
|
||||
$len = count($episodes_idx);
|
||||
|
||||
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
|
||||
&& $idx>0 && $len>0) {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
|
||||
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('maptoon_lib',$params);
|
||||
|
||||
// get episode data to write cache
|
||||
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
|
||||
|
||||
if($json_data!=FALSE) {
|
||||
if($this->maptoon_lib->write_category_cache($idx,$json_data)) {
|
||||
$contents.=$idx.'번 카테고리내 에피소드 등록이 완료되었습니다.'.chr(10);
|
||||
}else {
|
||||
$contents.=$idx.'번 카테고리내 에피소드 등록이 실패습니다.'.chr(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] episode_in_category_update_caching end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron_maptoon/'.date("Ym").'/caching'.date("Ymd").'.php', $contents, 'a+');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
89
application/controllers/admin/delete.later/cron_test.php
Executable file
89
application/controllers/admin/delete.later/cron_test.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
* 컨텐츠관련 스케쥴
|
||||
*/
|
||||
class cron_test extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 실시간 조회 순위 등록
|
||||
# CREATE : 2019-03-26
|
||||
#---------------------------------------------------------------------------
|
||||
// function maptoon_view_rank_update() {
|
||||
function index() {
|
||||
|
||||
// if (!is_dir('./logs/cron01/'.date("Ym"))) mkdir('./logs/cron01/'.date("Ym"), 0777, TRUE); //log file 생성
|
||||
// $contents = log description
|
||||
# file helper
|
||||
// $this->load->helper('file');
|
||||
// $contents = '['.date("Y-m-d H:i:s").'] press_article_count_update start'.chr(10);
|
||||
|
||||
|
||||
# model -create rank array
|
||||
$this->load->database();
|
||||
$num=0;
|
||||
$_time=1;
|
||||
$result;
|
||||
while($num==0){
|
||||
$result=$this->db->query("SELECT * FROM mt_ep_hit_log WHERE reg_date>=\"".date("Y-m-d H:i:s",strtotime ("-$_time hours"))."\" Order by ep_idx");
|
||||
$num=$result->num_rows();
|
||||
$_time++;
|
||||
}
|
||||
|
||||
$row=$result->result_array();
|
||||
|
||||
$rank_list=array();
|
||||
$y=0;
|
||||
$ep_idx=0;
|
||||
foreach($row as $val){
|
||||
if($ep_idx!=$val['ep_idx']){
|
||||
$ep_idx=$val['ep_idx'];
|
||||
$y=0;
|
||||
}
|
||||
array_push($rank_list,$ep_idx);
|
||||
}
|
||||
$rank_list=array_count_values($rank_list);
|
||||
arsort($rank_list); //ep_idx view count sort
|
||||
|
||||
$ep_idx_rank_list=array_keys($rank_list); // only ep_idx array;
|
||||
|
||||
$insert_date=array();
|
||||
$rank=1;//순위
|
||||
foreach($ep_idx_rank_list as $val){
|
||||
array_push($insert_date,array('ep_idx'=>$val,'rank'=>$rank));
|
||||
$rank++;
|
||||
}
|
||||
|
||||
if(count($ep_idx_rank_list)<10){
|
||||
$result=$this->db->query("SELECT * FROM mt_episodes ORDER BY reg_date DESC limit 10");
|
||||
$row = $result->result_array();
|
||||
foreach($row as $val){
|
||||
$is_same=false;
|
||||
foreach($ep_idx_rank_list as $val2){
|
||||
if($val['idx']==$val2){
|
||||
$is_same=true;
|
||||
}
|
||||
}
|
||||
if(!$is_same){ array_push($insert_date,array('ep_idx'=>$val['idx'],'rank'=>$rank)); $rank++;}
|
||||
if(count($insert_date)==10){break;}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
# insert_data;
|
||||
$this->db->insert_batch("mt_ep_view_rank",$insert_date);
|
||||
|
||||
|
||||
/*
|
||||
# model - press update
|
||||
$this->load->model('admin/etc_section/m_press');
|
||||
$result2 = $this->m_press->press_article_count_update($result1);
|
||||
|
||||
$contents.= $result2.'개 업데이트 완료'.chr(10);
|
||||
$contents.= '['.date("Y-m-d H:i:s").'] press_article_count_update end'.chr(10);
|
||||
$contents.= '-------------------------------------------------------------------------------------'.chr(10);
|
||||
write_file('./logs/cron01/'.date("Ym").'/'.date("Ymd").'.php', $contents, 'a+');
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
427
application/controllers/admin/delete.later/maptoon_back190314.php
Executable file
427
application/controllers/admin/delete.later/maptoon_back190314.php
Executable file
@@ -0,0 +1,427 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class maptoon extends cm_controller {
|
||||
|
||||
var $tb_name_category = 'mt_categories';
|
||||
var $tb_name_episode = 'mt_episodes';
|
||||
var $tb_name_maptoon_list = 'mt_list';
|
||||
var $tb_name_notice = 'mt_notices';
|
||||
var $tb_name_cartoonist = 'mt_cartoonists';
|
||||
var $total_count = 20; // total # of list
|
||||
var $list_limit = 10; // total # of pages
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('util');
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all the maptoon categories
|
||||
*/
|
||||
public function fn_category() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_category,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register category
|
||||
*/
|
||||
public function fn_category_proc() {
|
||||
$c_name = $this->input->post('c_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$c_name = trim($c_name);
|
||||
|
||||
if($c_name!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['c_name'=>$c_name];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_category, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['c_name' => $c_name];
|
||||
$ret = $this->db->insert($this->tb_name_category,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_category_detail($idx) {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
|
||||
$return_data = ['c_name' => ''];
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$data_category = $this->m_maptoon->get_category($idx);
|
||||
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
|
||||
$return_data['c_name'] = $data_category['c_name'];
|
||||
}
|
||||
// get episodes in chosen category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
|
||||
if($data_episodes!=FALSE) {
|
||||
$return_data['data'] = $data_episodes;
|
||||
} else {
|
||||
$return_data['data'] = '';
|
||||
}
|
||||
|
||||
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
|
||||
} else {
|
||||
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
title: get list of maptoon episodes
|
||||
*/
|
||||
public function fn_get_episodes($str) {
|
||||
$str = trim($str);
|
||||
if($str!='') {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete category
|
||||
*/
|
||||
public function fn_category_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_category);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_categories_idx',$idx);
|
||||
$data = ['mt_categories_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : list all maptoons
|
||||
*/
|
||||
public function fn_maptoon_list() {
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
|
||||
$data = $this->m_maptoon->get_maptoon_list($query_string);
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
|
||||
$return_data['list'] = $result = array();
|
||||
return $this->load->view('/admin/maptoon/list', $return_data, true);
|
||||
}
|
||||
|
||||
public function fn_maptoon_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->model('/admin/maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
|
||||
} else {
|
||||
$return_data['data'] = [];
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon
|
||||
*/
|
||||
public function fn_maptoon_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
$mode = $this->input->post('mode');
|
||||
$mt_cartoonists_idx = $this->input->post('mt_cartoonists_idx'); //
|
||||
$name = $this->input->post('name'); //
|
||||
$status = $this->input->post('status');
|
||||
$date_sun = $this->input->post('date_sun');
|
||||
$date_mon = $this->input->post('date_mon');
|
||||
$date_tue = $this->input->post('date_tue');
|
||||
$date_wed = $this->input->post('date_wed');
|
||||
$date_thu = $this->input->post('date_thu');
|
||||
$date_fri = $this->input->post('date_fri');
|
||||
$date_sat = $this->input->post('date_sat');
|
||||
$description = $this->input->post('mode');
|
||||
|
||||
if($name=='') {
|
||||
$this->util->js_alert_back('맵툰명을 입력해주십시오'); exit;
|
||||
}
|
||||
if($mt_cartoonists_idx=='') {
|
||||
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
|
||||
}
|
||||
|
||||
//이미지 업로드
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$img_data = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
} else {
|
||||
$img_data = '';
|
||||
}
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) { // update data
|
||||
echo 'asdf'; exit;
|
||||
} else { // insert data
|
||||
$data = ['main_img' => $img_data,
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
'date_sun' => $date_sun,
|
||||
'date_mon' => $date_mon,
|
||||
'date_tue' => $date_tue,
|
||||
'date_wed' => $date_wed,
|
||||
'date_thu' => $date_thu,
|
||||
'date_fri' => $date_fri,
|
||||
'date_sat' => $date_sat,
|
||||
'description' => $description,
|
||||
'reg_date' => date("Y-m-d H:i:s"),
|
||||
'mt_cartoonists_idx' => $mt_cartoonists_idx];
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$ret = $this->m_maptoon->insert_maptoon($data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/list');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : delete maptoon
|
||||
*/
|
||||
public function fn_maptoon_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon episodes
|
||||
*/
|
||||
public function fn_episode() {
|
||||
$return_data['list'] = $result = array();
|
||||
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon episode
|
||||
*/
|
||||
public function fn_episode_upd_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete maptoon episode
|
||||
*/
|
||||
public function fn_episode_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon announcement
|
||||
@param: numeric; idx of announcement table
|
||||
*/
|
||||
public function fn_announcement() {
|
||||
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) { // show one of announcement by idx; called by ajax
|
||||
|
||||
} else { // show list of announcement
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register announcement
|
||||
*/
|
||||
public function fn_announcement_reg_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon announcement
|
||||
*/
|
||||
public function fn_announcement_upd_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete maptoon announcement
|
||||
*/
|
||||
public function fn_announcement_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all cartoonists
|
||||
*/
|
||||
public function fn_cartoonist() {
|
||||
$idx = $this->input->get('idx');
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_cartoonist,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_cartoonist);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register & modify cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_proc() {
|
||||
$name = $this->input->post('name');
|
||||
$website = $this->input->post('website');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$name = trim($name);
|
||||
$website = trim($website);
|
||||
|
||||
if($name!='' && $website!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_cartoonist, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_cartoonist);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_cartoonists_idx',$idx);
|
||||
$data = ['mt_cartoonists_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
825
application/controllers/admin/delete.later/maptoon_bak190402.php
Executable file
825
application/controllers/admin/delete.later/maptoon_bak190402.php
Executable file
@@ -0,0 +1,825 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class maptoon extends cm_controller {
|
||||
|
||||
var $tb_name_category = 'mt_categories';
|
||||
var $tb_name_episode = 'mt_episodes';
|
||||
var $tb_name_maptoon_list = 'mt_list';
|
||||
var $tb_name_notice = 'mt_notices';
|
||||
var $tb_name_cartoonist = 'mt_cartoonists';
|
||||
var $total_count = 20; // total # of list
|
||||
var $list_limit = 10; // total # of pages
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('util');
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all the maptoon categories
|
||||
*/
|
||||
public function fn_category() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_category,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register category
|
||||
*/
|
||||
public function fn_category_proc() {
|
||||
$c_name = $this->input->post('c_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$c_name = trim($c_name);
|
||||
|
||||
if($c_name=='') {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오'); exit;
|
||||
}
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['c_name'=>$c_name];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_category, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['c_name' => $c_name];
|
||||
$ret = $this->db->insert($this->tb_name_category,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_register_episode_in_category() {
|
||||
$episodes_idx = $this->input->post('episodes_idx');
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
$len = count($episodes_idx);
|
||||
|
||||
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
|
||||
&& $idx>0 && $len>0) {
|
||||
$str = implode(',',$episodes_idx);
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
|
||||
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('maptoon_lib',$params);
|
||||
|
||||
// get episode data to write cache
|
||||
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
|
||||
|
||||
if($json_data!=FALSE) {
|
||||
$this->maptoon_lib->write_category_cache($idx,$json_data);
|
||||
}
|
||||
}
|
||||
$this->util->js_alert_go('카테고리내 에피소드 등록이 완료되었습니다.','/admin/maptoon/category/10');
|
||||
}
|
||||
|
||||
public function fn_category_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
$search_keyword = $this->input->get('search_keyword');
|
||||
|
||||
if(is_numeric($idx)==FALSE || $idx<=0) {
|
||||
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
|
||||
}
|
||||
|
||||
// get maptoon list in chosen category
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
|
||||
$return_data = ['c_name' => ''];
|
||||
$data_category = $this->m_maptoon->get_category($idx);
|
||||
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
|
||||
$return_data['c_name'] = $data_category['c_name'];
|
||||
}
|
||||
|
||||
if($data_category['mt_episodes_idx']=='') {// get episodes from episode category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
|
||||
} else { // get episodes in chosen category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($data_category['mt_episodes_idx']);
|
||||
}
|
||||
if($data_episodes!=FALSE) {
|
||||
$return_data['list'] = $data_episodes;
|
||||
} else {
|
||||
$return_data['list'] = '';
|
||||
}
|
||||
$return_data['idx'] = $idx;
|
||||
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete category
|
||||
*/
|
||||
public function fn_category_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_category);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_categories_idx',$idx);
|
||||
$data = ['mt_categories_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
get list of maptoon episodes
|
||||
@return json string
|
||||
*/
|
||||
public function fn_get_episodes_by_search_keyword() {
|
||||
$keyword = $this->input->get('keyword');
|
||||
if($keyword!='') {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$row = $this->m_maptoon->get_episodes_by_search_keyword($keyword);
|
||||
// $row = array(['idx'=>2, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>htmlspecialchars('김"집사')],
|
||||
// ['idx'=>3, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>'김집사']);
|
||||
echo json_encode($row);exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all maptoons
|
||||
*/
|
||||
public function fn_maptoon_list() {
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
|
||||
$query_string = [];
|
||||
$data = $this->m_maptoon->get_maptoon_list($query_string);
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
for($i=0; $i<count($data); $i++) {
|
||||
$data[$i]['num_of_episodes'] = $this->m_maptoon->get_num_of_episodes($data[$i]['idx']);
|
||||
}
|
||||
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
return $this->load->view('/admin/maptoon/list', $return_data, true);
|
||||
}
|
||||
|
||||
public function fn_maptoon_list_del() {
|
||||
$idx = $this->input->post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
//1.check num of episode in maptoon
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$num = $this->m_maptoon->get_num_of_episodes($idx);
|
||||
|
||||
$num_of_announcement = $this->m_maptoon->get_num_of_announcement_by_maptoon($idx);
|
||||
if($num>0) {
|
||||
$ret = ['result'=>"이미 등록되어 있는 에피소드가 있어서 삭제가 불가능합니다.\n해당 에피소드 삭제후 웹툰 삭제가 가능합니다."];
|
||||
echo json_encode($ret); exit;
|
||||
}
|
||||
if($num_of_announcement>0) {
|
||||
$ret = ['result'=>"이미 웹툰에 등록되어 있는 공지사항이 있어서 삭제가 불가능합니다.\n해당 공지사항 삭제후 웹툰 삭제가 가능합니다."];
|
||||
echo json_encode($ret); exit;
|
||||
}
|
||||
|
||||
$result = $this->m_maptoon->delete_maptoon($idx);
|
||||
$ret = ['result'=>$result];
|
||||
if($result==TRUE) {
|
||||
$ret = ['result'=>'success'];
|
||||
} else {
|
||||
$ret = ['result'=>'DB error, 개발자에게 문의 바랍니다.'];
|
||||
}
|
||||
} else {
|
||||
$ret = ['result'=>'wrong parameter'];
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_maptoon_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$num_of_episodes = $this->m_maptoon->get_num_of_episodes($idx);
|
||||
$return_data['num_of_episodes'] = $num_of_episodes;
|
||||
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
|
||||
if(isset($row[0])==TRUE) {
|
||||
$return_data['data'] = $row[0];
|
||||
}
|
||||
$return_data['maptoon_idx'] = $idx;
|
||||
} else {
|
||||
$return_data['data'] = [];
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon
|
||||
*/
|
||||
public function fn_maptoon_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
$mode = $this->input->post('mode');
|
||||
$mt_cartoonists_idx = $this->input->post('mt_cartoonists_idx'); //
|
||||
$name = $this->input->post('name'); //
|
||||
$status = $this->input->post('status');
|
||||
$date_sun = ($this->input->post('date_sun')=='') ? 0 : $this->input->post('date_sun');
|
||||
$date_mon = ($this->input->post('date_mon')=='') ? 0 : $this->input->post('date_mon');
|
||||
$date_tue = ($this->input->post('date_tue')=='') ? 0 : $this->input->post('date_tue');
|
||||
$date_wed = ($this->input->post('date_wed')=='') ? 0 : $this->input->post('date_wed');
|
||||
$date_thu = ($this->input->post('date_thu')=='') ? 0 : $this->input->post('date_thu');
|
||||
$date_fri = ($this->input->post('date_fri')=='') ? 0 : $this->input->post('date_fri');
|
||||
$date_sat = ($this->input->post('date_sat')=='') ? 0 : $this->input->post('date_sat');
|
||||
$description = $this->input->post('description');
|
||||
|
||||
if($name=='') {
|
||||
$this->util->js_alert_back('맵툰명을 입력해주십시오'); exit;
|
||||
}
|
||||
if($mt_cartoonists_idx=='') {
|
||||
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
|
||||
}
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$maptoon_info = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
|
||||
|
||||
//이미지 업로드
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$img_data = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
|
||||
//remove previous image
|
||||
if(isset($maptoon_info[0])==TRUE && $img_data!='') {
|
||||
$main_img = $maptoon_info[0]['main_img'];
|
||||
if($main_img!='') {
|
||||
unlink($_SERVER['DOCUMENT_ROOT'].$main_img);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$img_data = (isset($maptoon_info[0]['main_img'])==TRUE) ? $maptoon_info[0]['main_img'] : '';
|
||||
}
|
||||
|
||||
$data = ['main_img' => $img_data,
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
'date_sun' => $date_sun,
|
||||
'date_mon' => $date_mon,
|
||||
'date_tue' => $date_tue,
|
||||
'date_wed' => $date_wed,
|
||||
'date_thu' => $date_thu,
|
||||
'date_fri' => $date_fri,
|
||||
'date_sat' => $date_sat,
|
||||
'description' => $description,
|
||||
'reg_date' => date("Y-m-d H:i:s"),
|
||||
'mt_cartoonists_idx' => $mt_cartoonists_idx];
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) { // update data
|
||||
$ret = $this->m_maptoon->update_maptoon($idx, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/maptoon_list/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('수정되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
} else { // insert data
|
||||
$ret = $this->m_maptoon->insert_maptoon($data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : delete maptoon
|
||||
*/
|
||||
public function fn_maptoon_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon episodes
|
||||
*/
|
||||
public function fn_episode() {
|
||||
$return_data['list'] = $result = array();
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
|
||||
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
|
||||
$cartoonist_list=array();
|
||||
foreach($arr_cartoonist as $val){
|
||||
$cartoonist_list[$val['idx']]=$val['name'];
|
||||
}
|
||||
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array(); //카테고리 리스트
|
||||
$category_list=array();
|
||||
foreach($arr_category as $val){
|
||||
$category_list[$val['idx']]=$val['c_name'];
|
||||
}
|
||||
|
||||
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
|
||||
$query_string = $_SERVER['QUERY_STRING'];
|
||||
parse_str($query_string);
|
||||
|
||||
|
||||
if(isset($author)) $arr_cartoonist_idx = $this->m_maptoon->get_cartoonist_idx_by_name(urldecode($author));
|
||||
|
||||
# 검색
|
||||
$req_data = array();
|
||||
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
|
||||
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
|
||||
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
|
||||
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
|
||||
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
|
||||
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
|
||||
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
|
||||
isset($arr_cartoonist_idx)? $req_data['author']= $arr_cartoonist_idx :$req_data['author']=""; // 작가 번호
|
||||
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
//list 가져오기
|
||||
|
||||
$data = $this->m_maptoon->get_episode_list($req_data);
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
|
||||
$req_data['suffix'] = '?'.$query_string;
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['pagination' ] = $pagination;
|
||||
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
|
||||
$return_data['cartoonist_list'] = $cartoonist_list; // 작가 이름2
|
||||
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
|
||||
$return_data['category'] = $arr_category; // 카테고리 리스트
|
||||
$return_data['category_list'] = $category_list; // 카테고리 리스트2
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register form for maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg() {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
|
||||
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
|
||||
|
||||
|
||||
if(empty($this->input->post('idx')==FALSE)){
|
||||
$idx= $this->input->post('idx');
|
||||
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
|
||||
$return_data['modify_data'] = $row;
|
||||
}
|
||||
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array();
|
||||
|
||||
$return_data['category']=$arr_category;
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg_proc() {
|
||||
echo $this->input->get_post("idx");
|
||||
var_dump($_FILES);
|
||||
exit;
|
||||
$mode = $this->input->get_post("mode");// edit 이면 수정
|
||||
$idx = $this->input->get_post("idx"); // 수정시 사용
|
||||
$this->input->get_post("mt_categories_idx")!="n"?$mt_categories_idx = $this->input->get_post("mt_categories_idx"):$mt_categories_idx=null;
|
||||
$mt_list_idx = $this->input->get_post("mt_list_idx");
|
||||
$title = $this->input->get_post("title");
|
||||
$display_date = $this->input->get_post("display_date");
|
||||
$is_display = $this->input->get_post("is_display"); //0: NO 1:YES
|
||||
$ep_no = $this->input->get_post("ep_no");
|
||||
|
||||
//메인이미지 업로드
|
||||
$main_img = '';
|
||||
if(isset($_FILES['main_img']['name'])) {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("메인 이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
}
|
||||
|
||||
//맵툰이미지 업로드
|
||||
$data = array();
|
||||
$filesCount = count($_FILES['webtoon_images']['name']);
|
||||
$webtoon_images = '';
|
||||
if($filesCount>0 && $_FILES['webtoon_images']['name']!=''){
|
||||
for($i =0; $i<$filesCount;$i++){
|
||||
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
|
||||
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
|
||||
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
|
||||
//이미지 업로드
|
||||
if($_FILES['webtoon_images'.$i]['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= 'webtoon_images'.$i.date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다1.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mode!="edit"){
|
||||
$data=[
|
||||
'mt_categories_idx' => $mt_categories_idx,
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'title' => $title,
|
||||
'main_img' => $main_img,
|
||||
'display_date' => $display_date,
|
||||
'is_display' => $is_display,
|
||||
'ep_no' => $ep_no,
|
||||
'webtoon_images' => json_encode($webtoon_images),
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_episode,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}else if($mode=="edit"){
|
||||
$data=[
|
||||
'mt_categories_idx' => $mt_categories_idx,
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'title' => $title,
|
||||
'display_date' => $display_date,
|
||||
'ep_no' => $ep_no,
|
||||
'is_display' => $is_display,
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
|
||||
if($main_img!='')$data['main_img']= $main_img;
|
||||
if($webtoon_images!='') $data['webtoon_images'] = json_encode($webtoon_images);
|
||||
|
||||
$this->db->where('idx',$idx);
|
||||
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/episode/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon episode
|
||||
*/
|
||||
public function fn_episode_upd_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete maptoon episode
|
||||
*/
|
||||
public function fn_episode_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>=0) {
|
||||
$this->load->database();
|
||||
$this->db->query("SET FOREIGN_KEY_CHECKS=0;");
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_episode);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
// $this->util->js_alert_back($message);exit;
|
||||
echo "<script>alert('".$message."');</script>";
|
||||
Header("Location:/admin/maptoon/episode/10");
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon announcement
|
||||
@param: numeric; idx of announcement table
|
||||
*/
|
||||
public function fn_announcement() {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$mt_idx=0; //all data
|
||||
$return_data['list']=$this->m_maptoon->get_announcement_list($mt_idx);
|
||||
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
|
||||
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register announcement
|
||||
*/
|
||||
public function fn_announcement_reg_proc() {
|
||||
$mt_list_idx = $this->input->post('mt_title');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$contents = $this->input->post('contents');
|
||||
$s_date = $this->input->post('s_date');
|
||||
$e_date = $this->input->post('e_date');
|
||||
|
||||
if($mode=='modify') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = [
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date
|
||||
];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data=[ 'mt_list_idx' => $mt_list_idx,
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date,
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_notice,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon announcement NOT USE
|
||||
|
||||
public function fn_announcement_upd_proc() {
|
||||
$idx= $this->input->post('idx');
|
||||
$contents= $this->input->post('contentes');
|
||||
$idx= $this->input->post('s_date');
|
||||
$idx= $this->input->post('e_date');
|
||||
$mode= $this->input->post('mode');
|
||||
if($mode==""){
|
||||
exit;
|
||||
}else{
|
||||
$data = [
|
||||
'contentes' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
@desc : delete maptoon announcement
|
||||
*/
|
||||
public function fn_announcement_del_proc() {
|
||||
$idx = $this->input->get_post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->load->database();
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_notice);
|
||||
echo $ret;
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
/*
|
||||
@desc : list all cartoonists
|
||||
*/
|
||||
public function fn_cartoonist() {
|
||||
$idx = $this->input->get('idx');
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_cartoonist,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_cartoonist);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register & modify cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_proc() {
|
||||
$name = $this->input->post('name');
|
||||
$website = $this->input->post('website');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$name = trim($name);
|
||||
$website = trim($website);
|
||||
|
||||
if($name!='' && $website!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_cartoonist, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_cartoonist);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_cartoonists_idx',$idx);
|
||||
$data = ['mt_cartoonists_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
719
application/controllers/admin/delete.later/maptoon_test.php
Executable file
719
application/controllers/admin/delete.later/maptoon_test.php
Executable file
@@ -0,0 +1,719 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class maptoon_test extends cm_controller {
|
||||
|
||||
var $tb_name_category = 'mt_categories';
|
||||
var $tb_name_episode = 'mt_episodes';
|
||||
var $tb_name_maptoon_list = 'mt_list';
|
||||
var $tb_name_notice = 'mt_notices';
|
||||
var $tb_name_cartoonist = 'mt_cartoonists';
|
||||
var $total_count = 20; // total # of list
|
||||
var $list_limit = 10; // total # of pages
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('util');
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all the maptoon categories
|
||||
*/
|
||||
public function fn_category() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_category,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register category
|
||||
*/
|
||||
public function fn_category_proc() {
|
||||
$c_name = $this->input->post('c_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$c_name = trim($c_name);
|
||||
|
||||
if($c_name!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['c_name'=>$c_name];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_category, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['c_name' => $c_name];
|
||||
$ret = $this->db->insert($this->tb_name_category,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_category_detail($idx) {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
|
||||
$return_data = ['c_name' => ''];
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$data_category = $this->m_maptoon->get_category($idx);
|
||||
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
|
||||
$return_data['c_name'] = $data_category['c_name'];
|
||||
}
|
||||
// get episodes in chosen category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
|
||||
if($data_episodes!=FALSE) {
|
||||
$return_data['data'] = $data_episodes;
|
||||
} else {
|
||||
$return_data['data'] = '';
|
||||
}
|
||||
|
||||
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
|
||||
} else {
|
||||
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
title: get list of maptoon episodes
|
||||
*/
|
||||
public function fn_get_episodes($str) {
|
||||
$str = trim($str);
|
||||
if($str!='') {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete category
|
||||
*/
|
||||
public function fn_category_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_category);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_categories_idx',$idx);
|
||||
$data = ['mt_categories_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : list all maptoons
|
||||
*/
|
||||
public function fn_maptoon_list() {
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
|
||||
$query_string = [];
|
||||
$data = $this->m_maptoon->get_maptoon_list($query_string);
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
return $this->load->view('/admin/maptoon/list', $return_data, true);
|
||||
}
|
||||
|
||||
public function fn_maptoon_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->model('/admin/maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
|
||||
if(isset($row[0])==TRUE) {
|
||||
$return_data['data'] = $row[0];
|
||||
}
|
||||
} else {
|
||||
$return_data['data'] = [];
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon
|
||||
*/
|
||||
public function fn_maptoon_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
$mode = $this->input->post('mode');
|
||||
$mt_cartoonists_idx = $this->input->post('mt_cartoonists_idx'); //
|
||||
$name = $this->input->post('name'); //
|
||||
$status = $this->input->post('status');
|
||||
$date_sun = ($this->input->post('date_sun')=='') ? 0 : $this->input->post('date_sun');
|
||||
$date_mon = ($this->input->post('date_mon')=='') ? 0 : $this->input->post('date_mon');
|
||||
$date_tue = ($this->input->post('date_tue')=='') ? 0 : $this->input->post('date_tue');
|
||||
$date_wed = ($this->input->post('date_wed')=='') ? 0 : $this->input->post('date_wed');
|
||||
$date_thu = ($this->input->post('date_thu')=='') ? 0 : $this->input->post('date_thu');
|
||||
$date_fri = ($this->input->post('date_fri')=='') ? 0 : $this->input->post('date_fri');
|
||||
$date_sat = ($this->input->post('date_sat')=='') ? 0 : $this->input->post('date_sat');
|
||||
$description = $this->input->post('description');
|
||||
|
||||
if($name=='') {
|
||||
$this->util->js_alert_back('맵툰명을 입력해주십시오'); exit;
|
||||
}
|
||||
if($mt_cartoonists_idx=='') {
|
||||
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
|
||||
}
|
||||
|
||||
//이미지 업로드
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$img_data = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
} else {
|
||||
$img_data = '';
|
||||
}
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) { // update data
|
||||
echo 'asdf'; exit;
|
||||
} else { // insert data
|
||||
$data = ['main_img' => $img_data,
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
'date_sun' => $date_sun,
|
||||
'date_mon' => $date_mon,
|
||||
'date_tue' => $date_tue,
|
||||
'date_wed' => $date_wed,
|
||||
'date_thu' => $date_thu,
|
||||
'date_fri' => $date_fri,
|
||||
'date_sat' => $date_sat,
|
||||
'description' => $description,
|
||||
'reg_date' => date("Y-m-d H:i:s"),
|
||||
'mt_cartoonists_idx' => $mt_cartoonists_idx];
|
||||
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$ret = $this->m_maptoon->insert_maptoon($data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : delete maptoon
|
||||
*/
|
||||
public function fn_maptoon_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon episodes
|
||||
*/
|
||||
public function fn_episode() {
|
||||
$return_data['list'] = $result = array();
|
||||
|
||||
$this->load->model('/admin/maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
|
||||
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array(); //카테고리 리스트
|
||||
|
||||
|
||||
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
|
||||
$query_string = $_SERVER['QUERY_STRING'];
|
||||
parse_str($query_string);
|
||||
|
||||
|
||||
if(isset($author)) $arr_cartoonist_idx = $this->get_cartoonist_idx_by_name(urldecode($author));
|
||||
|
||||
# 검색
|
||||
$req_data = array();
|
||||
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
|
||||
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
|
||||
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
|
||||
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
|
||||
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
|
||||
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
|
||||
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
|
||||
isset($arr_cartoonist_idx)? $req_data['author']= urldecode($author) :$req_data['author']=""; // 작가 번호
|
||||
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
//list 가져오기
|
||||
$this->load->model('/admin/maptoon/m_maptoon_test');
|
||||
$data = $this->m_maptoon_test->get_episode_list($req_data);
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
|
||||
$req_data['suffix'] = '?'.$query_string;
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['mt_title' ] = $pagination;
|
||||
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
|
||||
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
|
||||
$return_data['category'] = $arr_category; // 카테고리 리스트
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register form for maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg() {
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
|
||||
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
|
||||
|
||||
if(empty($this->input->post('idx')==FALSE)){
|
||||
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
$return_data['modify_data'] = $row;
|
||||
}
|
||||
|
||||
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array();
|
||||
|
||||
$return_data['category']=$arr_category;
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg_proc() {
|
||||
$mt_categories_idx = $this->input->post("mt_categories_idx");
|
||||
$mt_list_idx = $this->input->post("mt_list_idx");
|
||||
$title = $this->input->post("title");
|
||||
$display_date = $this->input->post("display_date");
|
||||
$is_display = $this->input->post("is_display"); //0: NO 1:YES
|
||||
|
||||
//메인이미지 업로드
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
} else {
|
||||
$main_img = '';
|
||||
}
|
||||
|
||||
//맵툰이미지 업로드
|
||||
$data = array();
|
||||
$filesCount = count($_FILES['webtoon_images']['name']);
|
||||
if($filesCount>1){
|
||||
for($i =0; $i<$filesCount;$i++){
|
||||
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
|
||||
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
|
||||
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
|
||||
//이미지 업로드
|
||||
if($_FILES['webtoon_images'.$i]['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= 'webtoon_images'.$i.date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
} else {
|
||||
$webtoon_images = '';
|
||||
}
|
||||
}
|
||||
}else if($filesCount==1){
|
||||
if($_FILES['webtoon_images']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('webtoon_images')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$webtoon_images = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
} else {
|
||||
$webtoon_images = '';
|
||||
}
|
||||
}
|
||||
|
||||
$data=[
|
||||
'mt_categories_idx' => $mt_categories_idx,
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'title' => $title,
|
||||
'main_img' => $main_img,
|
||||
'display_date' => $display_date,
|
||||
'is_display' => $is_display,
|
||||
'display_date' => $display_date,
|
||||
'webtoon_images' => json_encode($webtoon_images),
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_episode,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon episode
|
||||
*/
|
||||
public function fn_episode_upd_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete maptoon episode
|
||||
*/
|
||||
public function fn_episode_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>=0) {
|
||||
$this->load->database();
|
||||
$this->db->where_in('idx',$where_in);
|
||||
$ret = $this->db->delete($this->tb_name_episode);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon announcement
|
||||
@param: numeric; idx of announcement table
|
||||
*/
|
||||
public function fn_announcement() {
|
||||
$this->load->model('admin/maptoon/m_maptoon');
|
||||
$return_data['list']=$this->m_maptoon->get_announcement_list();
|
||||
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
|
||||
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register announcement
|
||||
*/
|
||||
public function fn_announcement_reg_proc() {
|
||||
$mt_list_idx = $this->input->post('mt_title');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$contents = $this->input->post('contents');
|
||||
$s_date = $this->input->post('s_date');
|
||||
$e_date = $this->input->post('e_date');
|
||||
|
||||
if($mode=='modify') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = [
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date
|
||||
];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data=[ 'mt_list_idx' => $mt_list_idx,
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date,
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_notice,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon announcement NOT USE
|
||||
|
||||
public function fn_announcement_upd_proc() {
|
||||
$idx= $this->input->post('idx');
|
||||
$contents= $this->input->post('contentes');
|
||||
$idx= $this->input->post('s_date');
|
||||
$idx= $this->input->post('e_date');
|
||||
$mode= $this->input->post('mode');
|
||||
if($mode==""){
|
||||
exit;
|
||||
}else{
|
||||
$data = [
|
||||
'contentes' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
@desc : delete maptoon announcement
|
||||
*/
|
||||
public function fn_announcement_del_proc() {
|
||||
$idx = $this->input->get_post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->load->database();
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_notice);
|
||||
echo $ret;
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
/*
|
||||
@desc : list all cartoonists
|
||||
*/
|
||||
public function fn_cartoonist() {
|
||||
$idx = $this->input->get('idx');
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_cartoonist,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_cartoonist);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register & modify cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_proc() {
|
||||
$name = $this->input->post('name');
|
||||
$website = $this->input->post('website');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$name = trim($name);
|
||||
$website = trim($website);
|
||||
|
||||
if($name!='' && $website!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_cartoonist, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_cartoonist);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_cartoonists_idx',$idx);
|
||||
$data = ['mt_cartoonists_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
2031
application/controllers/admin/delete.later/news_bak190228.php
Executable file
2031
application/controllers/admin/delete.later/news_bak190228.php
Executable file
File diff suppressed because it is too large
Load Diff
230
application/controllers/admin/design.php
Executable file
230
application/controllers/admin/design.php
Executable file
@@ -0,0 +1,230 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once(APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class design extends cm_Controller {
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 디자인관리 > 팝업설정 - 리스트
|
||||
# CREATE : 2018-02-22
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_design_popup_list() {
|
||||
# request
|
||||
$page = $this->uri->segment(5);
|
||||
$search_type = trim($this->input->get_post('search_type', TRUE));
|
||||
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
|
||||
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
|
||||
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
# 검색
|
||||
$req_data['search_type'] = $search_type;
|
||||
$req_data['search_keyword'] = addslashes($search_keyword);
|
||||
$req_data['search_menu_code'] = $search_menu_code;
|
||||
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
# model - 카테고리 list
|
||||
$this->load->model('admin/design/m_design');
|
||||
$total_count = $this->m_design->popup_list_total_count($req_data);
|
||||
$result = $this->m_design->popup_list($req_data);
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $total_count;
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['base_url'] = '/admin/design/design_popup_list/4' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
|
||||
|
||||
# view data
|
||||
$return_data['pagination'] = $pagination;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['limit'] = $limit;
|
||||
$return_data['total_count'] = $total_count;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['search_menu_code'] = $search_menu_code;
|
||||
$return_data['list'] = $result;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/design/design_popup_list', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록
|
||||
# CREATE : 2018-02-26
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_design_popup_reg() {
|
||||
# request
|
||||
$page = trim($this->input->get_post('page', TRUE));;
|
||||
$search_type = trim($this->input->get_post('search_type', TRUE));
|
||||
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
|
||||
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$mode = trim($this->input->get_post('mode', TRUE));
|
||||
|
||||
$result = array();
|
||||
if($mode == 'edit') {
|
||||
# model
|
||||
$this->load->model('admin/design/m_design');
|
||||
$result = $this->m_design->popup_select($idx);
|
||||
if(count($result) == 0) {
|
||||
gf_alert("잘못된 접근입니다.", '/admin/design/design_popup_list/8');
|
||||
exit;
|
||||
}
|
||||
$result = $result[0];
|
||||
}
|
||||
|
||||
# view data
|
||||
$return_data['page'] = $page;
|
||||
$return_data['search_type'] = $search_type;
|
||||
$return_data['search_keyword'] = $search_keyword;
|
||||
$return_data['search_menu_code'] = $search_menu_code;
|
||||
$return_data['mode'] = $mode;
|
||||
$return_data['result'] = $result;
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/design/design_popup_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 저장
|
||||
# CREATE : 2018-02-26
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_design_popup_reg_proc() {
|
||||
# request
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
$mode = trim($this->input->get_post('mode', TRUE));
|
||||
$page = trim($this->input->get_post('page', TRUE));;
|
||||
$search_type = trim($this->input->get_post('search_type', TRUE));
|
||||
$search_keyword = trim($this->input->get_post('search_keyword', TRUE));
|
||||
$search_menu_code = trim($this->input->get_post('search_menu_code', TRUE));
|
||||
$popup_type_name = trim($this->input->get_post('popup_type_name', TRUE));
|
||||
$title = trim($this->input->get_post('title', TRUE));
|
||||
$menu_code = trim($this->input->get_post('menu_code', TRUE));
|
||||
$top_margin = trim($this->input->get_post('top_margin', TRUE));
|
||||
$left_margin = trim($this->input->get_post('left_margin', TRUE));
|
||||
$width_size = trim($this->input->get_post('width_size', TRUE));
|
||||
$height_size = trim($this->input->get_post('height_size', TRUE));
|
||||
$link_url = trim($this->input->get_post('link_url', TRUE));
|
||||
$content = trim($this->input->get_post('content', FALSE));
|
||||
$start_date = trim($this->input->get_post('start_date', TRUE));
|
||||
$end_date = trim($this->input->get_post('end_date', TRUE));
|
||||
$start_time1 = trim($this->input->get_post('start_time1', TRUE));
|
||||
$start_time2 = trim($this->input->get_post('start_time2', TRUE));
|
||||
$end_time1 = trim($this->input->get_post('end_time1', TRUE));
|
||||
$end_time2 = trim($this->input->get_post('end_time2', TRUE));
|
||||
$is_display = trim($this->input->get_post('is_display', TRUE));
|
||||
$prev_img = trim($this->input->get_post('img_path', TRUE));
|
||||
|
||||
if($start_time1=='') $start_time1 = '00';
|
||||
if($start_time2=='') $start_time2 = '00';
|
||||
if($end_time1=='') $end_time1 = '00';
|
||||
if($end_time2=='') $end_time2 = '00';
|
||||
|
||||
$start_time = $start_time1.':'.$start_time2;
|
||||
$end_time = $end_time1.':'.$end_time2;
|
||||
|
||||
$start_date = $start_date.' '.$start_time;
|
||||
$end_date = $end_date.' '.$end_time;
|
||||
|
||||
# req data
|
||||
$req_data['idx'] = $idx;
|
||||
$req_data['popup_type_name']= $popup_type_name;
|
||||
$req_data['title'] = $title;
|
||||
$req_data['menu_code'] = $menu_code;
|
||||
$req_data['top_margin'] = $top_margin;
|
||||
$req_data['left_margin'] = $left_margin;
|
||||
$req_data['width_size'] = $width_size;
|
||||
$req_data['height_size'] = $height_size;
|
||||
$req_data['link_url'] = $link_url;
|
||||
$req_data['content'] = $content;
|
||||
$req_data['start_date'] = $start_date;
|
||||
$req_data['end_date'] = $end_date;
|
||||
$req_data['is_display'] = $is_display;
|
||||
$req_data['prev_img'] = $prev_img;
|
||||
|
||||
if($mode == 'add') { // 등록
|
||||
# model
|
||||
$this->load->model('admin/design/m_design');
|
||||
$result = $this->m_design->popup_insert($req_data);
|
||||
|
||||
$go_url = '/admin/design/design_popup_list/8/';
|
||||
} else if($mode == 'edit') { // 수정
|
||||
# model
|
||||
$this->load->model('admin/design/m_design');
|
||||
$result = $this->m_design->popup_update($req_data);
|
||||
|
||||
$go_url = '/admin/design/design_popup_list/8/'.$page.'?search_type='.$search_type.'&search_keyword='.$search_keyword.'&search_menu_code='.$search_menu_code;
|
||||
}
|
||||
|
||||
if(!$result) {
|
||||
gf_alert("저장에 실패했습니다.", 'back');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
gf_alert("저장되었습니다.", $go_url);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리
|
||||
# CREATE : 2018-02-27
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_design_popup_del_proc() {
|
||||
# request
|
||||
$idx = trim($this->input->get_post('idx', TRUE));
|
||||
|
||||
$req_date[] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/design/m_design');
|
||||
$this->m_design->popup_is_del_update($req_date);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 디자인관리 > 팝업설정 - 팝업등록 > 삭제 처리 (다중)
|
||||
# CREATE : 2018-02-20
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_design_popup_arr_del_proc() {
|
||||
# request
|
||||
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
|
||||
|
||||
# model - update
|
||||
# model - update
|
||||
$this->load->model('admin/design/m_design');
|
||||
$this->m_design->popup_is_del_update($arr_idx);
|
||||
|
||||
gf_alert("삭제되었습니다.", '/admin/design/design_popup_list/8');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
3216
application/controllers/admin/etc_section.php
Executable file
3216
application/controllers/admin/etc_section.php
Executable file
File diff suppressed because it is too large
Load Diff
2198
application/controllers/admin/life.php
Executable file
2198
application/controllers/admin/life.php
Executable file
File diff suppressed because it is too large
Load Diff
119
application/controllers/admin/login.php
Executable file
119
application/controllers/admin/login.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class login extends CI_Controller {
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 어드민 로그인 메인
|
||||
# CREATE : 2018-02-18
|
||||
#---------------------------------------------------------------------------
|
||||
function index() {
|
||||
$this->load->library('session');
|
||||
|
||||
# view
|
||||
$this->load->view('/admin/admin_member/login');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 어드민 로그인
|
||||
# CREATE : 2018-02-18
|
||||
#---------------------------------------------------------------------------
|
||||
function login_proc(){
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('crossmap/exception_helper');
|
||||
$this->load->library('session');
|
||||
|
||||
# Request
|
||||
$user_id = trim($this->input->get_post('user_id', TRUE)); // 아이디
|
||||
$user_pwd = trim($this->input->get_post('user_pwd', TRUE)); // 비밀번호
|
||||
$user_type = trim($this->input->get_post('user_type', TRUE));
|
||||
|
||||
# valid Check
|
||||
if (empty($user_id) == true) {
|
||||
gf_alert('아이디를 입력해주세요.', '/admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($user_pwd) == true) {
|
||||
gf_alert('비밀번호를 입력해주세요.', '/admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$req_data['user_id'] = $user_id;
|
||||
$req_data['user_pwd'] = addslashes($user_pwd);
|
||||
|
||||
|
||||
# model - 로그인
|
||||
$this->load->model('admin/admin_member/m_login');
|
||||
if($user_type == 0) {
|
||||
$return_data = $this->m_login->login_proc($req_data);
|
||||
$req_data['tb'] = 'admin';
|
||||
} else {
|
||||
$return_data = $this->m_login->partner_login_proc($req_data);
|
||||
$req_data['tb'] = 'partner';
|
||||
}
|
||||
|
||||
if($return_data == '') {
|
||||
gf_alert('로그인 정보가 없습니다.', '/admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
$idx = $return_data['idx'];
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
|
||||
# 마지막 로그인 정보 업데이트
|
||||
$this->m_login->last_login_update($req_data);
|
||||
|
||||
|
||||
# 세션정보 저장
|
||||
$user_id = $return_data['user_id'];
|
||||
$user_name = $return_data['user_name'];
|
||||
$last_login_date = $return_data['last_login_date'];
|
||||
$member_group_idx = $return_data['member_group_idx'];
|
||||
$last_login_date = substr($last_login_date, 0, 10);
|
||||
|
||||
switch ($member_group_idx) {
|
||||
case '0': $user_type = '0'; break; // 어드민
|
||||
case '6': $user_type = '1'; break; // 에디터
|
||||
case '7': $user_type = '2'; break; // 칼럼리스트
|
||||
}
|
||||
|
||||
|
||||
if($user_type=='') {
|
||||
gf_alert('잘못된 접근입니다.', '/admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->session->set_userdata('Adm_Type', $user_type);
|
||||
$this->session->set_userdata('Adm_Id', $user_id);
|
||||
$this->session->set_userdata('Adm_Name', $user_name);
|
||||
$this->session->set_userdata('Adm_Last_Login', $last_login_date);
|
||||
$this->session->set_userdata('Adm_Idx', $idx);
|
||||
|
||||
# 메인으로 이동
|
||||
header('location:/adm');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 어드민 로그아웃
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function logout_proc(){
|
||||
$this->load->helper('url');
|
||||
$this->load->library('session');
|
||||
|
||||
# 세션정보 unset
|
||||
$this->session->unset_userdata('Adm_Type');
|
||||
$this->session->unset_userdata('Adm_Id');
|
||||
$this->session->unset_userdata('Adm_Name');
|
||||
$this->session->unset_userdata('Adm_Last_Login');
|
||||
|
||||
# 메인으로 이동
|
||||
header('location:/admin');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
22
application/controllers/admin/main.php
Executable file
22
application/controllers/admin/main.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class main extends cm_controller {
|
||||
|
||||
function fn_index() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
820
application/controllers/admin/maptoon.php
Executable file
820
application/controllers/admin/maptoon.php
Executable file
@@ -0,0 +1,820 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class maptoon extends cm_controller {
|
||||
|
||||
var $tb_name_category = 'mt_categories';
|
||||
var $tb_name_episode = 'mt_episodes';
|
||||
var $tb_name_maptoon_list = 'mt_list';
|
||||
var $tb_name_notice = 'mt_notices';
|
||||
var $tb_name_cartoonist = 'mt_cartoonists';
|
||||
var $total_count = 20; // total # of list
|
||||
var $list_limit = 10; // total # of pages
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('util');
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all the maptoon categories
|
||||
*/
|
||||
public function fn_category() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_category,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/category_list', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register category
|
||||
*/
|
||||
public function fn_category_proc() {
|
||||
$c_name = $this->input->post('c_name');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$c_name = trim($c_name);
|
||||
|
||||
if($c_name=='') {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오'); exit;
|
||||
}
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['c_name'=>$c_name];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_category, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['c_name' => $c_name];
|
||||
$ret = $this->db->insert($this->tb_name_category,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_register_episode_in_category() {
|
||||
$episodes_idx = $this->input->post('episodes_idx');
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
$len = count($episodes_idx);
|
||||
|
||||
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
|
||||
&& $idx>0 && $len>0) {
|
||||
$str = implode(',',$episodes_idx);
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$ret = $this->m_maptoon->update_episodes_by_category($idx,$str);
|
||||
|
||||
$this->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('maptoon_lib',$params);
|
||||
|
||||
// get episode data to write cache
|
||||
$json_data = $this->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
|
||||
|
||||
if($json_data!=FALSE) {
|
||||
$this->maptoon_lib->write_category_cache($idx,$json_data);
|
||||
}
|
||||
}
|
||||
$this->util->js_alert_go('카테고리내 에피소드 등록이 완료되었습니다.','/admin/maptoon/category/10');
|
||||
}
|
||||
|
||||
public function fn_category_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
$search_keyword = $this->input->get('search_keyword');
|
||||
|
||||
if(is_numeric($idx)==FALSE || $idx<=0) {
|
||||
$this->util->js_alert_back('잘못된 접근입니다.'); exit;
|
||||
}
|
||||
|
||||
// get maptoon list in chosen category
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
|
||||
$return_data = ['c_name' => ''];
|
||||
$data_category = $this->m_maptoon->get_category($idx);
|
||||
if($data_category!=FALSE && isset($data_category['c_name'])==TRUE) {
|
||||
$return_data['c_name'] = $data_category['c_name'];
|
||||
}
|
||||
|
||||
if($data_category['mt_episodes_idx']=='') {// get episodes from episode category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($idx);
|
||||
} else { // get episodes in chosen category
|
||||
$data_episodes = $this->m_maptoon->get_episodes_by_category($data_category['mt_episodes_idx']);
|
||||
}
|
||||
if($data_episodes!=FALSE) {
|
||||
$return_data['list'] = $data_episodes;
|
||||
} else {
|
||||
$return_data['list'] = '';
|
||||
}
|
||||
$return_data['idx'] = $idx;
|
||||
return $this->load->view('/admin/maptoon/category_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete category
|
||||
*/
|
||||
public function fn_category_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_category);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_categories_idx',$idx);
|
||||
$data = ['mt_categories_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
get list of maptoon episodes
|
||||
@return json string
|
||||
*/
|
||||
public function fn_get_episodes_by_search_keyword() {
|
||||
$keyword = $this->input->get('keyword');
|
||||
if($keyword!='') {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$row = $this->m_maptoon->get_episodes_by_search_keyword($keyword);
|
||||
// $row = array(['idx'=>2, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>htmlspecialchars('김"집사')],
|
||||
// ['idx'=>3, 'main_img'=>'/files/maptoon/2019/03/efe2b7b7f5d738ffc4ff288ef3a5b055.png','title'=>'김집사']);
|
||||
echo json_encode($row);exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : list all maptoons
|
||||
*/
|
||||
public function fn_maptoon_list() {
|
||||
$page = $this->input->get('page',TRUE);
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
//$query_string = ['status'=>1, 'mt_cartoonists_idx'=>1];
|
||||
$query_string = [];
|
||||
$data = $this->m_maptoon->get_maptoon_list($query_string);
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $this->total_count;
|
||||
$req_data['limit'] = $this->list_limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/maptoon_list/10/' ;
|
||||
$req_data['suffix'] = '?'.$_SERVER['QUERY_STRING'];
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
for($i=0; $i<count($data); $i++) {
|
||||
$data[$i]['num_of_episodes'] = $this->m_maptoon->get_num_of_episodes($data[$i]['idx']);
|
||||
}
|
||||
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
return $this->load->view('/admin/maptoon/list', $return_data, true);
|
||||
}
|
||||
|
||||
public function fn_maptoon_list_del() {
|
||||
$idx = $this->input->post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
//1.check num of episode in maptoon
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$num = $this->m_maptoon->get_num_of_episodes($idx);
|
||||
|
||||
$num_of_announcement = $this->m_maptoon->get_num_of_announcement_by_maptoon($idx);
|
||||
if($num>0) {
|
||||
$ret = ['result'=>"이미 등록되어 있는 에피소드가 있어서 삭제가 불가능합니다.\n해당 에피소드 삭제후 웹툰 삭제가 가능합니다."];
|
||||
echo json_encode($ret); exit;
|
||||
}
|
||||
if($num_of_announcement>0) {
|
||||
$ret = ['result'=>"이미 웹툰에 등록되어 있는 공지사항이 있어서 삭제가 불가능합니다.\n해당 공지사항 삭제후 웹툰 삭제가 가능합니다."];
|
||||
echo json_encode($ret); exit;
|
||||
}
|
||||
|
||||
$result = $this->m_maptoon->delete_maptoon($idx);
|
||||
$ret = ['result'=>$result];
|
||||
if($result==TRUE) {
|
||||
$ret = ['result'=>'success'];
|
||||
} else {
|
||||
$ret = ['result'=>'DB error, 개발자에게 문의 바랍니다.'];
|
||||
}
|
||||
} else {
|
||||
$ret = ['result'=>'wrong parameter'];
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public function fn_maptoon_detail() {
|
||||
$idx = $this->input->get('idx');
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['cartoonist'] = $arr_cartoonist;
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$num_of_episodes = $this->m_maptoon->get_num_of_episodes($idx);
|
||||
$return_data['num_of_episodes'] = $num_of_episodes;
|
||||
$row = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
|
||||
if(isset($row[0])==TRUE) {
|
||||
$return_data['data'] = $row[0];
|
||||
}
|
||||
$return_data['maptoon_idx'] = $idx;
|
||||
} else {
|
||||
$return_data['data'] = [];
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/maptoon_detail', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon
|
||||
*/
|
||||
public function fn_maptoon_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
$mode = $this->input->post('mode');
|
||||
$mt_cartoonists_idx = $this->input->post('mt_cartoonists_idx'); //
|
||||
$name = $this->input->post('name'); //
|
||||
$status = $this->input->post('status');
|
||||
$date_sun = ($this->input->post('date_sun')=='') ? 0 : $this->input->post('date_sun');
|
||||
$date_mon = ($this->input->post('date_mon')=='') ? 0 : $this->input->post('date_mon');
|
||||
$date_tue = ($this->input->post('date_tue')=='') ? 0 : $this->input->post('date_tue');
|
||||
$date_wed = ($this->input->post('date_wed')=='') ? 0 : $this->input->post('date_wed');
|
||||
$date_thu = ($this->input->post('date_thu')=='') ? 0 : $this->input->post('date_thu');
|
||||
$date_fri = ($this->input->post('date_fri')=='') ? 0 : $this->input->post('date_fri');
|
||||
$date_sat = ($this->input->post('date_sat')=='') ? 0 : $this->input->post('date_sat');
|
||||
$description = $this->input->post('description');
|
||||
|
||||
if($name=='') {
|
||||
$this->util->js_alert_back('맵툰명을 입력해주십시오'); exit;
|
||||
}
|
||||
if($mt_cartoonists_idx=='') {
|
||||
$this->util->js_alert_back('맵툰작가를 입력해주십시오'); exit;
|
||||
}
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$maptoon_info = $this->m_maptoon->get_maptoon_list(['idx' => $idx]);
|
||||
|
||||
//이미지 업로드
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$img_data = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
|
||||
//remove previous image
|
||||
if(isset($maptoon_info[0])==TRUE && $img_data!='') {
|
||||
$main_img = $maptoon_info[0]['main_img'];
|
||||
if($main_img!='') {
|
||||
unlink($_SERVER['DOCUMENT_ROOT'].$main_img);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$img_data = (isset($maptoon_info[0]['main_img'])==TRUE) ? $maptoon_info[0]['main_img'] : '';
|
||||
}
|
||||
|
||||
$data = ['main_img' => $img_data,
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
'date_sun' => $date_sun,
|
||||
'date_mon' => $date_mon,
|
||||
'date_tue' => $date_tue,
|
||||
'date_wed' => $date_wed,
|
||||
'date_thu' => $date_thu,
|
||||
'date_fri' => $date_fri,
|
||||
'date_sat' => $date_sat,
|
||||
'description' => $description,
|
||||
'reg_date' => date("Y-m-d H:i:s"),
|
||||
'mt_cartoonists_idx' => $mt_cartoonists_idx];
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) { // update data
|
||||
$ret = $this->m_maptoon->update_maptoon($idx, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/maptoon_list/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('수정되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
} else { // insert data
|
||||
$ret = $this->m_maptoon->insert_maptoon($data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/maptoon_list/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert_back('등록되지 않았습니다. 다시 시도해 주세요');exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@desc : delete maptoon
|
||||
*/
|
||||
public function fn_maptoon_del_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon episodes
|
||||
*/
|
||||
public function fn_episode() {
|
||||
$return_data['list'] = $result = array();
|
||||
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$arr_cartoonist = $this->m_maptoon->get_cartoonist_list(); //작가 이름
|
||||
$arr_mt_title = $this->m_maptoon->get_mt_title(); //맵툰 이름 리스트
|
||||
$cartoonist_list=array();
|
||||
foreach($arr_cartoonist as $val){
|
||||
$cartoonist_list[$val['idx']]=$val['name'];
|
||||
}
|
||||
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array(); //카테고리 리스트
|
||||
$category_list=array();
|
||||
foreach($arr_category as $val){
|
||||
$category_list[$val['idx']]=$val['c_name'];
|
||||
}
|
||||
|
||||
$query_string = $_SERVER['QUERY_STRING'];
|
||||
parse_str($query_string);
|
||||
|
||||
|
||||
if(isset($author)) $arr_cartoonist_idx = $this->m_maptoon->get_cartoonist_idx_by_name(urldecode($author));
|
||||
|
||||
# 검색
|
||||
$req_data = array();
|
||||
isset($sort_list)? $req_data['sort_list']=$sort_list :$req_data['sort_list']=""; // 최신 조회
|
||||
isset($date_reg)? $req_data['date_reg']=$date_reg :$req_data['date_reg']=""; // 등록 날짜별
|
||||
isset($ca)? $req_data['category']=$ca :$req_data['category']=""; // 카테고리
|
||||
isset($sdate)? $req_data['sdate']=$sdate :$req_data['sdate']=""; // 시작일
|
||||
isset($edate)? $req_data['edate']=$edate :$req_data['edate']=""; // 종료일
|
||||
isset($mt_name)? $req_data['mt_name']= urldecode($mt_name) :$req_data['mt_name']=""; // 맵툰 이름
|
||||
isset($ep_title)? $req_data['ep_title']= urldecode($ep_title) :$req_data['ep_title']=""; // 맵툰 제목
|
||||
isset($arr_cartoonist_idx)? $req_data['author']= $arr_cartoonist_idx :$req_data['author']=""; // 작가 번호
|
||||
|
||||
# paging 설정
|
||||
$page = $this->uri->segment(5);
|
||||
if($page == 0) $page = 1;
|
||||
// $limit = PAGE_SIZE;
|
||||
$limit = 10;
|
||||
$offset = ($page-1) * $limit;
|
||||
$req_data['offset'] = $offset;
|
||||
$req_data['limit'] = $limit;
|
||||
|
||||
#list 가져오기
|
||||
$data = $this->m_maptoon->get_episode_list($req_data);
|
||||
|
||||
#total count 가져오기
|
||||
$total_count=$this->m_maptoon->get_episode_list_search_count($req_data);
|
||||
|
||||
# pagination
|
||||
$req_data = array();
|
||||
$req_data['total_count'] = $total_count; // 총 에피소드 수
|
||||
$req_data['limit'] = $limit;
|
||||
$req_data['base_url'] = '/admin/maptoon/episode/10/' ;
|
||||
$req_data['suffix'] = '?'.$query_string;
|
||||
|
||||
$this->load->library('comm_admin');
|
||||
$pagination = $this->comm_admin->fn_pagination($req_data);
|
||||
$return_data = $req_data;
|
||||
$return_data['list'] = $data;
|
||||
$return_data['page'] = $page;
|
||||
$return_data['pagination' ] = $pagination;
|
||||
$return_data['cartoonist'] = $arr_cartoonist; // 작가 이름
|
||||
$return_data['cartoonist_list'] = $cartoonist_list; // 작가 이름2
|
||||
$return_data['mt_title' ] = $arr_mt_title; // 맵툰 이름
|
||||
$return_data['category'] = $arr_category; // 카테고리 리스트
|
||||
$return_data['category_list'] = $category_list; // 카테고리 리스트2
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_list', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register form for maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg() {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
|
||||
$return_data['cartoonist'] = $this->m_maptoon->get_cartoonist_list();
|
||||
$return_data['mt_title' ] = $this->m_maptoon->get_mt_title();
|
||||
|
||||
|
||||
if(empty($this->input->post('idx')==FALSE)){
|
||||
$idx= $this->input->post('idx');
|
||||
$query = $this->db->get_where($this->tb_name_episode,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
|
||||
$return_data['modify_data'] = $row;
|
||||
}
|
||||
|
||||
$query = $this->db->get($this->tb_name_category);
|
||||
$arr_category = $query->result_array();
|
||||
|
||||
$return_data['category']=$arr_category;
|
||||
|
||||
return $this->load->view('/admin/maptoon/episode_reg', $return_data, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register maptoon episode
|
||||
*/
|
||||
public function fn_episode_reg_proc() {
|
||||
$mode = $this->input->post("mode");// edit 이면 수정
|
||||
$idx = $this->input->post("idx"); // 수정시 사용
|
||||
$mt_categories_idx = $this->input->post("mt_categories_idx");
|
||||
$mt_list_idx = $this->input->post("mt_list_idx");
|
||||
$title = $this->input->post("title");
|
||||
$ep_no = $this->input->post("ep_no");
|
||||
$display_date = $this->input->post("display_date");
|
||||
$is_display = $this->input->post("is_display"); //0: NO 1:YES
|
||||
|
||||
//메인이미지 업로드
|
||||
$main_img = '';
|
||||
if($_FILES['main_img']['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('main_img')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("메인 이미지 업로드에 실패했습니다.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$main_img = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
}
|
||||
|
||||
//맵툰이미지 업로드
|
||||
$data = array();
|
||||
$filesCount = count($_FILES['webtoon_images']['name']);
|
||||
$webtoon_images = '';
|
||||
if($filesCount>0 && $_FILES['webtoon_images']['name']!=''){
|
||||
for($i =0; $i<$filesCount;$i++){
|
||||
$_FILES['webtoon_images'.$i]['name'] = $_FILES['webtoon_images']['name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['type'] = $_FILES['webtoon_images']['type'][$i];
|
||||
$_FILES['webtoon_images'.$i]['tmp_name'] = $_FILES['webtoon_images']['tmp_name'][$i];
|
||||
$_FILES['webtoon_images'.$i]['error'] = $_FILES['webtoon_images']['error'][$i];
|
||||
$_FILES['webtoon_images'.$i]['size'] = $_FILES['webtoon_images']['size'][$i];
|
||||
//이미지 업로드
|
||||
if($_FILES['webtoon_images'.$i]['name']!='') {
|
||||
$mid_url_path = date("Y")."/".date("m");
|
||||
$upload_path = MAPTOON_DIR_BACK.$mid_url_path;
|
||||
if (!is_dir($upload_path)) {
|
||||
umask(0);
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$config['max_size'] = 20*1024;
|
||||
|
||||
$config['upload_path'] = $upload_path;
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['encrypt_name'] = TRUE;
|
||||
|
||||
$this->load->library('upload');
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$file_name= 'webtoon_images'.$i.date("H").date("i").date("s");
|
||||
|
||||
if ( ! $this->upload->do_upload('webtoon_images'.$i)) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다1.", 'back');
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$webtoon_images[$i] = (isset($arr_upload_data['file_name'])==TRUE) ? MAPTOON_DIR_FRONT.$mid_url_path.'/'.$arr_upload_data['file_name'] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mode!="edit"){
|
||||
$data=[
|
||||
'mt_categories_idx' => $mt_categories_idx,
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'title' => $title,
|
||||
'ep_no' => $ep_no,
|
||||
'main_img' => $main_img,
|
||||
'display_date' => $display_date,
|
||||
'is_display' => $is_display,
|
||||
'webtoon_images' => json_encode($webtoon_images),
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_episode,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('등록되었습니다','/admin/maptoon/episode/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}else if($mode=="edit"){
|
||||
$data=[
|
||||
'mt_categories_idx' => $mt_categories_idx,
|
||||
'title' => $title,
|
||||
'mt_list_idx' => $mt_list_idx,
|
||||
'ep_no' => $ep_no,
|
||||
'display_date' => $display_date,
|
||||
'is_display' => $is_display,
|
||||
];
|
||||
|
||||
if($main_img!='')$data['main_img']= $main_img;
|
||||
if($webtoon_images!='') $data['webtoon_images'] = json_encode($webtoon_images);
|
||||
|
||||
$this->db->where('idx',$idx);
|
||||
|
||||
$ret = $this->db->update($this->tb_name_episode,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_go('수정되었습니다','/admin/maptoon/episode/10');exit;
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon episode
|
||||
*/
|
||||
public function fn_episode_upd_proc() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete maptoon episode
|
||||
*/
|
||||
public function fn_episode_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>=0) {
|
||||
$this->load->database();
|
||||
$this->db->query("SET FOREIGN_KEY_CHECKS=0;");
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_episode);
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
// $this->util->js_alert_back($message);exit;
|
||||
echo "<script>alert('".$message."');</script>";
|
||||
Header("Location:/admin/maptoon/episode/10");
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : show list of maptoon announcement
|
||||
@param: numeric; idx of announcement table
|
||||
*/
|
||||
public function fn_announcement() {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$mt_idx=0; //all data
|
||||
$return_data['list']=$this->m_maptoon->get_announcement_list($mt_idx);
|
||||
$return_data['mt_title' ]=$this->m_maptoon->get_mt_title();
|
||||
return $this->load->view('/admin/maptoon/notice_list',$return_data,true);
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register announcement
|
||||
*/
|
||||
public function fn_announcement_reg_proc() {
|
||||
$mt_list_idx = $this->input->post('mt_title');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$contents = $this->input->post('contents');
|
||||
$s_date = $this->input->post('s_date');
|
||||
$e_date = $this->input->post('e_date');
|
||||
|
||||
if($mode=='modify') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = [
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date
|
||||
];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data=[ 'mt_list_idx' => $mt_list_idx,
|
||||
'contents' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date,
|
||||
'reg_date' => date("Y-m-d H:i:s")
|
||||
];
|
||||
$ret = $this->db->insert($this->tb_name_notice,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
// $this->util->js_alert('존재하지 않는 웹툰 제목입니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : update maptoon announcement NOT USE
|
||||
|
||||
public function fn_announcement_upd_proc() {
|
||||
$idx= $this->input->post('idx');
|
||||
$contents= $this->input->post('contentes');
|
||||
$idx= $this->input->post('s_date');
|
||||
$idx= $this->input->post('e_date');
|
||||
$mode= $this->input->post('mode');
|
||||
if($mode==""){
|
||||
exit;
|
||||
}else{
|
||||
$data = [
|
||||
'contentes' => $contents,
|
||||
's_date' => $s_date,
|
||||
'e_date' => $e_date];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_notice, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
@desc : delete maptoon announcement
|
||||
*/
|
||||
public function fn_announcement_del_proc() {
|
||||
$idx = $this->input->get_post('idx');
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->load->database();
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_notice);
|
||||
echo $ret;
|
||||
if($ret==TRUE) {
|
||||
$message = '삭제되었습니다.';
|
||||
} else {
|
||||
$message = '삭제되지 않았습니다.(디비 에러) 서버 관리자에게 문의해 주십시오.';
|
||||
}
|
||||
}else{
|
||||
$message = '인덱스 값이 잘못 입력되었습니다';
|
||||
exit;
|
||||
}
|
||||
echo "<script>alert('".$message."'); parent.location.reload();</script>";
|
||||
}
|
||||
/*
|
||||
@desc : list all cartoonists
|
||||
*/
|
||||
public function fn_cartoonist() {
|
||||
$idx = $this->input->get('idx');
|
||||
$this->load->database();
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$query = $this->db->get_where($this->tb_name_cartoonist,['idx'=>$idx]);
|
||||
$row = $query->row_array();
|
||||
if($row!=FALSE) {
|
||||
$row['result'] = 'success';
|
||||
}
|
||||
echo json_encode($row);
|
||||
exit;
|
||||
} else {
|
||||
$query = $this->db->get($this->tb_name_cartoonist);
|
||||
$i = 0;
|
||||
$return_data = array();
|
||||
foreach($query->result_array() as $row) {
|
||||
$return_data['list'][$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
return $this->load->view('/admin/maptoon/cartoonist', $return_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : register & modify cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_proc() {
|
||||
$name = $this->input->post('name');
|
||||
$website = $this->input->post('website');
|
||||
$mode = $this->input->post('mode');
|
||||
$idx = $this->input->post('idx');
|
||||
$name = trim($name);
|
||||
$website = trim($website);
|
||||
|
||||
if($name!='' && $website!='') {
|
||||
if($mode=='upt') {
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->update($this->tb_name_cartoonist, $data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('수정되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 입력되지 않았습니다.');
|
||||
}
|
||||
} else {
|
||||
$data = ['name' => $name,
|
||||
'website' => $website];
|
||||
$ret = $this->db->insert($this->tb_name_cartoonist,$data);
|
||||
if($ret==TRUE) {
|
||||
$this->util->js_alert_parent_reload('등록되었습니다.');
|
||||
} else {
|
||||
$this->util->js_alert('DB error');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('카테고리 이름을 입력해 주십시오');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
@desc : delete cartoonist info
|
||||
*/
|
||||
public function fn_cartoonist_del_proc() {
|
||||
$idx = $this->input->post('idx');
|
||||
|
||||
if(is_numeric($idx)==TRUE && $idx>0) {
|
||||
$this->db->where('idx',$idx);
|
||||
$ret = $this->db->delete($this->tb_name_cartoonist);
|
||||
if($ret==TRUE) {
|
||||
$this->db->where('mt_cartoonists_idx',$idx);
|
||||
$data = ['mt_cartoonists_idx' => 0];
|
||||
$ret = $this->db->update($this->tb_name_maptoon_list,$data);
|
||||
//echo $this->db->last_query();
|
||||
$this->util->js_alert_parent_reload('삭제되었습니다.');
|
||||
}
|
||||
} else {
|
||||
$this->util->js_alert('키값이 전달되지 않았습니다.');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
1440
application/controllers/admin/member.php
Executable file
1440
application/controllers/admin/member.php
Executable file
File diff suppressed because it is too large
Load Diff
2050
application/controllers/admin/news.php
Executable file
2050
application/controllers/admin/news.php
Executable file
File diff suppressed because it is too large
Load Diff
92
application/controllers/admin/search.php
Executable file
92
application/controllers/admin/search.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?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 search extends cm_Controller {
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 기사검색
|
||||
# CREATE : 2018-03-06
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_ajax_search_article_list() {
|
||||
# request
|
||||
$article_keyword = trim($this->input->get_post('article_keyword', TRUE));
|
||||
$content_type = trim($this->input->get_post('content_type', TRUE));
|
||||
$sort = trim($this->input->get_post('sort', TRUE));
|
||||
$type = trim($this->input->get_post('type', 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));
|
||||
|
||||
if($sort=='') $sort = '1';
|
||||
switch ($sort) {
|
||||
case '1': $sort_column = 'display_date'; $sort_type = 'desc'; break;
|
||||
case '2': $sort_column = 'display_date'; $sort_type = 'asc'; break;
|
||||
default : $sort_column = 'display_date'; $sort_type = 'desc'; break;
|
||||
}
|
||||
|
||||
# 검색
|
||||
$req_data['article_keyword'] = addslashes($article_keyword);
|
||||
$req_data['sort_column'] = $sort_column;
|
||||
$req_data['sort_type'] = $sort_type;
|
||||
$req_data['category1'] = $category1;
|
||||
$req_data['category2'] = $category2;
|
||||
$req_data['category3'] = $category3;
|
||||
|
||||
if($content_type == 'all') {
|
||||
# model - list
|
||||
$this->load->model('admin/comm/m_search');
|
||||
$result = $this->m_search->all_list_limit100($req_data);
|
||||
} else {
|
||||
if($content_type == '1') { // 뉴스
|
||||
# model - list
|
||||
$this->load->model('admin/news/m_news');
|
||||
$result = $this->m_news->news_list_limit100($req_data);
|
||||
} else if($content_type == '2') { // 칼럼
|
||||
# model - list
|
||||
$this->load->model('admin/column/m_column');
|
||||
$result = $this->m_column->column_list_limit100($req_data);
|
||||
} else if($content_type == '3') { // 라이프
|
||||
# model - list
|
||||
$this->load->model('admin/life/m_life');
|
||||
$result = $this->m_life->life_list_limit100($req_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# view data
|
||||
$return_data['list'] = $result;
|
||||
$return_data['count'] = count($result);
|
||||
$return_data['sort'] = $sort;
|
||||
|
||||
if($type=='JSON') {
|
||||
$return_data['result'] = array('result_code' => '0000', 'result_data'=>$return_data);
|
||||
$view_url = '/admin/comm/result_json';
|
||||
} else {
|
||||
$view_url = '/admin/search/search_article_list';
|
||||
}
|
||||
|
||||
|
||||
# view
|
||||
return $this->load->view($view_url, $return_data);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
440
application/controllers/admin/service.php
Executable file
440
application/controllers/admin/service.php
Executable file
@@ -0,0 +1,440 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/**
|
||||
* 인클루드 class
|
||||
*
|
||||
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
||||
*/
|
||||
|
||||
include_once (APPPATH.'core/admin/cm_controller.php');
|
||||
|
||||
class service extends cm_controller {
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 기본정보
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_service_authorization_reg() {
|
||||
|
||||
// # model
|
||||
// $this->load->model('admin/setting/m_setting_site');
|
||||
// $return_data = $this->m_setting_site->site_info_select();
|
||||
// if($return_data == '') {
|
||||
// $return_data['homepage_title'] = '';
|
||||
// $return_data['admin_logo'] = '';
|
||||
// $return_data['footer_script'] = '';
|
||||
// $return_data['webmaster_name'] = '';
|
||||
// $return_data['webmaster_email'] = '';
|
||||
// }
|
||||
//
|
||||
// # view
|
||||
// return $this->load->view('/admin/setting/setting_site_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 기본정보 저장
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_site_reg_proc() {
|
||||
|
||||
$homepage_title = trim($this->input->get_post('homepage_title', TRUE)); // 홈페이지제목
|
||||
$footer_script = trim($this->input->get_post('footer_script', FALSE)); // 하단스크립트
|
||||
$webmaster_name = trim($this->input->get_post('webmaster_name', TRUE)); // 웹마스터이름
|
||||
$webmaster_email = trim($this->input->get_post('webmaster_email', TRUE)); // 웹마스터이메일
|
||||
$is_del_admin_logo = trim($this->input->get_post('is_del_admin_log', TRUE)); // 관리자페이지로고 - 삭제여부
|
||||
|
||||
# valid check
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('homepage_title', '홈페이지 제목', 'required');
|
||||
$this->form_validation->set_rules('webmaster_name', '웹마스터 이름', 'required');
|
||||
$this->form_validation->set_rules('webmaster_email', '웹마스터 이메일주소', 'required');
|
||||
|
||||
if($this->form_validation->run() == false){
|
||||
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
|
||||
exit;
|
||||
}
|
||||
|
||||
$footer_script = htmlspecialchars($footer_script);
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
$org_filename = '';
|
||||
if($return_data != '') {
|
||||
$org_filename = $return_data['admin_logo'];
|
||||
$footer_content = $return_data['footer_content'];
|
||||
}
|
||||
|
||||
# 이미지 삭제
|
||||
if($is_del_admin_logo=='Y') {
|
||||
unlink('.'.$org_filename);
|
||||
$org_filename = '';
|
||||
}
|
||||
|
||||
if($_FILES['admin_logo']['name']!='') {
|
||||
# image upload
|
||||
$upload_path = './files/'.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('admin_logo')) {
|
||||
$error = array('error' => $this->upload->display_errors());
|
||||
gf_alert("이미지 업로드에 실패했습니다.", '/admin/setting/setting_site_reg/1');
|
||||
exit;
|
||||
}
|
||||
$arr_upload_data = $this->upload->data();
|
||||
$filename = str_replace($_SERVER['DOCUMENT_ROOT'], '', $arr_upload_data['full_path']);
|
||||
|
||||
} else {
|
||||
$filename = $org_filename;
|
||||
}
|
||||
|
||||
$req_data['homepage_title'] = $homepage_title;
|
||||
$req_data['admin_logo'] = $filename;
|
||||
$req_data['footer_script'] = $footer_script;
|
||||
$req_data['webmaster_name'] = $webmaster_name;
|
||||
$req_data['webmaster_email'] = $webmaster_email;
|
||||
|
||||
if($return_data != '') { // 수정
|
||||
$idx = $return_data['idx'];
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_update($req_data);
|
||||
|
||||
} else { // 등록
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_insert($req_data);
|
||||
|
||||
}
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/setting/setting_site_reg/1');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 접근기능
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_site_access_reg() {
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_access_ip_select();
|
||||
|
||||
$arr_return_data['access_type_1'] = '';
|
||||
$arr_return_data['access_type_2'] = '';
|
||||
$arr_return_data['access_type_3'] = '';
|
||||
if($return_data != '') {
|
||||
foreach($return_data as $val) {
|
||||
$key = 'access_type_'.$val['access_type'];
|
||||
$arr_return_data[$key] .= $val['ip']."\r\n";;
|
||||
}
|
||||
}
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/setting/setting_site_access_reg', $arr_return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 접근기능 저장
|
||||
# CREATE : 2018-02-20
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_site_access_reg_proc() {
|
||||
|
||||
$access_type_1 = trim($this->input->get_post('access_type_1', TRUE)); // 관리자 페이지 접근가능 IP
|
||||
$access_type_2 = trim($this->input->get_post('access_type_2', TRUE)); // 사이트 접근불가 IP
|
||||
$access_type_3 = trim($this->input->get_post('access_type_3', TRUE)); // 사이트 접근가능 IP
|
||||
|
||||
$arr_access_type_1 = explode("\r\n", $access_type_1);
|
||||
$arr_access_type_1 = array_values(array_filter(array_map('trim',$arr_access_type_1)));
|
||||
|
||||
$arr_access_type_2 = explode("\r\n", $access_type_2);
|
||||
$arr_access_type_2 = array_values(array_filter(array_map('trim',$arr_access_type_2)));
|
||||
|
||||
$arr_access_type_3 = explode("\r\n", $access_type_3);
|
||||
$arr_access_type_3 = array_values(array_filter(array_map('trim',$arr_access_type_3)));
|
||||
|
||||
$req_data['access_type_1'] = $arr_access_type_1;
|
||||
$req_data['access_type_2'] = $arr_access_type_2;
|
||||
$req_data['access_type_3'] = $arr_access_type_3;
|
||||
|
||||
# model - 접근기능 삭제
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_access_ip_delete();
|
||||
|
||||
# model - 금칙접근기능어 입력
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_access_ip_insert($req_data);
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/setting/setting_site_access_reg/1');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 하단푸터관리
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_footer_reg() {
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
if($return_data == '') {
|
||||
$return_data['footer_content'] = '';
|
||||
}
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/setting/setting_footer_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 하단푸터관리 저장
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_footer_reg_proc() {
|
||||
|
||||
$footer_content = trim($this->input->get_post('footer_content', TRUE)); // 사이트 하단 정보입력
|
||||
|
||||
# valid check
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('footer_content', '사이트 하단 정보입력', 'required');
|
||||
|
||||
if($this->form_validation->run() == false){
|
||||
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
|
||||
exit;
|
||||
}
|
||||
|
||||
$footer_content = htmlspecialchars($footer_content);
|
||||
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
|
||||
$req_data['footer_content'] = $footer_content;
|
||||
|
||||
if($return_data != '') { // 수정
|
||||
$idx = $return_data['idx'];
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_footer_content_update($req_data);
|
||||
|
||||
} else { // 등록
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_insert($req_data);
|
||||
|
||||
}
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/setting/setting_footer_reg/1');
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 금칙어설정
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_forbidden_word_reg() {
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->forbidden_word_select();
|
||||
if($return_data == '') {
|
||||
$return_data['forbidden_word'] = '';
|
||||
} else {
|
||||
$forbidden_word = '';
|
||||
foreach($return_data as $val) {
|
||||
$forbidden_word.= $val['word']."\r\n";
|
||||
}
|
||||
$return_data['forbidden_word'] = $forbidden_word;
|
||||
|
||||
}
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/setting/setting_forbidden_word_reg', $return_data, true);
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 금칙어설정 저장
|
||||
# CREATE : 2018-02-20
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_forbidden_word_reg_proc() {
|
||||
|
||||
$forbidden_word = trim($this->input->get_post('forbidden_word', TRUE)); // 단어 필터링
|
||||
|
||||
# valid check
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('forbidden_word', '단어 필터링', 'required');
|
||||
|
||||
if($this->form_validation->run() == false){
|
||||
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
|
||||
exit;
|
||||
}
|
||||
$arr_forbidden_word = explode("\r\n", $forbidden_word);
|
||||
$req_data = array_values(array_filter(array_map('trim',$arr_forbidden_word)));
|
||||
|
||||
|
||||
# model - 금칙어 삭제
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->forbidden_word_delete();
|
||||
|
||||
# model - 금칙어 입력
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->forbidden_word_insert($req_data);
|
||||
|
||||
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/setting/setting_forbidden_word_reg/1');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 이용약관개인정보 취급방침
|
||||
# CREATE : 2018-02-19
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_policy_reg() {
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
if($return_data == '') {
|
||||
$return_data['service'] = '';
|
||||
$return_data['privacy'] = '';
|
||||
$return_data['privacy_agreement'] = '';
|
||||
}
|
||||
|
||||
# view
|
||||
return $this->load->view('/admin/setting/setting_policy_reg', $return_data, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 사이트정보설정 - 이용약관개인정보 취급방침 저장
|
||||
# CREATE : 2018-02-20
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_policy_reg_proc() {
|
||||
|
||||
$service = trim($this->input->get_post('service', TRUE)); // 이용약관
|
||||
$privacy = trim($this->input->get_post('privacy', TRUE)); // 개인정보 취급방침
|
||||
$privacy_agreement = trim($this->input->get_post('privacy_agreement', TRUE)); // 개인정보 수집 이용동의
|
||||
|
||||
# valid check
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('service', '이용약관', 'required');
|
||||
$this->form_validation->set_rules('privacy', '개인정보 취급방침', 'required');
|
||||
$this->form_validation->set_rules('privacy_agreement', '개인정보 수집 이용동의', 'required');
|
||||
|
||||
if($this->form_validation->run() == false){
|
||||
gf_alert("정보를 정확히 입력해주세요.", '/admin/main');
|
||||
exit;
|
||||
}
|
||||
|
||||
$service = htmlspecialchars($service);
|
||||
$privacy = htmlspecialchars($privacy);
|
||||
$privacy_agreement = htmlspecialchars($privacy_agreement);
|
||||
|
||||
# model
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
|
||||
$req_data['service'] = $service;
|
||||
$req_data['privacy'] = $privacy;
|
||||
$req_data['privacy_agreement'] = $privacy_agreement;
|
||||
|
||||
if($return_data != '') { // 수정
|
||||
$idx = $return_data['idx'];
|
||||
$req_data['idx'] = $idx;
|
||||
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_policy_update($req_data);
|
||||
|
||||
} else { // 등록
|
||||
# model - update
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$this->m_setting_site->site_info_insert($req_data);
|
||||
|
||||
}
|
||||
|
||||
gf_alert("저장되었습니다.", '/admin/setting/setting_policy_reg/1');
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 신고관리 - 블라인드리스트
|
||||
# CREATE : 2018-02-20
|
||||
#---------------------------------------------------------------------------
|
||||
function fn_setting_blind_list() {
|
||||
# request
|
||||
$page = $this->uri->segment(5);
|
||||
|
||||
|
||||
|
||||
|
||||
# paging 설정
|
||||
if($page == '') $page = 1;
|
||||
$limit = PAGE_SIZE;
|
||||
$offset = ($page-1) * $limit;
|
||||
|
||||
|
||||
|
||||
|
||||
// $this->load->model('shop/shopinfo');
|
||||
// $data['arrRtnShopInfo'] = $this->shopinfo->getShopInfo($Shop_No);
|
||||
// $data['arrRtnShopMenuInfo'] = $this->shopinfo->getShopMenuInfo($Shop_No);
|
||||
// $data['arrRtnShopReviewList'] = $this->shopinfo->getShopReviewList($Shop_No, $reqData['offset'], $reqData['limit']);
|
||||
// $data['url'] = $reqData['url'];
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// # model
|
||||
// $this->load->model('admin/setting/m_setting_site');
|
||||
// $return_data = $this->m_setting_site->site_info_select();
|
||||
// if($return_data == '') {
|
||||
// $return_data['service'] = '';
|
||||
// $return_data['privacy'] = '';
|
||||
// $return_data['privacy_agreement'] = '';
|
||||
// }
|
||||
//
|
||||
// # view
|
||||
// return $this->load->view('/admin/setting/setting_policy_reg', $return_data, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
1237
application/controllers/admin/setting.php
Executable file
1237
application/controllers/admin/setting.php
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user