Skip to content

Commit

Permalink
Merge pull request #26 from turnitin/develop
Browse files Browse the repository at this point in the history
Release v2020032401
  • Loading branch information
dwinn authored Mar 24, 2020
2 parents c51b73a + 85ed10c commit 6ed29ae
Show file tree
Hide file tree
Showing 32 changed files with 219 additions and 167 deletions.
6 changes: 3 additions & 3 deletions backup/moodle2/backup_plagiarism_turnitinsim_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ protected function define_module_plugin_structure() {
'turnitinsim_sub',
array('id'),
array(
'userid', 'turnitinid', 'status', 'identifier', 'itemid', 'type', 'submitted_time',
'to_generate', 'generation_time', 'overall_score', 'requested_time', 'errormessage', 'contenthash'
'userid', 'turnitinid', 'status', 'identifier', 'itemid', 'type', 'submittedtime',
'togenerate', 'generationtime', 'overallscore', 'requestedtime', 'errormessage', 'contenthash'
)
);
$pluginelement->add_child($submissions);
Expand All @@ -74,7 +74,7 @@ protected function define_module_plugin_structure() {
// Get submission details along with contenthash from files table.
$submission->set_source_sql(
'SELECT PTS.userid, PTS.turnitinid, PTS.status, PTS.identifier, PTS.itemid, PTS.type,
PTS.submitted_time, PTS.to_generate, PTS.generation_time, PTS.overall_score, PTS.requested_time,
PTS.submittedtime, PTS.togenerate, PTS.generationtime, PTS.overallscore, PTS.requestedtime,
PTS.errormessage, F.contenthash
FROM {plagiarism_turnitinsim_sub} PTS
LEFT JOIN {files} F
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function define_module_plugin_structure() {
* Restore the Turnitin settings for this module.
* This will only be done if the module is from the same site from where it was backed up.
*
* @param $data object The data we are restoring.
* @param object $data object The data we are restoring.
* @throws dml_exception
*/
public function process_turnitinsim_mods($data) {
Expand All @@ -66,7 +66,7 @@ public function process_turnitinsim_mods($data) {
* This will only be done if the module is from the same site from where it was backed up
* and if the Turnitin submission does not currently exist in the database.
*
* @param $data object The data we are restoring.
* @param object $data The data we are restoring.
* @throws dml_exception
*/
public function process_turnitinsim_subs($data) {
Expand All @@ -93,7 +93,7 @@ public function process_turnitinsim_subs($data) {
* This will only be done if the module is from the same site from where it was backed up
* and if the Turnitin user id does not currently exist in the database.
*
* @param $data object The data we are restoring.
* @param object $data The data we are restoring.
* @throws dml_exception
*/
public function process_turnitinsim_usrs($data) {
Expand Down
24 changes: 12 additions & 12 deletions classes/assign.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class plagiarism_turnitinsim_assign {
/**
* Get the text from the database for the submission.
*
* @param $itemid String The itemid for this submission.
* @param String $itemid The itemid for this submission.
* @return mixed The text of the submission.
* @throws dml_exception
*/
Expand All @@ -48,7 +48,7 @@ public function get_onlinetext($itemid) {
/**
* Get the item id from the database for this submission.
*
* @param $params object The params to call the DB with.
* @param object $params The params to call the DB with.
* @return int The itemid.
* @throws dml_exception
*/
Expand All @@ -70,10 +70,10 @@ public function get_itemid($params) {
/**
* Get the actual author of the submission.
*
* @param $userid int The userid as given by Moodle.
* @param $relateduserid int The relateduserid as given by Moodle.
* @param $cm object The course module.
* @param $itemid string the itemid for this submission.
* @param int $userid The userid as given by Moodle.
* @param int $relateduserid The relateduserid as given by Moodle.
* @param object $cm The course module.
* @param string $itemid The itemid for this submission.
* @return int The authorid.
* @throws coding_exception
* @throws dml_exception
Expand Down Expand Up @@ -102,7 +102,7 @@ public function get_author($userid, $relateduserid, $cm, $itemid) {
/**
* Get the group id that a submission belongs to.
*
* @param $itemid string The itemid for the submission.
* @param string $itemid The itemid for the submission.
* @return int The group id.
* @throws dml_exception
*/
Expand Down Expand Up @@ -142,7 +142,7 @@ public function get_first_group_author($courseid, $groupid) {
/**
* Return whether the submission is a draft.
*
* @param $itemid string The itemid for the submission.
* @param string $itemid The itemid for the submission.
* @return bool If the submission is a draft.
* @throws dml_exception
*/
Expand All @@ -157,7 +157,7 @@ public function is_submission_draft($itemid) {
/**
* Get the assignment due date.
*
* @param $id int The assignment ID we want the due date for.
* @param int $id The assignment ID we want the due date for.
* @return mixed The due date for the assignment.
* @throws dml_exception
*/
Expand All @@ -172,9 +172,9 @@ public function get_due_date($id) {
/**
* Determines whether the OR links in other posts should be seen. This is not applicable for assignments.
*
* @param $courseid int The ID for this course.
* @param $userid int The userid.
* @return bool if showing other posts links.
* @param int $courseid The ID for this course.
* @param int $userid The userid.
* @return bool true if showing other links.
*/
public function show_other_posts_links($courseid, $userid) {
return true;
Expand Down
11 changes: 8 additions & 3 deletions classes/callback.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*/
class plagiarism_turnitinsim_callback {

/**
* @var plagiarism_turnitinsim_request|null Request object.
*/
public $tsrequest;

/**
Expand All @@ -46,8 +49,9 @@ public function __construct(plagiarism_turnitinsim_request $tsrequest = null ) {
/**
* Attempt to retrieve the webhook.
*
* @param $webhookid string The webhookid to check.
* @param string $webhookid The webhookid to check.
* @return bool true if has webhook.
* @throws coding_exception
*/
public function has_webhook($webhookid) {
// Make request to get webhook.
Expand Down Expand Up @@ -86,8 +90,9 @@ public function has_webhook($webhookid) {
/**
* Attempt to delete the webhook (not currently used).
*
* @param $webhookid string The webhookid to be deleted.
* @param string $webhookid The webhookid to be deleted.
* @return bool true if webhook has been deleted.
* @throws coding_exception
*/
public function delete_webhook($webhookid) {
// Make request to get webhook.
Expand Down Expand Up @@ -155,7 +160,7 @@ public function create_webhook() {
/**
* Generate a 64 character length hash of the request string.
*
* @param $requeststring string The request in string format.
* @param string $requeststring The request in string format.
* @return string A 64 character length hash.
* @throws dml_exception
*/
Expand Down
2 changes: 1 addition & 1 deletion classes/defaults_form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function display() {
/**
* Save the default settings
*
* @param $data object The form data we were passed and need to save.
* @param object $data The form data we were passed and need to save.
* @throws dml_exception
*/
public function save($data) {
Expand Down
5 changes: 5 additions & 0 deletions classes/eula.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@
*/
class plagiarism_turnitinsim_eula {

/**
* @var plagiarism_turnitinsim_request|null The request object.
*/
public $tsrequest;

/**
* plagiarism_turnitinsim_eula constructor.
*
* @param plagiarism_turnitinsim_request|null $tsrequest The request we're handling.
* @throws dml_exception
*/
public function __construct(plagiarism_turnitinsim_request $tsrequest = null ) {
$this->tsrequest = ($tsrequest) ? $tsrequest : new plagiarism_turnitinsim_request();
Expand All @@ -45,6 +49,7 @@ public function __construct(plagiarism_turnitinsim_request $tsrequest = null ) {
* Attempt to retrieve the latest version of the EULA.
*
* @return mixed|stdClass
* @throws coding_exception
*/
public function get_latest_version() {
$responsedata = new stdClass();
Expand Down
27 changes: 10 additions & 17 deletions classes/forum.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class plagiarism_turnitinsim_forum {
/**
* Get the text from the database for the submission.
*
* @param $itemid String The itemid for this submission.
* @param String $itemid The itemid for this submission.
* @return mixed The text of the submission.
* @throws dml_exception
*/
Expand All @@ -47,7 +47,7 @@ public function get_onlinetext($itemid) {
/**
* Get the item id from the database for this submission.
*
* @param $params object The params to call the DB with.
* @param object $params The params to call the DB with.
* @return int The itemid.
* @throws dml_exception
*/
Expand All @@ -69,8 +69,8 @@ public function get_itemid($params) {
/**
* Get the actual author of the submission.
*
* @param $userid int The userid as given by Moodle.
* @param $relateduserid int The relateduserid as given by Moodle.
* @param int $userid The userid as given by Moodle.
* @param int $relateduserid The relateduserid as given by Moodle.
* @return int The authorid.
*/
public function get_author($userid, $relateduserid) {
Expand All @@ -80,7 +80,7 @@ public function get_author($userid, $relateduserid) {
/**
* Get the group id that a submission belongs to. - (N/A in forums).
*
* @param $itemid string The itemid for the submission.
* @param string $itemid The itemid for the submission.
* @return int The group id.
*/
public function get_groupid($itemid) {
Expand All @@ -90,7 +90,7 @@ public function get_groupid($itemid) {
/**
* Return whether the submission is a draft. Never the case with a forum submission.
*
* @param $itemid string The itemid for the submission.
* @param string $itemid The itemid for the submission.
* @return bool If the submission is a draft.
*/
public function is_submission_draft($itemid) {
Expand All @@ -100,14 +100,7 @@ public function is_submission_draft($itemid) {
/**
* Return the due date so we can work out report generation time. Not applicable to forums.
*
* @param $id
* @return int
*/

/**
* Return the due date so we can work out report generation time. Not applicable to forums.
*
* @param $id int The forum ID we want the due date for.
* @param int $id The forum ID we want the due date for.
* @return int The due date for the assignment.
*/
public function get_due_date($id) {
Expand All @@ -117,9 +110,9 @@ public function get_due_date($id) {
/**
* Determines whether the OR links in other posts should be seen.
*
* @param $courseid int The ID for this course.
* @param $userid int The userid.
* @return bool if showing other posts links.
* @param int $courseid The ID for this course.
* @param int $userid The userid.
* @return bool true if showing other posts links.
* @throws coding_exception
*/
public function show_other_posts_links($courseid, $userid) {
Expand Down
2 changes: 1 addition & 1 deletion classes/group.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class plagiarism_turnitinsim_group {

/**
* plagiarism_turnitinsim_group constructor.
* @param $groupid int The ID of the group.
* @param int $groupid The ID of the group.
* @throws dml_exception
*/
public function __construct($groupid) {
Expand Down
2 changes: 1 addition & 1 deletion classes/logger.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function __construct() {
/**
* Rotate logs, only keep the last KEEPLOGS number of logs.
*
* @param $filepath string The file path for the logs.
* @param string $filepath The file path for the logs.
*/
private function rotate_logs( $filepath ) {

Expand Down
8 changes: 4 additions & 4 deletions classes/message/receipt_instructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class receipt_instructor {
/**
* Send digital receipt to instructor. This message must preserve the anonymity of a submission.
*
* @param $input - used to build message
* @param array $input - used to build message
* @return string
* @throws \coding_exception
*/
Expand All @@ -53,9 +53,9 @@ public function build_message($input) {
/**
* Send digital receipt to instructors.
*
* @param $instructors array The instructors to send the receipt message to.
* @param $message string The message to send.
* @param $courseid int The ID for the course the submission is on.
* @param array $instructors The instructors to send the receipt message to.
* @param string $message The message to send.
* @param int $courseid The ID for the course the submission is on.
* @throws \coding_exception
*/
public function send_message($instructors, $message, $courseid) {
Expand Down
8 changes: 4 additions & 4 deletions classes/message/receipt_student.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class receipt_student {
/**
* Build digital receipt to send to student
*
* @param $input - used to build message
* @param array $input - used to build message
* @return string
* @throws \coding_exception
*/
Expand All @@ -55,9 +55,9 @@ public function build_message($input) {
/**
* Send digital receipt to student.
*
* @param $userid int The userid to send the message to.
* @param $message string The message to send.
* @param $courseid int The ID for the course the submission is on.
* @param int $userid The userid to send the message to.
* @param string $message The message to send.
* @param int $courseid The ID for the course the submission is on.
* @throws \coding_exception
*/
public function send_message($userid, $message, $courseid) {
Expand Down
6 changes: 3 additions & 3 deletions classes/observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class plagiarism_turnitinsim_observer {
/**
* Build the eventdata array.
*
* @param $event object The event we are handling.
* @param $eventtype string The type of event we are handling.
* @param $module string The name of the module.
* @param object $event The event we are handling.
* @param string $eventtype The type of event we are handling.
* @param string $module The name of the module.
* @return mixed
*/
public static function build_event_data($event, $eventtype, $module = '') {
Expand Down
15 changes: 9 additions & 6 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
use core_privacy\local\request\helper;
use core_privacy\local\request\writer;

/**
* Privacy Subsystem implementation for plagiarism_turnitinsim.
*/
class provider implements
// This plugin does store personal user data.
\core_privacy\local\metadata\provider,
Expand All @@ -46,8 +49,8 @@ class provider implements
/**
* Return the fields which contain personal data.
*
* @param $collection collection a reference to the collection to use to store the metadata.
* @return $collection the updated collection of metadata items.
* @param collection $collection A reference to the collection to use to store the metadata.
* @return collection The updated collection of metadata items.
*/
public static function _get_metadata(collection $collection) {
$collection->add_database_table(
Expand All @@ -57,8 +60,8 @@ public static function _get_metadata(collection $collection) {
'turnitinid' => 'privacy:metadata:plagiarism_turnitinsim_sub:turnitinid',
'identifier' => 'privacy:metadata:plagiarism_turnitinsim_sub:identifier',
'itemid' => 'privacy:metadata:plagiarism_turnitinsim_sub:itemid',
'submitted_time' => 'privacy:metadata:plagiarism_turnitinsim_sub:submitted_time',
'overall_score' => 'privacy:metadata:plagiarism_turnitinsim_sub:overall_score'
'submittedtime' => 'privacy:metadata:plagiarism_turnitinsim_sub:submittedtime',
'overallscore' => 'privacy:metadata:plagiarism_turnitinsim_sub:overallscore'
],
'privacy:metadata:plagiarism_turnitinsim_sub'
);
Expand Down Expand Up @@ -137,8 +140,8 @@ public static function _export_plagiarism_user_data($userid, \context $context,
turnitinid,
identifier,
itemid,
submitted_time,
overall_score
submittedtime,
overallscore
FROM {plagiarism_turnitinsim_sub}
WHERE userid = :userid";
$submissions = $DB->get_records_sql($sql, $params);
Expand Down
Loading

0 comments on commit 6ed29ae

Please sign in to comment.