Commit f6124c8d by Phạm Văn Đoan

fixbug quản lý log: bỏ action và fix lọc + tìm kiếm

parent 033d243d
......@@ -1280,6 +1280,7 @@ class CmsSetting extends CI_Controller
//
$data = array();
$filterByAccount = $this->input->post('filterByAccount');
$filterByActionType = $this->input->post('filterByActionType');
$pageId = $this->input->post('pageId');
//
$pageId = ($pageId == 0) ? 1 : $pageId;
......@@ -1287,9 +1288,10 @@ class CmsSetting extends CI_Controller
$limit = 20;
$offset = ($pageId - 1)*$limit;
$data['offset'] = ($pageId - 1)*$limit;
$totalRecord = $this->actionlog_model->countAll($filterByAccount);
$totalRecord = $this->actionlog_model->countAll(null, null, null, $filterByAccount, $filterByActionType);
$data['pagination'] = MyHelper::genPaginationLink($totalRecord, $limit, $pageId);
$data['listData'] = $this->actionlog_model->getPagination($limit, $offset, $filterByAccount);
//getPagination($record, $start, $dtFrom=NULL, $dtTo=NULL, $filterByIP=NULL, $filterByAccount=NULL, $filterByActionType=NULL)
$data['listData'] = $this->actionlog_model->getPagination($limit, $offset, null, null, null, $filterByAccount, $filterByActionType);
//
$this->load->view('backend/ajax/cms_setting/log_action_view', $data);
}
......
......@@ -136,7 +136,7 @@ class CmsTrack extends CI_Controller
$this->track_model->update_track_user($track_id, $id_singer, $id_user, $active_singer);
// Ghi log
$this->actionlog_model->add('UPDATED', 'Cập nhật bài hát.', 'Actionlog_model', 'action_log', $track_id);
$this->actionlog_model->add('UPDATED', 'Cập nhật bài hát.', 'Actionlog_model', 'tracks', $track_id);
$this->session->set_flashdata('success', 'Cập nhật bài hát thành công');
redirect(base_url('backend/cmsTrack/showTrack/'.$track_id));
......@@ -243,7 +243,7 @@ class CmsTrack extends CI_Controller
$this->track_model->add_artist($artist, $insert_id);
}
// Ghi log
// $this->mactionlog->add('UPDATED', 'Cập nhật Cuộc đua thành công!', 'Mactionlog', 'action_log', $contest_id);
// $this->mactionlog->add('UPDATED', 'Cập nhật Cuộc đua thành công!', 'Mactionlog', 'tracks', $contest_id);
//
$this->session->set_flashdata('success', 'Tạo Bài hát thành công');
}else{
......@@ -251,7 +251,7 @@ class CmsTrack extends CI_Controller
}
// Ghi log
$this->actionlog_model->add('ADDED', 'Thêm mới bài hát.', 'Actionlog_model', 'action_log', null);
$this->actionlog_model->add('ADDED', 'Thêm mới bài hát.', 'Actionlog_model', 'tracks', null);
redirect(base_url('backend/cmsTrack/listTrack'));
}
......@@ -293,7 +293,7 @@ class CmsTrack extends CI_Controller
$this->session->set_flashdata('success', 'Thêm ca sĩ vào bài hát thành công');
// Ghi log
$this->actionlog_model->add('ADDED', 'Thêm mới Ca sĩ cho bài hát.', 'Actionlog_model', 'action_log', $track_id);
$this->actionlog_model->add('ADDED', 'Thêm mới Ca sĩ cho bài hát.', 'Actionlog_model', 'tracks', $track_id);
redirect(base_url('backend/cmsTrack/showTrack/'.$track_id));
}
......@@ -313,7 +313,7 @@ class CmsTrack extends CI_Controller
$this->track_model->removeSinger($track_id, $singer_id);
// Ghi log
$this->actionlog_model->add('DELETED', 'Xóa Ca sĩ khỏi bài hát.', 'Actionlog_model', 'action_log', $track_id);
$this->actionlog_model->add('DELETED', 'Xóa Ca sĩ khỏi bài hát.', 'Actionlog_model', 'tracks', $track_id);
redirect(base_url('backend/cmsTrack/showTrack/'.$track_id));
}
......@@ -354,7 +354,7 @@ class CmsTrack extends CI_Controller
$this->session->set_flashdata('success', 'Thêm Nhạc sĩ vào bài hát thành công');
// Ghi log
$this->actionlog_model->add('ADDED', 'Thêm Nhạc sĩ cho bài hát.', 'Actionlog_model', 'action_log', $track_id);
$this->actionlog_model->add('ADDED', 'Thêm Nhạc sĩ cho bài hát.', 'Actionlog_model', 'tracks', $track_id);
redirect(base_url('backend/cmsTrack/showTrack/'.$track_id));
}
......
......@@ -50,15 +50,15 @@ class Actionlog_model extends CI_Model {
return $query->result_array();
}
public function countAll($dtFrom=NULL, $dtTo=NULL, $filterByIP=NULL, $filterByAccount=NULL, $filterByActionType=NULL){
public function countAll($dtFrom=null, $dtTo=null, $filterByIP=null, $filterByAccount=null, $filterByActionType=null){
$this->db->select('COUNT(*) AS totalResults');
$this->db->from($this->_table);
if($dtFrom != NULL){$this->db->where('DATE(created_at) >=', $dtFrom);}
if($dtTo != NULL){$this->db->where('DATE(created_at) <=', $dtTo);}
if($filterByIP != NULL){$this->db->like('ip_address', $filterByIP);}
if($filterByAccount != NULL){$this->db->like('actor_name', $filterByAccount);}
if($filterByActionType != NULL){$this->db->where('UPPER(action)', $filterByActionType);}
if($dtFrom != null){$this->db->where('DATE(created_at) >=', $dtFrom);}
if($dtTo != null){$this->db->where('DATE(created_at) <=', $dtTo);}
if($filterByIP != null){$this->db->like('ip_address', $filterByIP);}
if($filterByAccount != null){$this->db->like('actor_name', $filterByAccount);}
if($filterByActionType != null){$this->db->where('UPPER(action)', $filterByActionType);}
$query = $this->db->get();
$result = $query->result_array();
......@@ -69,15 +69,15 @@ class Actionlog_model extends CI_Model {
}
}
public function getPagination($record, $start, $dtFrom=NULL, $dtTo=NULL, $filterByIP=NULL, $filterByAccount=NULL, $filterByActionType=NULL){
public function getPagination($record, $start, $dtFrom=null, $dtTo=null, $filterByIP=null, $filterByAccount=null, $filterByActionType=null){
$this->db->select($this->_table.'.*');
$this->db->from($this->_table);
if($dtFrom != NULL){$this->db->where('DATE(created_at) >=', $dtFrom);}
if($dtTo != NULL){$this->db->where('DATE(created_at) <=', $dtTo);}
if($filterByIP != NULL){$this->db->like('ip_address', $filterByIP);}
if($filterByAccount != NULL){$this->db->like('actor_name', $filterByAccount);}
if($filterByActionType != NULL){$this->db->where('UPPER(action)', $filterByActionType);}
if($dtFrom != null){$this->db->where('DATE(created_at) >=', $dtFrom);}
if($dtTo != null){$this->db->where('DATE(created_at) <=', $dtTo);}
if($filterByIP != null){$this->db->like('ip_address', $filterByIP);}
if($filterByAccount != null){$this->db->like('actor_name', $filterByAccount);}
if($filterByActionType != null){$this->db->where('UPPER(action)', $filterByActionType);}
$this->db->order_by($this->_table.'.id', 'desc');
$this->db->limit($record, $start);
......
......@@ -11,7 +11,6 @@
<th style="text-align: center">ID bản ghi</th>
<th style="text-align: center">IP</th>
<th style="text-align: center">Ngày tạo</th>
<th style="text-align: center">Xử lý</th>
</tr>
</thead>
<tbody>
......@@ -32,14 +31,6 @@
<td style="text-align: center">
<?php echo MyHelper::reFormatDate($data['created_at']); ?>
</td>
<td style="text-align: center">
<?php if((time() - strtotime($data['created_at'])) > 15*24*3600): ?>
<a href="<?php echo base_url().'dcvsetting/deleteLogAction/'.$data['id']; ?>"
onclick="return confirm('Bạn có chắc chắn muốn xóa không?')" title="Xóa">
<i class="ace-icon red fa fa-trash-o bigger-130"></i>
</a>
<?php else: echo 'Xóa sau '.(15-(gmdate('d', time()-strtotime($data['created_at'])))).' ngày'; endif;?>
</td>
</tr>
<?php
endforeach;
......
......@@ -100,7 +100,7 @@
clearTimeout(oldTimeout);
oldTimeout = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 1000);
}, 250);
});
// Tìm kiếm theo cú pháp
var oldTimeout2 = '';
......@@ -108,7 +108,7 @@
clearTimeout(oldTimeout2);
oldTimeout2 = setTimeout(function(){
loadDataByAjaxFromInput(url);
}, 1000);
}, 250);
});
// Tìm kiếm theo kênh
loadDataByAjaxFromSelectBox("select-action-type", url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment