Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

How to add support for a Plagiarism Plugin to my activity module: Difference between revisions

From MoodleDocs
No edit summary
mNo edit summary
Line 31: Line 31:
  plagiarism_print_disclosure($this->cm->id);
  plagiarism_print_disclosure($this->cm->id);
If a plagiarism plugin is enabled in your module instance this will display a message to the student to inform them.
If a plagiarism plugin is enabled in your module instance this will display a message to the student to inform them.
==See also==
* [[Plagiarism_plugins]]

Revision as of 01:11, 16 February 2012

Overview

There are 4 main "hooks" that you need to add to your module.

Sending Data to the Plagiarism plugin

Plagiarism plugins use Moodles event api to trigger events to allow a plugin to "do something" with some content. add an event to your code like this:

$eventdata = new stdClass();
$eventdata->modulename   = 'modulename';
$eventdata->cmid         = $this->cm->id;
$eventdata->itemid       = $somehelpfulid; //something that identifies this piece of content within your module.
$eventdata->courseid     = $this->course->id;
$eventdata->userid       = $USER->id; //user that has submitted this content
$eventdata->files        = $files; (or $eventdata->file if there is only a single file.)
events_trigger('assessable_file_uploaded', $eventdata);

It's a good idea to keep the name of the event as above as the plagiarism plugins already have handlers for this particular event. $eventdata->files should contain the full file objects like as obtained by $fs->get_area_files - or if a single file object $eventdata->file can be used. There is currently only one module type being processed by Plagiarism plugins so it's possible that a small amount of modification will need to be done to the plagiarism plugins "event_file_uploaded" function to handle your content if there's anything specific required to manage your content. If you can see a way to improve it - drop the maintainer of the plugin an e-mail.

Module level configuration options

in the form used to generate your module settings - usually /mod_form.php add the code:

plagiarism_get_form_elements_module($mform, $course_context);

this will allow the plagiarism plugin to display the module level settings required to enable plagiarism prevention with the instance of the module.

Printing the response from the plagiarism plugin

Once the Plagiarism plugin has "done something" with your content it will need to display a link or content specific to that submission. Usually this will be on the students "view" and on the teachers "view submissions" page. add something like this to wherever the users submission is displayed:

$output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));

Printing student Disclosure

When using Plagiarism prevention tools it is vital that the student is informed about this - on the modules "submission" page - or view.php or similar - you should add the following code:

plagiarism_print_disclosure($this->cm->id);

If a plagiarism plugin is enabled in your module instance this will display a message to the student to inform them.


See also