Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vmusicchart-cms
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Phạm Văn Đoan
vmusicchart-cms
Commits
990e1aa8
Commit
990e1aa8
authored
Sep 14, 2020
by
Phạm Văn Đoan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thêm chức năng xem log crontjob
parent
01058cae
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
178 additions
and
1 deletion
+178
-1
config.php
application/config/config.php
+1
-1
CmsSetting.php
application/controllers/backend/CmsSetting.php
+33
-0
Crontjob_model.php
application/models/Crontjob_model.php
+45
-0
admin_template_view.php
application/views/backend/admin_template_view.php
+7
-0
log_crontjob_view.php
...tion/views/backend/ajax/cms_setting/log_crontjob_view.php
+28
-0
log_crontjob_view.php
.../views/backend/cms_setting/crontjob/log_crontjob_view.php
+64
-0
No files found.
application/config/config.php
View file @
990e1aa8
...
...
@@ -416,8 +416,8 @@ $config['csrf_exclude_uris'] = array(
'backend/cmsSetting/listGroupAjax'
,
'backend/cmsSetting/listUserAdminAjax'
,
'backend/cmsSetting/logUserAjax'
,
'backend/cmsSetting/logUserAjax'
,
'backend/cmsSetting/logActionAjax'
,
'backend/cmsSetting/logCrontjobAjax'
,
'backend/cmsSetting/overlapRankingAjax'
,
...
...
application/controllers/backend/CmsSetting.php
View file @
990e1aa8
...
...
@@ -1829,6 +1829,39 @@ class CmsSetting extends CI_Controller
$this
->
load
->
view
(
'backend/ajax/cms_setting/overlap_ranking_view'
,
$data
);
}
/**
* ----------------------------------------------------------------------------------------------------------------
* Log
*/
public
function
logCrontjob
()
{
$this
->
_data
[
'functionName'
]
=
'Log crontjob'
;
$this
->
_data
[
'action'
]
=
__FUNCTION__
;
$this
->
_data
[
'titlePage'
]
=
'Log crontjob'
;
$this
->
_data
[
'loadPage'
]
=
'backend/cms_setting/crontjob/log_crontjob_view'
;
$this
->
load
->
view
(
'backend/admin_template_view'
,
$this
->
_data
);
}
public
function
logCrontjobAjax
()
{
$this
->
load
->
model
(
'crontjob_model'
);
//
$data
=
array
();
$fByName
=
$this
->
input
->
post
(
'fByName'
);
$pageId
=
$this
->
input
->
post
(
'pageId'
);
//
$pageId
=
(
$pageId
==
0
)
?
1
:
$pageId
;
//
$limit
=
30
;
$offset
=
(
$pageId
-
1
)
*
$limit
;
$data
[
'offset'
]
=
(
$pageId
-
1
)
*
$limit
;
$totalRecord
=
$this
->
crontjob_model
->
cmsCountAll
(
$fByName
);
$data
[
'pagination'
]
=
MyHelper
::
genPaginationLink
(
$totalRecord
,
$limit
,
$pageId
);
$data
[
'listData'
]
=
$this
->
crontjob_model
->
cmsGetPagination
(
$limit
,
$offset
,
$fByName
);
//
$this
->
load
->
view
(
'backend/ajax/cms_setting/log_crontjob_view'
,
$data
);
}
...
...
application/models/Crontjob_model.php
0 → 100644
View file @
990e1aa8
<?php
if
(
!
defined
(
'BASEPATH'
))
exit
(
'No direct script access allowed'
);
class
Crontjob_model
extends
CI_Model
{
protected
$_table
=
TABLE_CRONTJOBS
;
public
function
__construct
()
{
parent
::
__construct
();
date_default_timezone_set
(
"Asia/Ho_Chi_Minh"
);
}
public
function
cmsCountAll
(
$name
=
null
)
{
$this
->
db
->
select
(
'COUNT(*) AS totalResults'
);
$this
->
db
->
from
(
$this
->
_table
);
if
(
$name
!=
null
)
{
$this
->
db
->
like
(
$this
->
_table
.
'.message'
,
$name
,
'both'
);
}
$query
=
$this
->
db
->
get
();
$result
=
$query
->
result_array
();
if
(
$result
)
{
return
$result
[
0
][
'totalResults'
];
}
else
{
return
0
;
}
}
public
function
cmsGetPagination
(
$record
,
$start
,
$name
=
null
)
{
$this
->
db
->
select
(
'*'
);
$this
->
db
->
from
(
$this
->
_table
);
if
(
$name
!=
null
)
{
$this
->
db
->
like
(
$this
->
_table
.
'.message'
,
$name
,
'both'
);
}
$this
->
db
->
order_by
(
$this
->
_table
.
'.id'
,
'desc'
);
$this
->
db
->
limit
(
$record
,
$start
);
$query
=
$this
->
db
->
get
();
return
$query
->
result_array
();
}
}
/* End of file welcome.php */
\ No newline at end of file
application/views/backend/admin_template_view.php
View file @
990e1aa8
...
...
@@ -278,6 +278,13 @@ $action = $CI->router->fetch_method();
<b
class=
"arrow"
></b>
</li>
<li
class=
"
<?php
if
(
$action
&&
$action
==
'logCrontjob'
)
echo
'active'
?>
"
>
<a
href=
"
<?php
echo
base_url
()
.
'backend/cmsSetting/logCrontjob'
;
?>
"
>
<i
class=
"menu-icon fa fa-caret-right"
></i>
Log crontjob
</a>
<b
class=
"arrow"
></b>
</li>
<li
class=
"
<?php
if
(
$action
&&
$action
==
'logUser'
)
echo
'active'
?>
"
>
<a
href=
"
<?php
echo
base_url
()
.
'backend/cmsSetting/logUser'
;
?>
"
>
<i
class=
"menu-icon fa fa-caret-right"
></i>
Log nhập, xuất
...
...
application/views/backend/ajax/cms_setting/log_crontjob_view.php
0 → 100644
View file @
990e1aa8
<div>
<table
class=
"table table-striped table-bordered table-hover"
>
<thead>
<tr>
<th
style=
"text-align: center"
>
STT
</th>
<th
style=
"text-align: center"
>
Nội dung log
</th>
<th
style=
"text-align: center"
>
Thời gian chạy
</th>
</tr>
</thead>
<tbody>
<?php
if
(
count
(
$listData
)
>
0
)
:
foreach
(
$listData
as
$key
=>
$data
)
:
?>
<tr>
<td
style=
"text-align: center"
>
<?php
echo
(
$key
+
1
+
$offset
);
?>
</td>
<td
style=
"text-align: left"
>
<?php
echo
$data
[
'message'
];
?>
</td>
<td
style=
"text-align: center"
>
<?php
echo
MyHelper
::
reFormatDate
(
$data
[
'created_at'
]);
?>
</td>
</tr>
<?php
endforeach
;
?>
<?php
else
:
?>
<tr>
<td
colspan=
"5"
style=
"color: red; font-style: italic"
>
Không có dữ liệu nào!
</td>
</tr>
<?php
endif
;
?>
</tbody>
</table>
</div>
<!-- /.row -->
<div
style=
"text-align: center;"
>
<?php
echo
$pagination
;
?>
</div>
\ No newline at end of file
application/views/backend/cms_setting/crontjob/log_crontjob_view.php
0 → 100644
View file @
990e1aa8
<!-- Thông báo lỗi -->
<?php
MyHelper
::
loadView
(
'backend/cms_partials/error_message_view'
)
?>
<div
class=
"row"
>
<div
style=
"text-align: center"
id=
"data-loading"
>
<i
class=
"fa fa-refresh fa-spin bigger-200"
></i>
Đang tải dữ liệu...
</div>
<div
class=
"col-lg-12"
>
<div
id=
"div-response"
></div>
</div>
</div>
<script
type=
"text/javascript"
>
//Thuc hien viec ve bieu do$data
$
(
document
).
ready
(
function
()
{
var
url
=
'
<?php
echo
base_url
(
"backend/cmsSetting/logCrontjobAjax"
);
?>
'
;
// Tìm kiếm theo cú pháp
var
oldTimeout2
=
''
;
$
(
'#input-date-picker'
).
change
(
function
(){
clearTimeout
(
oldTimeout2
);
oldTimeout2
=
setTimeout
(
function
(){
//loadDataByAjaxFromInput(url);
},
250
);
});
// Xóa bộ lọc
$
(
'#delete-filter'
).
click
(
function
(){
$
(
"#input-date-picker"
).
val
(
'
<?php
echo
date
(
'd/m/Y'
,
time
()
-
86400
)
?>
'
);
changePagination
(
'0'
);
return
false
;
});
changePagination
(
'0'
);
});
function
changePagination
(
pageId
)
{
$
(
'#data-loading'
).
show
();
var
url
=
'
<?php
echo
base_url
(
"backend/cmsSetting/logCrontjobAjax"
);
?>
'
;
callAjax
(
pageId
,
url
);
}
function
callAjax
(
pageId
,
url
)
{
var
csrf_value
=
'
<?php
echo
$this
->
security
->
get_csrf_hash
();
?>
'
;
var
fByName
=
$
(
"#input-date-picker"
).
val
();
var
dataReq
=
{
csrf_name
:
csrf_value
,
fByName
:
fByName
,
pageId
:
pageId
};
//Ajax
$
.
ajax
({
type
:
"POST"
,
url
:
url
,
data
:
dataReq
,
dataType
:
"text"
,
cache
:
false
,
success
:
function
(
data
)
{
$
(
'#div-response'
).
html
(
data
);
$
(
'#data-loading'
).
hide
();
}
});
}
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment