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.
/plagiarism/ -> lib.php (source)

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * lib.php - Contains Plagiarism base class used by plugins.
  20   *
  21   * @since Moodle 2.0
  22   * @package    core_plagiarism
  23   * @copyright  2010 Dan Marsden http://danmarsden.com
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  
  27  if (!defined('MOODLE_INTERNAL')) {
  28      die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
  29  }
  30  
  31  
  32  /**
  33   * Plagiarism base class used by plugins.
  34   *
  35   * @since Moodle 2.0
  36   * @package    core_plagiarism
  37   * @copyright  2010 Dan Marsden http://danmarsden.com
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  abstract class plagiarism_plugin {
  41  
  42      /**
  43       * Return the list of form element names.
  44       * @deprecated Since Moodle 4.0 - this function was a placeholder and not used in core.
  45       * @todo MDL-71326 Remove this method.
  46       * @return array contains the form element names.
  47       */
  48      public function get_configs() {
  49          return array();
  50      }
  51  
  52      /**
  53       * hook to allow plagiarism specific information to be displayed beside a submission
  54       * @param array  $linkarraycontains all relevant information for the plugin to generate a link
  55       * @return string
  56       */
  57      public function get_links($linkarray) {
  58          return '';
  59      }
  60      /**
  61       * hook to allow plagiarism specific information to be returned unformatted
  62       * @deprecated Since Moodle 4.0 - this function was a placeholder and not used in core Moodle code.
  63       * @todo MDL-71326 Remove this method.
  64       * @param int $cmid
  65       * @param int $userid
  66       * @param $file file object
  67       * @return array containing at least:
  68       *   - 'analyzed' - whether the file has been successfully analyzed
  69       *   - 'score' - similarity score - ('' if not known)
  70       *   - 'reporturl' - url of originality report - '' if unavailable
  71       */
  72      public function get_file_results($cmid, $userid, $file) {
  73          return array('analyzed' => '', 'score' => '', 'reporturl' => '');
  74      }
  75      /**
  76       * hook to add plagiarism specific settings to a module settings page
  77       * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_edit_post_actions() instead.
  78       * @todo MDL-67526 Remove this method.
  79       * @param object $mform  - Moodle form
  80       * @param object $context - current context
  81       * @param string $modulename - Name of the module
  82       */
  83      public function get_form_elements_module($mform, $context, $modulename = "") {
  84      }
  85      /**
  86       * hook to save plagiarism specific settings on a module settings page
  87       * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_standard_elements() instead.
  88       * @todo MDL-67526 Remove this method.
  89       * @param object $data - data from an mform submission.
  90       */
  91      public function save_form_elements($data) {
  92      }
  93      /**
  94       * hook to allow a disclosure to be printed notifying users what will happen with their submission
  95       * @param int $cmid - course module id
  96       * @return string
  97       */
  98      public function print_disclosure($cmid) {
  99      }
 100      /**
 101       * hook to allow status of submitted files to be updated - called on grading/report pages.
 102       * @deprecated Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
 103       * @todo MDL-71326 Remove this method.
 104       * @param object $course - full Course object
 105       * @param object $cm - full cm object
 106       */
 107      public function update_status($course, $cm) {
 108      }
 109  }