weekly release 3.1dev
[moodle.git] / plagiarism / lib.php
CommitLineData
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
bce59524
DM
22 * @package moodlecore
23 * @subpackage plagiarism
24 * @copyright 2010 Dan Marsden http://danmarsden.com
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 */
27
28if (!defined('MOODLE_INTERNAL')) {
29 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
30}
31
32//dummy class - all plugins should be based off this.
33class plagiarism_plugin {
dd5d933f
JM
34
35 /**
36 * Return the list of form element names.
37 *
38 * @return array contains the form element names.
39 */
40 public function get_configs() {
41 return array();
42 }
43
bce59524 44 /**
9be958e2 45 * hook to allow plagiarism specific information to be displayed beside a submission
bce59524
DM
46 * @param array $linkarraycontains all relevant information for the plugin to generate a link
47 * @return string
bce59524
DM
48 */
49 public function get_links($linkarray) {
50 return '';
51 }
bfad2f2f
PB
52 /**
53 * hook to allow plagiarism specific information to be returned unformatted
54 * @param int $cmid
55 * @param int $userid
961f66fb 56 * @param $file file object
bfad2f2f
PB
57 * @return array containing at least:
58 * - 'analyzed' - whether the file has been successfully analyzed
59 * - 'score' - similarity score - ('' if not known)
60 * - 'reporturl' - url of originality report - '' if unavailable
61 */
961f66fb 62 public function get_file_results($cmid, $userid, $file) {
bfad2f2f
PB
63 return array('analyzed' => '', 'score' => '', 'reporturl' => '');
64 }
bce59524
DM
65 /**
66 * hook to add plagiarism specific settings to a module settings page
67 * @param object $mform - Moodle form
68 * @param object $context - current context
67fbfe8b 69 * @param string $modulename - Name of the module
bce59524 70 */
67fbfe8b 71 public function get_form_elements_module($mform, $context, $modulename = "") {
bce59524
DM
72 }
73 /* hook to save plagiarism specific settings on a module settings page
74 * @param object $data - data from an mform submission.
75 */
76 public function save_form_elements($data) {
77 }
78 /**
79 * hook to allow a disclosure to be printed notifying users what will happen with their submission
80 * @param int $cmid - course module id
81 * @return string
82 */
83 public function print_disclosure($cmid) {
84 }
85 /**
86 * hook to allow status of submitted files to be updated - called on grading/report pages.
87 *
88 * @param object $course - full Course object
89 * @param object $cm - full cm object
90 */
91 public function update_status($course, $cm) {
92 }
93 /**
94 * hook for cron
95 *
96 */
97 public function plagiarism_cron() {
98 }
4447223b 99}