$return = new moodle_url('/admin/settings.php', array('section'=>'manageenrols'));
+$syscontext = context_system::instance();
+
switch ($action) {
case 'disable':
unset($enabled[$enrol]);
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
+ $syscontext->mark_dirty(); // resets all enrol caches
break;
case 'enable':
$enabled = array_keys($enabled);
$enabled[] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
+ $syscontext->mark_dirty(); // resets all enrol caches
break;
case 'up':
} else { // Delete everything!!
uninstall_plugin('enrol', $enrol);
+ $syscontext->mark_dirty(); // resets all enrol caches
$a->plugin = $strplugin;
$a->directory = "$CFG->dirroot/enrol/$enrol";
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$logurl = $CFG->wwwroot.
- '/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
+ '/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id.
'%2F1&user='.'0'.
'&date=0'.
'&modid=&modaction=0&logformat=showashtml';
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->libdir . '/pluginlib.php');
require_once($CFG->libdir . '/tablelib.php');
// Check permissions.
$thispageurl = new moodle_url('/admin/qbehaviours.php');
$behaviours = get_plugin_list('qbehaviour');
+$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql_menu("
if (!array_key_exists($behaviour, $counts)) {
$counts[$behaviour] = 0;
}
- $needed[$behaviour] = $counts[$behaviour] > 0;
+ $needed[$behaviour] = ($counts[$behaviour] > 0) &&
+ $pluginmanager->other_plugins_that_require('qbehaviour_' . $behaviour);
$archetypal[$behaviour] = question_engine::is_behaviour_archetypal($behaviour);
}
-foreach ($behaviours as $behaviour => $notused) {
- foreach (question_engine::get_behaviour_required_behaviours($behaviour) as $reqbehaviour) {
- $needed[$reqbehaviour] = true;
- }
-}
foreach ($counts as $behaviour => $count) {
if (!array_key_exists($behaviour, $behaviours)) {
$counts['missingtype'] += $count;
}
// Other question types required by this one.
- $requiredbehaviours = question_engine::get_behaviour_required_behaviours($behaviour);
- if (!empty($requiredbehaviours)) {
- $strrequiredbehaviours = array();
- foreach ($requiredbehaviours as $required) {
- $strrequiredbehaviours[] = $sortedbehaviours[$required];
+ $plugin = $pluginmanager->get_plugin_info('qbehaviour_' . $behaviour);
+ $required = $plugin->get_other_required_plugins();
+ if (!empty($required)) {
+ $strrequired = array();
+ foreach ($required as $component => $notused) {
+ $strrequired[] = $pluginmanager->plugin_name($component);
}
- $row[] = implode(', ', $strrequiredbehaviours);
+ $row[] = implode(', ', $strrequired);
} else {
$row[] = '';
}
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->libdir . '/pluginlib.php');
require_once($CFG->libdir . '/tablelib.php');
// Check permissions.
$thispageurl = new moodle_url('/admin/qtypes.php');
$qtypes = question_bank::get_all_qtypes();
+$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
$counts = $DB->get_records_sql("
$counts[$qtypename]->numquestions = 0;
$counts[$qtypename]->numhidden = 0;
}
- $needed[$qtypename] = $counts[$qtypename]->numquestions > 0;
+ $needed[$qtypename] = $counts[$qtypename]->numquestions > 0 ||
+ $pluginmanager->other_plugins_that_require($qtype->plugin_name());
$counts[$qtypename]->numquestions -= $counts[$qtypename]->numhidden;
}
$needed['missingtype'] = true; // The system needs the missing question type.
-foreach ($qtypes as $qtypename => $qtype) {
- foreach ($qtype->requires_qtypes() as $reqtype) {
- $needed[$reqtype] = true;
- }
-}
foreach ($counts as $qtypename => $count) {
if (!isset($qtypes[$qtypename])) {
$counts['missingtype']->numquestions += $count->numquestions - $count->numhidden;
}
// Other question types required by this one.
- $requiredtypes = $qtype->requires_qtypes();
+ $plugin = $pluginmanager->get_plugin_info($qtype->plugin_name());
+ $requiredtypes = $plugin->get_other_required_plugins();
$strtypes = array();
if (!empty($requiredtypes)) {
- foreach ($requiredtypes as $required) {
- $strtypes[] = $qtypes[$required]->local_name();
+ foreach ($requiredtypes as $required => $notused) {
+ $strtypes[] = $pluginmanager->plugin_name($required);
}
$row[] = implode(', ', $strtypes);
} else {
}
$uninstallurl = $plugin->get_uninstall_url();
+ $requriedby = $pluginman->other_plugins_that_require($plugin->component);
if (is_null($uninstallurl)) {
$uninstall = new html_table_cell('');
+ } else if ($requriedby) {
+ $uninstall = new html_table_cell(get_string('requiredby', 'core_plugin', implode(', ', $requriedby)));
+ $uninstall->attributes['class'] = 'requiredby';
} else {
$uninstall = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'));
$uninstall = new html_table_cell($uninstall);
+++ /dev/null
-<?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"));
+++ /dev/null
-<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$capabilities = array(
-
- 'report/courseoverview:view' => array(
- 'riskbitmask' => RISK_PERSONAL,
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'teacher' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'manager' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/site:viewreports',
- )
-);
+++ /dev/null
-<?php
-
- require_once('../../../config.php');
- require_once($CFG->dirroot.'/lib/statslib.php');
- require_once($CFG->libdir.'/adminlib.php');
-
- $report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
- $time = optional_param('time', 0, PARAM_INT);
- $numcourses = optional_param('numcourses', 20, PARAM_INT);
-
- if (empty($CFG->enablestats)) {
- if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
- redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
- } else {
- print_error('statsdisable');
- }
- }
-
- admin_externalpage_setup('reportcourseoverview');
- echo $OUTPUT->header();
-
- $course = get_site();
- stats_check_uptodate($course->id);
-
- $strreports = get_string('reports');
- $strcourseoverview = get_string('courseoverview');
-
- $reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
-
- $earliestday = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_daily}');
- $earliestweek = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_weekly}');
- $earliestmonth = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_monthly}');
-
- if (empty($earliestday)) $earliestday = time();
- if (empty($earliestweek)) $earliestweek = time();
- if (empty($earliestmonth)) $earliestmonth = time();
-
- $now = stats_get_base_daily();
- $lastweekend = stats_get_base_weekly();
- $lastmonthend = stats_get_base_monthly();
-
- $timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
-
- if (empty($timeoptions)) {
- print_error('nostatstodisplay', 'error', $CFG->wwwroot.'/course/view.php?id='.$course->id);
- }
-
- echo '<form action="index.php" method="post">'."\n";
- echo '<div>';
-
- $table = new html_table();
- $table->width = '*';
- $table->align = array('left','left','left','left','left','left');
-
- $reporttypemenu = html_writer::select($reportoptions,'report',$report, false);
- $timeoptionsmenu = html_writer::select($timeoptions,'time',$time, false);
-
- $table->data[] = array(get_string('statsreporttype'),$reporttypemenu,
- get_string('statstimeperiod'),$timeoptionsmenu,
- '<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
- '<input type="submit" value="'.get_string('view').'" />') ;
-
- echo html_writer::table($table);
- echo '</div>';
- echo '</form>';
-
- echo $OUTPUT->heading($reportoptions[$report]);
-
-
- if (!empty($report) && !empty($time)) {
- $param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
- if (!empty($param->sql)) {
- $sql = $param->sql;
- } else {
- $sql = "SELECT courseid,".$param->fields."
- FROM {".'stats_'.$param->table."}
- WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
- GROUP BY courseid
- $param->extras
- ORDER BY $param->orderby";
- }
-
- $courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
-
- if (empty($courses)) {
- echo $OUTPUT->notification(get_string('statsnodata'));
- echo '</td></tr></table>';
-
- } else {
- 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>';
- }
-
- $table = new html_table();
- $table->align = array('left','center','center','center');
- $table->head = array(get_string('course'),$param->line1);
- if (!empty($param->line2)) {
- $table->head[] = $param->line2;
- }
- if (!empty($param->line3)) {
- $table->head[] = $param->line3;
- }
-
- foreach ($courses as $c) {
- $a = array();
- $a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.$DB->get_field('course', 'shortname', array('id'=>$c->courseid)).'</a>';
-
- $a[] = $c->line1;
- if (isset($c->line2)) {
- $a[] = $c->line2;
- }
- if (isset($c->line3)) {
- $a[] = round($c->line3,2);
- }
- $table->data[] = $a;
- }
- echo html_writer::table($table);
- }
- }
- echo $OUTPUT->footer();
+++ /dev/null
-<?php
-
- require_once('../../../config.php');
- require_once($CFG->dirroot.'/lib/statslib.php');
- require_once($CFG->dirroot.'/lib/graphlib.php');
-
- $report = required_param('report', PARAM_INT);
- $time = required_param('time', PARAM_INT);
- $numcourses = required_param('numcourses', PARAM_INT);
-
- require_login();
-
- require_capability('report/courseoverview:view', get_context_instance(CONTEXT_SYSTEM));
-
- stats_check_uptodate();
-
- $param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
-
- if (!empty($param->sql)) {
- $sql = $param->sql;
- } else {
- $sql = "SELECT courseid, $param->fields
- FROM {".'stats_'.$param->table."}
- WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
- GROUP BY courseid
- $param->extras
- ORDER BY $param->orderby";
- }
-
- $courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
-
- if (empty($courses)) {
- $PAGE->set_url('/admin/report/courseoverview/index.php');
- print_error('statsnodata', 'error', $PAGE->url->out());
- }
-
-
- $graph = new graph(750,400);
-
- $graph->parameter['legend'] = 'outside-right';
- $graph->parameter['legend_size'] = 10;
- $graph->parameter['x_axis_angle'] = 90;
- $graph->parameter['title'] = false; // moodle will do a nicer job.
- $graph->y_tick_labels = null;
- $graph->offset_relation = null;
- if ($report != STATS_REPORT_ACTIVE_COURSES) {
- $graph->parameter['y_decimal_left'] = 2;
- }
-
- foreach ($courses as $c) {
- $graph->x_data[] = $DB->get_field('course', 'shortname', array('id'=>$c->courseid));
- $graph->y_data['bar1'][] = $c->{$param->graphline};
- }
- $graph->y_order = array('bar1');
- $graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
-
- $graph->draw_stack();
+++ /dev/null
-<?php
-
-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'));
+++ /dev/null
-<?PHP
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+++ /dev/null
-<?php
-
-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'));
+++ /dev/null
-<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$capabilities = array(
-
- 'report/questioninstances:view' => array(
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'manager' => CAP_ALLOW
- ),
-
- 'clonepermissionsfrom' => 'moodle/site:config',
- )
-);
+++ /dev/null
-<?php
-
-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'));
+++ /dev/null
-<?PHP
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+++ /dev/null
-<?php
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$capabilities = array(
-
- 'report/security:view' => array(
- 'riskbitmask' => RISK_CONFIG,
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_SYSTEM,
- 'archetypes' => array(
- 'manager' => CAP_ALLOW
- ),
- )
-);
+++ /dev/null
-<?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'));
+++ /dev/null
-<?PHP
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+++ /dev/null
-<?php
-
-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'));
--- /dev/null
+<?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/>.
+
+/**
+ * Provides an overview of installed reports
+ *
+ * Displays the list of found reports, their version (if found) and
+ * a link to delete the report.
+ *
+ * The code is based on admin/localplugins.php by David Mudrak.
+ *
+ * @package admin
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once(dirname(__FILE__) . '/../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->libdir.'/tablelib.php');
+
+admin_externalpage_setup('managereports');
+
+$delete = optional_param('delete', '', PARAM_PLUGIN);
+$confirm = optional_param('confirm', '', PARAM_BOOL);
+
+/// If data submitted, then process and store.
+
+if (!empty($delete) and confirm_sesskey()) {
+ echo $OUTPUT->header();
+ echo $OUTPUT->heading(get_string('reports'));
+
+ if (!$confirm) {
+ if (get_string_manager()->string_exists('pluginname', 'report_' . $delete)) {
+ $strpluginname = get_string('pluginname', 'report_' . $delete);
+ } else {
+ $strpluginname = $delete;
+ }
+ echo $OUTPUT->confirm(get_string('reportsdeleteconfirm', 'admin', $strpluginname),
+ new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
+ $PAGE->url);
+ echo $OUTPUT->footer();
+ die();
+
+ } else {
+ uninstall_plugin('report', $delete);
+ $a = new stdclass();
+ $a->name = $delete;
+ $pluginlocation = get_plugin_types();
+ $a->directory = $pluginlocation['report'] . '/' . $delete;
+ echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
+ echo $OUTPUT->continue_button($PAGE->url);
+ echo $OUTPUT->footer();
+ die();
+ }
+}
+
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('reports'));
+
+/// Print the table of all installed report plugins
+
+$table = new flexible_table('reportplugins_administration_table');
+$table->define_columns(array('name', 'version', 'delete'));
+$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
+$table->define_baseurl($PAGE->url);
+$table->set_attribute('id', 'reportplugins');
+$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
+$table->setup();
+
+$plugins = array();
+foreach (get_plugin_list('report') as $plugin => $plugindir) {
+ if (get_string_manager()->string_exists('pluginname', 'report_' . $plugin)) {
+ $strpluginname = get_string('pluginname', 'report_' . $plugin);
+ } else {
+ $strpluginname = $plugin;
+ }
+ $plugins[$plugin] = $strpluginname;
+}
+collatorlib::asort($plugins);
+
+$like = $DB->sql_like('plugin', '?', true, true, false, '|');
+$params = array('report|_%');
+$installed = $DB->get_records_select('config_plugins', "$like AND name = 'version'", $params);
+$versions = array();
+foreach ($installed as $config) {
+ $name = preg_replace('/^report_/', '', $config->plugin);
+ $versions[$name] = $config->value;
+ if (!isset($plugins[$name])) {
+ $plugins[$name] = $name;
+ }
+}
+
+foreach ($plugins as $plugin => $name) {
+ $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
+ $delete = html_writer::link($delete, get_string('delete'));
+
+ if (!isset($versions[$plugin])) {
+ if (file_exists("$CFG->dirroot/report/$plugin/version.php")) {
+ // not installed yet
+ $version = '?';
+ } else {
+ // no version info available
+ $version = '-';
+ }
+ } else {
+ $version = $versions[$plugin];
+ if (file_exists("$CFG->dirroot/report/$plugin")) {
+ $version = $versions[$plugin];
+ } else {
+ // somebody removed plugin without uninstall
+ $name = '<span class="notifyproblem">'.$name.' ('.get_string('missingfromdisk').')</span>';
+ $version = $versions[$plugin];
+ }
+ }
+
+ $table->add_data(array($name, $version, $delete));
+}
+
+$table->print_html();
+
+echo $OUTPUT->footer();
*/
public function __construct($name, $options) {
global $CFG;
- parent::__construct($name, $options);
- $this->roleid = $options['roleid'];
if (isset($options['context'])) {
$this->context = $options['context'];
} else {
$this->context = get_context_instance_by_id($options['contextid']);
}
+ $options['accesscontext'] = $this->context;
+ parent::__construct($name, $options);
+ $this->roleid = $options['roleid'];
require_once($CFG->dirroot . '/group/lib.php');
}
$ADMIN->add('coursereports', $page);
}
}
+ unset($pages);
}
// Now add reports
-foreach (get_plugin_list('report') as $plugin => $plugindir) {
+$pages = array();
+foreach (get_plugin_list('report') as $report => $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;
- }
-
- $index_path = "$plugindir/index.php";
- if (!file_exists($index_path)) {
- continue;
+ if ($settings) {
+ $pages[] = $settings;
+ }
}
- // 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'));
+}
+$ADMIN->add('modules', new admin_category('reportplugins', get_string('reports')));
+$ADMIN->add('reportplugins', new admin_externalpage('managereports', get_string('reportsmanage', 'admin'),
+ $CFG->wwwroot . '/' . $CFG->admin . '/reports.php'));
+foreach ($pages as $page) {
+ $ADMIN->add('reportplugins', $page);
}
// Now add various admin tools
'mycourses' => get_string('mycourses'),
'groups' => get_string('groups'))));
- $temp->add(new admin_setting_configmulticheckbox('extrauserselectorfields',
- get_string('extrauserselectorfields', 'admin'), get_string('configextrauserselectorfields', 'admin'), array('email' => '1'),
- array('email' => get_string('email'), 'idnumber' => get_string('idnumber'), 'username' => get_string('username'), )));
+ // Select fields to display as part of user identity (only to those
+ // with moodle/site:viewuseridentity).
+ // Options include fields from the user table that might be helpful to
+ // distinguish when adding or listing users ('I want to add the John
+ // Smith from Science faculty').
+ // Username is not included as an option because in some sites, it might
+ // be a security problem to reveal usernames even to trusted staff.
+ // Custom user profile fields are not currently supported.
+ $temp->add(new admin_setting_configmulticheckbox('showuseridentity',
+ get_string('showuseridentity', 'admin'),
+ get_string('showuseridentity_desc', 'admin'), array('email' => 1), array(
+ 'idnumber' => get_string('idnumber'),
+ 'email' => get_string('email'),
+ 'phone1' => get_string('phone'),
+ 'phone2' => get_string('phone2'),
+ 'department' => get_string('department'),
+ 'institution' => get_string('institution'),
+ )));
$temp->add(new admin_setting_configcheckbox('enablegravatar', get_string('enablegravatar', 'admin'), get_string('enablegravatar_help', 'admin'), 0));
}
$delete = optional_param('delete', 0, PARAM_INT);
$confirm = optional_param('confirm', '', PARAM_ALPHANUM); //md5 confirmation hash
$confirmuser = optional_param('confirmuser', 0, PARAM_INT);
- $sort = optional_param('sort', 'name', PARAM_ALPHA);
+ $sort = optional_param('sort', 'name', PARAM_ALPHANUM);
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', 30, PARAM_INT); // how many per page
echo $OUTPUT->header();
// Carry on with the user listing
-
- $columns = array("firstname", "lastname", "email", "city", "country", "lastaccess");
+ $context = context_system::instance();
+ $extracolumns = get_extra_user_fields($context);
+ $columns = array_merge(array('firstname', 'lastname'), $extracolumns,
+ array('city', 'country', 'lastaccess'));
foreach ($columns as $column) {
- $string[$column] = get_string("$column");
+ $string[$column] = get_user_field_name($column);
if ($sort != $column) {
$columnicon = "";
if ($column == "lastaccess") {
}
list($extrasql, $params) = $ufiltering->get_sql_filter();
- $users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '', $extrasql, $params);
+ $users = get_users_listing($sort, $dir, $page*$perpage, $perpage, '', '', '',
+ $extrasql, $params, $context);
$usercount = get_users(false);
$usersearchcount = get_users(false, '', true, null, "", '', '', '', '', '*', $extrasql, $params);
}
$table = new html_table();
- $table->head = array ($fullnamedisplay, $email, $city, $country, $lastaccess, "", "", "");
- $table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
+ $table->head = array ();
+ $table->align = array();
+ $table->head[] = $fullnamedisplay;
+ $table->align[] = 'left';
+ foreach ($extracolumns as $field) {
+ $table->head[] = ${$field};
+ $table->align[] = 'left';
+ }
+ $table->head[] = $city;
+ $table->align[] = 'left';
+ $table->head[] = $country;
+ $table->align[] = 'left';
+ $table->head[] = $lastaccess;
+ $table->align[] = 'left';
+ $table->head[] = "";
+ $table->align[] = 'center';
+ $table->head[] = "";
+ $table->align[] = 'center';
+ $table->head[] = "";
+ $table->align[] = 'center';
+
$table->width = "95%";
foreach ($users as $user) {
if (isguestuser($user)) {
}
$fullname = fullname($user, true);
- $table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
- "$user->email",
- "$user->city",
- "$user->country",
- $strlastaccess,
- $editbutton,
- $deletebutton,
- $confirmbutton);
+ $row = array ();
+ $row[] = "<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>";
+ foreach ($extracolumns as $field) {
+ $row[] = $user->{$field};
+ }
+ $row[] = $user->city;
+ $row[] = $user->country;
+ $row[] = $strlastaccess;
+ $row[] = $editbutton;
+ $row[] = $deletebutton;
+ $row[] = $confirmbutton;
+ $table->data[] = $row;
}
}
global $CFG, $USER, $DB;
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
+ if (session_is_loggedinas()) {
+ print_error('notpermittedtojumpas', 'mnet');
+ }
+
// check remote login permissions
if (! has_capability('moodle/site:mnetlogintoremote', get_system_context())
or is_mnet_remote_user($USER)
This files describes API changes in /auth/* - plugins,
information provided here is intended especially for developers.
+
=== 2.2 ===
required changes in code:
// Backup format
const FORMAT_MOODLE = 'moodle2';
const FORMAT_MOODLE1 = 'moodle1';
- const FORMAT_IMSCC = 'imscc';
+ const FORMAT_IMSCC1 = 'imscc1';
+ const FORMAT_IMSCC11 = 'imscc11';
const FORMAT_UNKNOWN = 'unknown';
// Interactive
--- /dev/null
+<?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/>.
+/**
+ * @package moodlecore
+ * @subpackage backup-imscc
+ * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
+
+require_once($CFG->dirroot . '/backup/cc/cc2moodle.php');
+require_once($CFG->dirroot . '/backup/cc/entities11.class.php');
+require_once($CFG->dirroot . '/backup/cc/entity11.resource.class.php');
+require_once($CFG->dirroot . '/backup/cc/entity11.forum.class.php');
+require_once($CFG->dirroot . '/backup/cc/entity11.quiz.class.php');
+require_once($CFG->dirroot . '/backup/cc/entity11.lti.class.php');
+
+class cc112moodle extends cc2moodle {
+ const CC_TYPE_FORUM = 'imsdt_xmlv1p1';
+ const CC_TYPE_QUIZ = 'imsqti_xmlv1p2/imscc_xmlv1p1/assessment';
+ const CC_TYPE_QUESTION_BANK = 'imsqti_xmlv1p2/imscc