0742377e by vanisha

files added.

0 parents
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class block_log extends block_base {
public function init() {
$this->title = get_string('pluginname', 'block_fn_mentor');
}
public function specialization() {
$isadmin = has_capability('block/log:manageall', context_system::instance());
if($isadmin) {
$this->title = get_string('pluginname', 'block_log');
}
}
public function get_content() {
global $CFG;
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
$this->content->text = '';
$this->content->text = 'This block shows all cron entries logs.';
$isadmin = has_capability('block/log:manageall', context_system::instance());
if($isadmin) {
$this->content->text .= '<br><div><a href="'.$CFG->wwwroot.'/blocks/log/view.php">View cron logs</a></div>';
}
return $this->content;
}
public function applicable_formats() {
return array(
'all' => false,
'site' => true,
'course-*' => false,
'my' => true
);
}
public function instance_allow_multiple() {
return false;
}
public function has_config() {
return true;
}
}
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'block/log:myaddinstance' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW,
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/my:manageblocks'
),
'block/log:addinstance' => array(
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
'block/log:manageall' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
)
)
);
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Cron entry logs view';
$string['title'] = 'Cron log path';
$string['block_log_path_info_head'] = 'Paths';
$string['block_log_path_info_desc'] = 'Provide log paths separated by commas, where the log files should be taken.';
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$settings->add(
new admin_setting_heading('title', get_string('terminology', 'block_fn_mentor'), '')
);
$settings->add(
new admin_setting_configtext('block_log_path_info',
get_string('block_log_path_info_head', 'block_log'),
get_string('block_log_path_info_desc', 'block_log'),
"/var/log, /var/log/foldername",PARAM_TEXT));
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
<div class="container">
<div class="cardtitle">
<p class="banner-title mb-0 pb-0 bold">Cron logs view</p>
<p class="dasboard_margin">It shows all cron entries that should be ran today. We can fliter the cron details based on the date filter</p>
</div>
</div>
<div class="container">
<div class="input-group mb-3">
<div class="input-group-prepend" style="display: block;padding: 10px;text-align: justify;width: 25em;">
<label for="date_filter">Date</label>
<input type="date" id="date_filter" class="form-control" aria-label="Default" aria-describedby="date_filter">
</div>
</div>
</div>
<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>
<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}}
{{^tablecontents}}
<tr><td colspan="4"><center>No cron files were run today!!!</center></td></tr>
{{/tablecontents}}
</tbody>
</table>
</div>
<script>
$('#view_logs_entries_table').dataTable({
"pageLength": 30,
"lengthChange": false,
lengthMenu: [[30, 50, 100], [30, 50, 100]]
});
</script>
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2023060101;
$plugin->requires = 2015111600;
$plugin->component = 'block_log';
$plugin->cron = 30;
$plugin->release = '3.3.0';
$plugin->maturity = MATURITY_STABLE;
\ No newline at end of file
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Log block caps.
*
* @package block_log
* @copyright Vanisha <vanisha@teknoturf.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_login(null, false);
global $PAGE,$OUTPUT,$CFG;
$pluginname = get_string('pluginname', 'block_fn_mentor');
$thispageurl = new moodle_url('/blocks/log/view.php');
$PAGE->set_url($thispageurl);
$contextsystem = context_system::instance();
$PAGE->set_context($contextsystem);
$PAGE->navbar->add($pluginname);
$PAGE->set_title($pluginname);
$PAGE->set_heading($pluginname);
echo $OUTPUT->header();
$templatecontext = array();
// breadcrumb template
$templatecontext['breadcrumb_navbar'] = $OUTPUT->navbar();
$configpaths = get_config('block_log', 'block_log_path_info');
$isadmin = has_capability('block/log:manageall', context_system::instance());
if($isadmin) {
$templatecontext['tablecontents'] = '';
echo $OUTPUT->render_from_template('block_log/cron_logs_view', $templatecontext);
}
else {
echo '<center><div class="alert alert-info"><b>You cannot view this page.</b></div><center>';
}
echo $OUTPUT->footer();
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!