Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   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.
  13  //
  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/>.
  16  
  17  /**
  18   * Provides an overview of installed plagiarism plugins
  19   *
  20   * Displays the list of found plagiarism plugins, their version (if found) and
  21   * a link to uninstall the plagiarism plugin.
  22   *
  23   * @see       https://moodledev.io/docs/apis/subsystems/plagiarism
  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
  27   */
  28  
  29  require_once(__DIR__ . '/../config.php');
  30  require_once($CFG->libdir.'/adminlib.php');
  31  require_once($CFG->libdir.'/tablelib.php');
  32  
  33  
  34  admin_externalpage_setup('manageplagiarismplugins');
  35  
  36  echo $OUTPUT->header();
  37  
  38  // Print the table of all installed plagiarism plugins.
  39  
  40  $txt = get_strings(array('settings', 'name', 'version'));
  41  $txt->uninstall = get_string('uninstallplugin', 'core_admin');
  42  
  43  $plagiarismplugins = core_component::get_plugin_list('plagiarism');
  44  if (empty($plagiarismplugins)) {
  45      echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
  46      echo $OUTPUT->footer();
  47      exit;
  48  }
  49  
  50  echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
  51  echo $OUTPUT->box_start('generalbox authsui');
  52  
  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';
  58  
  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>";
  64          // Settings link.
  65          $url = new moodle_url("/plagiarism/$plugin/settings.php");
  66          $settings = html_writer::link($url, $txt->settings);
  67          // Get version.
  68          $version = get_config('plagiarism_' . $plugin);
  69          if (!empty($version->version)) {
  70              $version = $version->version;
  71          } else {
  72              $version = '?';
  73          }
  74          // uninstall link.
  75          $uninstall = '';
  76          if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin, 'manage')) {
  77              $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
  78          }
  79          $table->data[] = array($displayname, $version, $uninstall, $settings);
  80      }
  81  }
  82  echo html_writer::table($table);
  83  echo get_string('configplagiarismplugins', 'plagiarism');
  84  echo $OUTPUT->box_end();
  85  
  86  echo $OUTPUT->footer();