Commit | Line | Data |
---|---|---|
bce59524 DM |
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 | * | |
5bcfd504 | 21 | * @since Moodle 2.0 |
5e43eea0 | 22 | * @package core_plagiarism |
bce59524 DM |
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 | ||
5e43eea0 MA |
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 { | |
dd5d933f JM |
41 | |
42 | /** | |
43 | * Return the list of form element names. | |
44 | * | |
45 | * @return array contains the form element names. | |
46 | */ | |
47 | public function get_configs() { | |
48 | return array(); | |
49 | } | |
50 | ||
bce59524 | 51 | /** |
9be958e2 | 52 | * hook to allow plagiarism specific information to be displayed beside a submission |
bce59524 DM |
53 | * @param array $linkarraycontains all relevant information for the plugin to generate a link |
54 | * @return string | |
bce59524 DM |
55 | */ |
56 | public function get_links($linkarray) { | |
57 | return ''; | |
58 | } | |
bfad2f2f PB |
59 | /** |
60 | * hook to allow plagiarism specific information to be returned unformatted | |
61 | * @param int $cmid | |
62 | * @param int $userid | |
961f66fb | 63 | * @param $file file object |
bfad2f2f PB |
64 | * @return array containing at least: |
65 | * - 'analyzed' - whether the file has been successfully analyzed | |
66 | * - 'score' - similarity score - ('' if not known) | |
67 | * - 'reporturl' - url of originality report - '' if unavailable | |
68 | */ | |
961f66fb | 69 | public function get_file_results($cmid, $userid, $file) { |
bfad2f2f PB |
70 | return array('analyzed' => '', 'score' => '', 'reporturl' => ''); |
71 | } | |
bce59524 DM |
72 | /** |
73 | * hook to add plagiarism specific settings to a module settings page | |
74 | * @param object $mform - Moodle form | |
75 | * @param object $context - current context | |
67fbfe8b | 76 | * @param string $modulename - Name of the module |
bce59524 | 77 | */ |
67fbfe8b | 78 | public function get_form_elements_module($mform, $context, $modulename = "") { |
bce59524 DM |
79 | } |
80 | /* hook to save plagiarism specific settings on a module settings page | |
81 | * @param object $data - data from an mform submission. | |
82 | */ | |
83 | public function save_form_elements($data) { | |
84 | } | |
85 | /** | |
86 | * hook to allow a disclosure to be printed notifying users what will happen with their submission | |
87 | * @param int $cmid - course module id | |
88 | * @return string | |
89 | */ | |
90 | public function print_disclosure($cmid) { | |
91 | } | |
92 | /** | |
93 | * hook to allow status of submitted files to be updated - called on grading/report pages. | |
94 | * | |
95 | * @param object $course - full Course object | |
96 | * @param object $cm - full cm object | |
97 | */ | |
98 | public function update_status($course, $cm) { | |
99 | } | |
5e43eea0 | 100 | |
bce59524 | 101 | /** |
5e43eea0 MA |
102 | * Deprecated cron method. |
103 | * | |
104 | * This method was added by mistake in the previous versions of Moodle, do not override it since it is never called. | |
105 | * To implement cron you need to register a scheduled task, see https://docs.moodle.org/dev/Task_API. | |
106 | * For backward compatibility with the old cron API the method cron() from this class can also be used. | |
bce59524 | 107 | * |
5e43eea0 | 108 | * @deprecated since Moodle 3.1 MDL-52702 - please use scheduled tasks instead. |
bce59524 DM |
109 | */ |
110 | public function plagiarism_cron() { | |
5e43eea0 | 111 | debugging('plagiarism_plugin::plagiarism_cron() is deprecated. Please use scheduled tasks instead', DEBUG_DEVELOPER); |
bce59524 | 112 | } |
4447223b | 113 | } |