Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
vanisha
/
log
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
497a3564
authored
2023-06-01 16:32:15 +0530
by
vanisha
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
table generation
1 parent
dc218ee6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
templates/cron_logs_view.mustache
view.php
templates/cron_logs_view.mustache
View file @
497a356
...
...
@@ -19,13 +19,12 @@
<div
class=
"container"
>
<table
id=
"view_logs_entries_table"
class=
"compact table table-bordered table-striped table-hover"
>
<thead><tr><th
class=
"center-class"
>
Sno
</th><th
class=
"center-class"
>
Cron file
</th><th
class=
"center-class"
>
Cron
timing
</th><th
class=
"center-class"
>
Cron
log
</th></tr></thead>
<thead><tr><th
class=
"center-class"
>
Sno
</th><th
class=
"center-class"
>
Cron file
</th><th
class=
"center-class"
>
Cron log
</th></tr></thead>
<tbody>
{{#
tablecontents
}}
<tr>
<td
class=
"center-class"
>
{{
sno
}}
</td>
<td
class=
"center-class"
>
{{{
name
}}}
</td>
<td>
{{{
time
}}}
</td>
<td
class=
"center-class"
>
{{
log
}}
</td>
</tr>
{{/
tablecontents
}}
...
...
view.php
View file @
497a356
...
...
@@ -42,6 +42,7 @@ $PAGE->set_heading($pluginname);
echo
$OUTPUT
->
header
();
$date
=
date
(
'd-m-y'
);
$templatecontext
=
array
();
...
...
@@ -53,7 +54,24 @@ $configpaths = get_config('block_log', 'block_log_path_info');
$isadmin
=
has_capability
(
'block/log:manageall'
,
context_system
::
instance
());
if
(
$isadmin
)
{
$templatecontext
[
'tablecontents'
]
=
''
;
$table_content_array
=
array
();
$i
=
1
;
$split_paths
=
explode
(
","
,
$configpaths
);
foreach
(
$split_paths
as
$split_path
)
{
$files
=
scandir
(
$split_path
);
foreach
(
$files
as
$file
)
{
if
(
$file
===
'.'
||
$file
===
'..'
)
{
continue
;}
if
(
(
str_contains
(
$file
,
$date
))
&&
(
str_contains
(
$file
,
'.log'
)))
{
$array
=
array
();
$array
[
'sno'
]
=
$i
;
$array
[
'name'
]
=
$file
;
$array
[
'log'
]
=
file_get_contents
(
$split_path
.
'/'
.
$file
);
$table_content_array
[]
=
$array
;
}
}
}
$templatecontext
[
'tablecontents'
]
=
$table_content_array
;
echo
$OUTPUT
->
render_from_template
(
'block_log/cron_logs_view'
,
$templatecontext
);
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment