Files
cm-app-web/application/controllers/admin/config/Cleanlog.php

849 lines
28 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Cleanlog class
*
* Copyright (c) CIBoard <www.ciboard.co.kr>
*
* @author CIBoard (develop@ciboard.co.kr)
*/
/**
* 관리자>환경설정>오래된로그삭제 controller 입니다.
*/
class Cleanlog extends CB_Controller
{
/**
* 관리자 페이지 상의 현재 디렉토리입니다
* 페이지 이동시 필요한 정보입니다
*/
public $pagedir = 'config/cleanlog';
/**
* 모델을 로딩합니다
*/
protected $models = array();
/**
* 이 컨트롤러의 메인 모델 이름입니다
*/
protected $modelname = '';
/**
* 헬퍼를 로딩합니다
*/
protected $helpers = array('form', 'array', 'file');
function __construct()
{
parent::__construct();
/**
* 라이브러리를 로딩합니다
*/
$this->load->library(array('querystring'));
}
/**
* 오래된로그 삭제>캐시삭제 페이지입니다
*/
public function index()
{
$this->cache();
}
/**
* 오래된로그 삭제>캐시삭제 페이지입니다
*/
public function cache()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_cache';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'execute',
'label' => '실행',
'rules' => 'trim',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
$result = $this->cache->clean();
if ($result !== false) {
$view['view']['alert_message'] = '캐시가 삭제되었습니다';
} else {
$view['view']['alert_message'] = '캐시 삭제에 실패했습니다';
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'cache');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>썸네일삭제 페이지입니다
*/
public function thumbnail()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_thumbnail';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'execute',
'label' => '실행',
'rules' => 'trim',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
$result = delete_files(config_item('uploads_dir') . '/cache/', true);
if ($result !== false) {
$view['view']['alert_message'] = '썸네일이 모두 삭제되었습니다';
} else {
$view['view']['alert_message'] = '썸네일 삭제에 실패했습니다';
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'thumbnail');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>방문자로그삭제 페이지입니다
*/
public function visitlog()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_visitlog';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model(array('Stat_count_model', 'Stat_count_date_model'));
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'sco_date <=' => $this->input->post('criterion'),
);
$this->Stat_count_model->delete_where($deletewhere);
$deletewhere = array(
'scd_date <=' => $this->input->post('criterion')
);
$this->Stat_count_date_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 '
. $this->input->post('day') . '일 이상된 방문자로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'sco_date <=' => $criterion,
);
$log_count = $this->Stat_count_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day')
. '일 이상된 방문자로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day')
. '일 이상된 방문자로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'visitlog');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>로그인로그삭제 페이지입니다
*/
public function loginlog()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_loginlog';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model('Member_login_log_model');
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'mll_datetime <=' => $this->input->post('criterion'),
);
$this->Member_login_log_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 '
. $this->input->post('day') . '일 이상된 로그인로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'mll_datetime <=' => $criterion,
);
$log_count = $this->Member_login_log_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day')
. '일 이상된 로그인로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 로그인로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'loginlog');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>파일다운로드로그삭제 페이지입니다
*/
public function filedownloadlog()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_filedownloadlog';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model('Post_file_download_log_model');
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'pfd_datetime <=' => $this->input->post('criterion'),
);
$this->Post_file_download_log_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 '
. $this->input->post('day') . '일 이상된 파일 다운로드 로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'pfd_datetime <=' => $criterion,
);
$log_count = $this->Post_file_download_log_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 파일 다운로드 로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 파일 다운로드 로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'filedownloadlog');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>게시물변경로그삭제 페이지입니다
*/
public function posthistory()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_posthistory';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model('Post_history_model');
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'phi_datetime <=' => $this->input->post('criterion'),
);
$this->Post_history_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 ' . $this->input->post('day') . '일 이상된 게시물변경로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'phi_datetime <=' => $criterion,
);
$log_count = $this->Post_history_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 게시물변경로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 게시물변경로그로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'posthistory');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>링크클릭로그 삭제 페이지입니다
*/
public function linkclicklog()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_linkclicklog';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model('Post_link_click_log_model');
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'plc_datetime <=' => $this->input->post('criterion'),
);
$this->Post_link_click_log_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 ' . $this->input->post('day') . '일 이상된 링크클릭로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'plc_datetime <=' => $criterion,
);
$log_count = $this->Post_link_click_log_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 링크클릭로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 링크클릭로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'linkclicklog');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>오래된쪽지삭제 페이지입니다
*/
public function note()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_note';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$this->load->model('Note_model');
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'nte_datetime <=' => $this->input->post('criterion')
);
$this->Note_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 ' . $this->input->post('day') . '일 이상된 쪽지가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'nte_datetime <=' => $criterion,
);
$log_count = $this->Note_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 쪽지가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 쪽지가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'note');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
/**
* 오래된로그 삭제>자동로그인로그삭제 페이지입니다
*/
public function autologin()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_config_cleanlog_autologin';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(
array(
'field' => 'day',
'label' => '기간',
'rules' => 'trim|required|numeric|is_natural',
),
);
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
$this->load->model('Autologin_model');
if ($this->input->post('criterion') && $this->input->post('day')) {
$deletewhere = array(
'aul_datetime <=' => $this->input->post('criterion'),
);
$this->Autologin_model->delete_where($deletewhere);
$view['view']['alert_message'] = '총 ' . number_format($this->input->post('log_count')) . ' 건의 ' . $this->input->post('day') . '일 이상된 자동로그인로그가 모두 삭제되었습니다';
} else {
$criterion = cdate('Y-m-d H:i:s', ctimestamp() - $this->input->post('day') * 24 * 60 * 60);
$countwhere = array(
'aul_datetime <=' => $criterion,
);
$log_count = $this->Autologin_model->count_by($countwhere);
$view['view']['criterion'] = $criterion;
$view['view']['day'] = $this->input->post('day');
$view['view']['log_count'] = $log_count;
if ($log_count > 0) {
$view['view']['msg'] = '총 ' . number_format($log_count) . ' 건의 ' . $this->input->post('day') . '일 이상된 자동로그인로그가 발견되었습니다. 이를 모두 삭제하시겠습니까?';
} else {
$view['view']['alert_message'] = $this->input->post('day') . '일 이상된 자동로그인로그가 발견되지 않았습니다';
}
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'autologin');
$view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
$this->data = $view;
$this->layout = element('layout_skin_file', element('layout', $view));
$this->view = element('view_skin_file', element('layout', $view));
}
}