Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-31461 Plagiarism - adjust api functions to allow better support f…

…or renderers
  • Loading branch information...
commit 733196d843bf9b0cacc78b24ea345155eb960fe3 1 parent 4d2f89f
Dan Marsden danmarsden authored

Showing 2 changed files with 10 additions and 4 deletions. Show diff stats Hide diff stats

  1. +8 2 lib/plagiarismlib.php
  2. +2 2 mod/assignment/lib.php
10 lib/plagiarismlib.php
@@ -121,6 +121,7 @@ function plagiarism_get_form_elements_module($mform, $context) {
121 121 *
122 122 * @param object $course - full Course object
123 123 * @param object $cm - full cm object
  124 + * @return string
124 125 */
125 126 function plagiarism_update_status($course, $cm) {
126 127 global $CFG;
@@ -128,17 +129,20 @@ function plagiarism_update_status($course, $cm) {
128 129 return '';
129 130 }
130 131 $plagiarismplugins = plagiarism_load_available_plugins();
  132 + $output = '';
131 133 foreach($plagiarismplugins as $plugin => $dir) {
132 134 require_once($dir.'/lib.php');
133 135 $plagiarismclass = "plagiarism_plugin_$plugin";
134 136 $plagiarismplugin = new $plagiarismclass;
135   - $plagiarismplugin->update_status($course, $cm);
  137 + $output .= $plagiarismplugin->update_status($course, $cm);
136 138 }
  139 + return $output;
137 140 }
138 141
139 142 /**
140 143 * Function that prints the student disclosure notifying that the files will be checked for plagiarism
141 144 * @param integer $cmid - the cmid of this module
  145 +* @return string
142 146 */
143 147 function plagiarism_print_disclosure($cmid) {
144 148 global $CFG;
@@ -146,12 +150,14 @@ function plagiarism_print_disclosure($cmid) {
146 150 return '';
147 151 }
148 152 $plagiarismplugins = plagiarism_load_available_plugins();
  153 + $output = '';
149 154 foreach($plagiarismplugins as $plugin => $dir) {
150 155 require_once($dir.'/lib.php');
151 156 $plagiarismclass = "plagiarism_plugin_$plugin";
152 157 $plagiarismplugin = new $plagiarismclass;
153   - $plagiarismplugin->print_disclosure($cmid);
  158 + $output .= $plagiarismplugin->print_disclosure($cmid);
154 159 }
  160 + return $output;
155 161 }
156 162 /**
157 163 * used by admin/cron.php to get similarity scores from submitted files.
4 mod/assignment/lib.php
@@ -211,7 +211,7 @@ function view_intro() {
211 211 echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
212 212 echo format_module_intro('assignment', $this->assignment, $this->cm->id);
213 213 echo $OUTPUT->box_end();
214   - plagiarism_print_disclosure($this->cm->id);
  214 + echo plagiarism_print_disclosure($this->cm->id);
215 215 }
216 216
217 217 /**
@@ -1221,7 +1221,7 @@ function display_submissions($message='') {
1221 1221 echo '<div class="usersubmissions">';
1222 1222
1223 1223 //hook to allow plagiarism plugins to update status/print links.
1224   - plagiarism_update_status($this->course, $this->cm);
  1224 + echo plagiarism_update_status($this->course, $this->cm);
1225 1225
1226 1226 $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
1227 1227 if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {

0 comments on commit 733196d

Please sign in to comment.
Something went wrong with that request. Please try again.