Permalink
Browse files

MDL-30313 plagiarism support for unformated rsults

support for obtaining plagiarism detection results without
html formatting
  • Loading branch information...
1 parent 6be90ce commit bfad2f2fffc5fc1f9ecaa3b009df8e5001404538 @peterbulmer peterbulmer committed Nov 17, 2011
Showing with 38 additions and 0 deletions.
  1. +25 −0 lib/plagiarismlib.php
  2. +13 −0 plagiarism/lib.php
View
@@ -54,6 +54,31 @@ function plagiarism_get_links($linkarray) {
}
/**
+ * returns array of plagiarism details about specified file
+ *
+ * @param int $cmid
+ * @param int $userid
+ * @param object $file moodle file object
+ * @return array - sets of details about specified file, one array of details per plagiarism plugin
+ * - each set contains at least 'analyzed', 'score', 'reporturl'
+ */
+function plagiarism_get_file_results($cmid, $userid, $file) {
+ global $CFG;
+ $allresults = array();
+ if (empty($CFG->enableplagiarism)) {
+ return $allresults;
+ }
+ $plagiarismplugins = plagiarism_load_available_plugins();
+ foreach($plagiarismplugins as $plugin => $dir) {
+ require_once($dir.'/lib.php');
+ $plagiarismclass = "plagiarism_plugin_$plugin";
+ $plagiarismplugin = new $plagiarismclass;
+ $allresults[] = $plagiarismplugin->get_file_results($cmid, $userid, $file);
+ }
+ return $allresults;
+}
+
+/**
* saves/updates plagiarism settings from a modules config page - called by course/modedit.php
*
* @param object $data - form data
View
@@ -41,6 +41,19 @@ public function get_links($linkarray) {
return '';
}
/**
+ * hook to allow plagiarism specific information to be returned unformatted
+ * @param int $cmid
+ * @param int $userid
+ * @param object $file moodle 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

0 comments on commit bfad2f2

Please sign in to comment.