MDL-29030 make admin reports general reports

AMOS BEGIN
 CPY [pluginname,coursereport_log],[pluginname,report_log]
 CPY [pluginname,coursereport_stats],[pluginname,report_stats]
AMOS END
This commit is contained in:
Petr Skoda
2011-11-06 12:22:45 +01:00
parent 2a1ce6a8ed
commit e30cc24c0d
32 changed files with 161 additions and 39 deletions
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportconfiglog', get_string('configlog', 'report_configlog'), "$CFG->wwwroot/$CFG->admin/report/configlog/index.php"));
-5
View File
@@ -1,5 +0,0 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportsecurity', get_string('pluginname', 'report_security'), "$CFG->wwwroot/$CFG->admin/report/security/index.php",'report/security:view'));
+14 -10
View File
@@ -454,25 +454,29 @@ if ($hassiteconfig) {
$ADMIN->add('coursereports', $page);
}
}
unset($pages);
}
// Now add reports
$pages = array();
foreach (get_plugin_list('report') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('report' . $report,
get_string('pluginname', 'report_' . $report), 'moodle/site:config');
include($settings_path);
continue;
if ($settings) {
$pages[] = $settings;
}
}
$index_path = "$plugindir/index.php";
if (!file_exists($index_path)) {
continue;
}
// old style 3rd party plugin without settings.php
$www_path = "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php";
$reportname = get_string($plugin, 'report_' . $plugin);
$ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports'));
}
if (!empty($pages)) {
$ADMIN->add('modules', new admin_category('reports', get_string('reports')));
foreach ($pages as $page) {
$ADMIN->add('reports', $page);
}
}
unset($pages);
// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
+1 -1
View File
@@ -7348,7 +7348,7 @@ function get_plugin_types($fullpaths=true) {
'editor' => 'lib/editor',
'format' => 'course/format',
'profilefield' => 'user/profile/field',
'report' => $CFG->admin.'/report',
'report' => 'report',
'coursereport' => 'course/report', // must be after system reports
'gradeexport' => 'grade/export',
'gradeimport' => 'grade/import',
@@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../../config.php');
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/backup/lib.php');
+26
View File
@@ -0,0 +1,26 @@
<?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/>.
/**
* Strings for component 'report_backups'
*
* @package report
* @subpackage backups
* @copyright 2011 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Backups report';
@@ -25,4 +25,7 @@
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportbackups', get_string('backups', 'admin'), "$CFG->wwwroot/$CFG->admin/report/backups/index.php",'moodle/backup:backupcourse'));
$ADMIN->add('reports', new admin_externalpage('reportbackups', get_string('backups', 'admin'), "$CFG->wwwroot/report/backups/index.php",'moodle/backup:backupcourse'));
// no report settings
$settings = null;
@@ -1,6 +1,6 @@
<?php
require_once(dirname(__FILE__).'/../../../config.php');
require_once(dirname(__FILE__).'/../../config.php');
require_once($CFG->libdir.'/adminlib.php');
// page parameters
@@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -26,6 +25,7 @@
$string['configlog'] = 'Config changes';
$string['oldvalue'] = 'Original value';
$string['plugin'] = 'Plugin';
$string['pluginname'] = 'Config changes';
$string['setting'] = 'Setting';
$string['timemodified'] = 'Date';
$string['value'] = 'New value';
+8
View File
@@ -0,0 +1,8 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportconfiglog', get_string('configlog', 'report_configlog'), "$CFG->wwwroot/report/configlog/index.php"));
// no report settings
$settings = null;
@@ -1,6 +1,6 @@
<?php
require_once('../../../config.php');
require_once('../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->libdir.'/adminlib.php');
@@ -90,7 +90,7 @@
if (empty($CFG->gdversion)) {
echo '<div class="graph">(' . get_string("gdneed") .')</div>';
} else {
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
echo '<div class="graph"><img alt="'.get_string('courseoverviewgraph').'" src="'.$CFG->wwwroot.'/report/courseoverview/reportsgraph.php?time='.$time.'&report='.$report.'&numcourses='.$numcourses.'" /></div>';
}
$table = new html_table();
@@ -1,6 +1,6 @@
<?php
require_once('../../../config.php');
require_once('../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/lib/graphlib.php');
@@ -30,7 +30,7 @@
$courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
if (empty($courses)) {
$PAGE->set_url('/admin/report/courseoverview/index.php');
$PAGE->set_url('/report/courseoverview/index.php');
print_error('statsnodata', 'error', $PAGE->url->out());
}
@@ -2,4 +2,7 @@
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('pluginname', 'report_courseoverview'), "$CFG->wwwroot/$CFG->admin/report/courseoverview/index.php",'report/courseoverview:view'));
$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('pluginname', 'report_courseoverview'), "$CFG->wwwroot/report/courseoverview/index.php",'report/courseoverview:view'));
// no report settings
$settings = null;
+26
View File
@@ -0,0 +1,26 @@
<?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/>.
/**
* Strings for component 'report_log'
*
* @package report
* @subpackage log
* @copyright 2011 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Logs';
@@ -5,3 +5,6 @@ defined('MOODLE_INTERNAL') || die;
// just a link to course report
$ADMIN->add('reports', new admin_externalpage('reportlog', get_string('log', 'admin'), "$CFG->wwwroot/course/report/log/index.php?id=".SITEID, 'coursereport/log:view'));
$ADMIN->add('reports', new admin_externalpage('reportloglive', get_string('loglive', 'coursereport_log'), "$CFG->wwwroot/course/report/log/indexlive.php?id=".SITEID, 'coursereport/log:viewlive'));
// no report settings
$settings = null;
@@ -7,7 +7,7 @@
*/
/** */
require_once(dirname(__FILE__).'/../../../config.php');
require_once(dirname(__FILE__).'/../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/questionlib.php');
@@ -2,4 +2,7 @@
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('pluginname', 'report_questioninstances'), "$CFG->wwwroot/$CFG->admin/report/questioninstances/index.php", 'report/questioninstances:view'));
$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('pluginname', 'report_questioninstances'), "$CFG->wwwroot/report/questioninstances/index.php", 'report/questioninstances:view'));
// no report settings
$settings = null;
@@ -25,8 +25,8 @@
define('NO_OUTPUT_BUFFERING', true);
require_once('../../../config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/security/lib.php');
require_once('../../config.php');
require_once($CFG->dirroot.'/report/security/lib.php');
require_once($CFG->libdir.'/adminlib.php');
require_login();
@@ -69,7 +69,7 @@ $statusarr = array(REPORT_SECURITY_OK => $strok,
REPORT_SECURITY_SERIOUS => $strserious,
REPORT_SECURITY_CRITICAL => $strcritical);
$url = "$CFG->wwwroot/$CFG->admin/report/security/index.php";
$url = "$CFG->wwwroot/report/security/index.php";
if ($issue and ($result = $issue(true))) {
report_security_hide_timearning();
@@ -88,7 +88,7 @@ if ($issue and ($result = $issue(true))) {
$row[2] = $result->info;
$row[3] = is_null($result->link) ? '&nbsp;' : $result->link;
$PAGE->set_docs_path('admin/report/security/' . $issue);
$PAGE->set_docs_path('report/security/' . $issue);
$table->data[] = $row;
@@ -752,7 +752,7 @@ function report_security_check_riskadmin($detailed=false) {
$url = "$CFG->wwwroot/user/view.php?id=$user->id";
$admins[$uid] = '<li><a href="'.$url.'">'.fullname($user).' ('.$user->email.')</a></li>';
}
$admins = '<ul>'.implode($admins).'</ul>';
$admins = '<ul>'.implode('', $admins).'</ul>';
}
$result->status = REPORT_SECURITY_OK;
@@ -856,7 +856,7 @@ function report_security_check_riskbackup($detailed=false) {
$role->url = "$CFG->wwwroot/$CFG->admin/roles/override.php?contextid=$role->contextid&amp;roleid=$role->id";
$links[] = '<li>'.get_string('check_riskbackup_editoverride', 'report_security', $role).'</li>';
}
$links = '<ul>'.implode($links).'</ul>';
$links = '<ul>'.implode('', $links).'</ul>';
$result->details .= get_string('check_riskbackup_details_overriddenroles', 'report_security', $links);
}
@@ -874,7 +874,7 @@ function report_security_check_riskbackup($detailed=false) {
$users[] = '<li>'.get_string('check_riskbackup_unassign', 'report_security', $a).'</li>';
}
if (!empty($users)) {
$users = '<ul>'.implode($users).'</ul>';
$users = '<ul>'.implode('', $users).'</ul>';
$result->details .= get_string('check_riskbackup_details_users', 'report_security', $users);
}
}
+8
View File
@@ -0,0 +1,8 @@
<?php
defined('MOODLE_INTERNAL') || die;
$ADMIN->add('reports', new admin_externalpage('reportsecurity', get_string('pluginname', 'report_security'), "$CFG->wwwroot/report/security/index.php",'report/security:view'));
// no report settings
$settings = null;
+26
View File
@@ -0,0 +1,26 @@
<?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/>.
/**
* Strings for component 'report_stats'
*
* @package report
* @subpackage stats
* @copyright 2011 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Statistics';
@@ -4,3 +4,6 @@ defined('MOODLE_INTERNAL') || die;
// just a link to course report
$ADMIN->add('reports', new admin_externalpage('reportstats', get_string('stats', 'admin'), "$CFG->wwwroot/course/report/stats/index.php", 'coursereport/stats:view'));
// no report settings
$settings = null;
+19
View File
@@ -0,0 +1,19 @@
This files describes API changes in /report/* - plugins,
information provided here is intended especially for developers.
=== 2.2 ===
API changes:
* reports were moved from /admin/report/ to /report/
* new support for report settings
How to migrate old admin reports:
# copy all files to new /report/yourplugin/ location
# if settings.php exists add $settings=null;
# if settings.php does not exist create it and link the report, index.php is not linked automatically any more
# update require('../../config.php'); - remove one ../
# update all links to report pages by removing /admin/ or /$CFG->admin/
# add language pack with at least pluginname string