2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Provides an overview of installed plagiarism plugins
20 * Displays the list of found plagiarism plugins, their version (if found) and
21 * a link to uninstall the plagiarism plugin.
23 * @see http://docs.moodle.org/dev/Plagiarism_API
25 * @copyright 2012 Dan Marsden <dan@danmarsden.com>
26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29 require_once(__DIR__
. '/../config.php');
30 require_once($CFG->libdir
.'/adminlib.php');
31 require_once($CFG->libdir
.'/tablelib.php');
34 admin_externalpage_setup('manageplagiarismplugins');
36 echo $OUTPUT->header();
38 // Print the table of all installed plagiarism plugins.
40 $txt = get_strings(array('settings', 'name', 'version'));
41 $txt->uninstall
= get_string('uninstallplugin', 'core_admin');
43 $plagiarismplugins = core_component
::get_plugin_list('plagiarism');
44 if (empty($plagiarismplugins)) {
45 echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
46 echo $OUTPUT->footer();
50 echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
51 echo $OUTPUT->box_start('generalbox authsui');
53 $table = new html_table();
54 $table->head
= array($txt->name
, $txt->version
, $txt->uninstall
, $txt->settings
);
55 $table->colclasses
= array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
56 $table->data
= array();
57 $table->attributes
['class'] = 'manageplagiarismtable generaltable';
59 // Iterate through auth plugins and add to the display table.
60 $authcount = count($plagiarismplugins);
61 foreach ($plagiarismplugins as $plugin => $dir) {
62 if (file_exists($dir.'/settings.php')) {
63 $displayname = "<span>".get_string($plugin, 'plagiarism_'.$plugin)."</span>";
65 $url = new moodle_url("/plagiarism/$plugin/settings.php");
66 $settings = html_writer
::link($url, $txt->settings
);
68 $version = get_config('plagiarism_' . $plugin);
69 if (!empty($version->version
)) {
70 $version = $version->version
;
76 if ($uninstallurl = core_plugin_manager
::instance()->get_uninstall_url('plagiarism_'.$plugin, 'manage')) {
77 $uninstall = html_writer
::link($uninstallurl, $txt->uninstall
);
79 $table->data
[] = array($displayname, $version, $uninstall, $settings);
82 echo html_writer
::table($table);
83 echo get_string('configplagiarismplugins', 'plagiarism');
84 echo $OUTPUT->box_end();
86 echo $OUTPUT->footer();