Permalink
Browse files

MDL-32228: Plagiarism API - add support for plagiarism api to online …

…assignment type
  • Loading branch information...
kanikagoyal committed Jul 11, 2012
1 parent 2cbdaa7 commit 93d52d84ec8f7d4f83c320d4030e300c46f49f7f
Showing with 28 additions and 1 deletion.
  1. +28 −1 mod/assignment/type/online/assignment.class.php
@@ -107,6 +107,11 @@ function view() {
} else {
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter', 'online');
if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
+ echo plagiarism_get_links(array('userid' => $USER->id,
+ 'content' => trim(format_text($submission->data1, $submission->data2)),
+ 'cmid' => $this->cm->id,
+ 'course' => $this->course,
+ 'assignment' => $this->assignment));
$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
echo format_text($text, $submission->data2, array('overflowdiv'=>true));
if ($CFG->enableportfolios) {
@@ -194,6 +199,21 @@ function update_submission($data) {
$submission = $this->get_submission($USER->id);
$this->update_grade($submission);
+ $fs = get_file_storage();
+ $files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id);
+ // Let Moodle know that an assessable content was uploaded (eg for plagiarism detection)
+ $eventdata = new stdClass();
+ $eventdata->modulename = 'assignment';
+ $eventdata->name = 'update_submission';
+ $eventdata->cmid = $this->cm->id;
+ $eventdata->itemid = $update->id;
+ $eventdata->courseid = $this->course->id;
+ $eventdata->userid = $USER->id;
+ $eventdata->content = trim(format_text($update->data1, $update->data2));
+ if ($files) {
+ $eventdata->pathnamehashes = array_keys($files);
+ }
+ events_trigger('assessable_content_uploaded', $eventdata);
return $submission;
}
@@ -210,7 +230,11 @@ function print_student_answer($userid, $return=false){
$output = '<div class="files">'.
$OUTPUT->pix_icon(file_extension_icon('.htm'), 'html', 'moodle', array('class' => 'icon')).
- $popup .
+ $popup . plagiarism_get_links(array('userid' => $userid,
+ 'content' => trim(format_text($submission->data1, $submission->data2)),
+ 'cmid' => $this->cm->id,
+ 'course' => $this->course,
+ 'assignment' => $this->assignment)) .
'</div>';
return $output;
}
@@ -284,6 +308,9 @@ function setup_elements(&$mform) {
$mform->addHelpButton('var1', 'commentinline', 'assignment');
$mform->setDefault('var1', 0);
+ $coursecontext = context_course::instance($COURSE->id);
+ plagiarism_get_form_elements_module($mform, $coursecontext);
+
}
function portfolio_exportable() {

0 comments on commit 93d52d8

Please sign in to comment.