MDL-41311 tool_generator: remove legacy code
[moodle.git] / admin / plagiarism.php
blobace710fd7bde459aa20530c0b7443134cae330b6
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
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.
8 //
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/>.
17 /**
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
24 * @package admin
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(dirname(dirname(__FILE__)) . '/config.php');
30 require_once($CFG->libdir.'/adminlib.php');
31 require_once($CFG->libdir.'/tablelib.php');
33 admin_externalpage_setup('manageplagiarismplugins');
35 echo $OUTPUT->header();
37 // Print the table of all installed plagiarism plugins.
39 $txt = get_strings(array('settings', 'name', 'version'));
40 $txt->uninstall = get_string('uninstallplugin', 'core_admin');
42 $plagiarismplugins = core_component::get_plugin_list('plagiarism');
43 if (empty($plagiarismplugins)) {
44 echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
45 echo $OUTPUT->footer();
46 exit;
49 echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
50 echo $OUTPUT->box_start('generalbox authsui');
52 $table = new html_table();
53 $table->head = array($txt->name, $txt->version, $txt->uninstall, $txt->settings);
54 $table->colclasses = array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
55 $table->data = array();
56 $table->attributes['class'] = 'manageplagiarismtable generaltable';
58 // Iterate through auth plugins and add to the display table.
59 $authcount = count($plagiarismplugins);
60 foreach ($plagiarismplugins as $plugin => $dir) {
61 if (file_exists($dir.'/settings.php')) {
62 $displayname = "<span>".get_string($plugin, 'plagiarism_'.$plugin)."</span>";
63 // Settings link.
64 $url = new moodle_url("/plagiarism/$plugin/settings.php");
65 $settings = html_writer::link($url, $txt->settings);
66 // Get version.
67 $version = get_config('plagiarism_' . $plugin);
68 if (!empty($version->version)) {
69 $version = $version->version;
70 } else {
71 $version = '?';
73 // uninstall link.
74 $uninstall = '';
75 if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin)) {
76 $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
78 $table->data[] = array($displayname, $version, $uninstall, $settings);
81 echo html_writer::table($table);
82 echo get_string('configplagiarismplugins', 'plagiarism');
83 echo $OUTPUT->box_end();
85 echo $OUTPUT->footer();