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