Skip to content

Commit

Permalink
Merge branch 'qa'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcgettrick committed Sep 17, 2015
2 parents e6cac73 + 9d1615b commit fc8f1ca
Show file tree
Hide file tree
Showing 94 changed files with 3,020 additions and 2,216 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
.git

# Ignore Node.js modules
node_modules/
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
Releases before version 2015040106 will refer to changes made to the Turnitin's other Moodle plugins as well; the plagiarism plugin and block.
### Date: 2015-September-16
### Release: v2015040109

- API URL for UK institutions automatically changed to api.turnitinuk.com.
- Shared Turnitin Rubrics can be attached to assignments.
- Digital receipts can be sent without SMTP settings enabled.
- Icons replaced with Font Awesome and Tii font sets.
- Modified logging on submission upload and deletion.
- Ability added to send a message to user who not yet submitted to an assignment.
- Fixes:
- Rubric Manager now shows Shared Rubrics.
- Submission modal resizing errors fixed as EULA has moved from submission modal to submission inbox.
- Extra user role check added on submission deletion.
- File check added before sending to Turnitin.
- Submissions are now correctly linked when backing up and restoring (Thanks to Adam Olley).
- File check added and slashes removed from filename before sending to Turnitin.

---

### Date: 2015-July-31
### Release: v2015040107
Expand All @@ -9,6 +26,8 @@ Releases before version 2015040106 will refer to changes made to the Turnitin's

---

Releases before version 2015040106 will refer to changes made to the Turnitin's other Moodle plugins as well; the plagiarism plugin and block.

### Date: 2015-June-29
### Release: v2015040106

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ If you are using a pre 2.6 version of Moodle you will have to uncomment the init

To configure the plugin go to `"Site Administration" > "Plugins" > "Activity Modules" > "Turnitin Assignment 2"` and enter your Turnitin account Id, shared key and API URL.

**Note:** *The API connection URL is different for this package to previous Turnitin plugins. It should be https://api.turnitin.com, https://submit.ac.uk. or https://sandbox.turnitin.com.*
**Note:** *The API connection URL is different for this package to previous Turnitin plugins. It should be https://api.turnitin.com, https://api.turnitinuk.com. or https://sandbox.turnitin.com.*
38 changes: 30 additions & 8 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,22 @@
break;

case "acceptuseragreement":
$eula_user_id = required_param('user_id', PARAM_INT);
if (!confirm_sesskey()) {
throw new moodle_exception('invalidsesskey', 'error');
}

$message = optional_param('message', '', PARAM_ALPHAEXT);

// Get the id from the turnitintooltwo_users table so we can update
$turnitin_user = $DB->get_record('turnitintooltwo_users', array('userid' => $eula_user_id));
$turnitin_user = $DB->get_record('turnitintooltwo_users', array('userid' => $USER->id));

// Build user object for update
$eula_user = new stdClass();
$eula_user->id += $turnitin_user->id;
$eula_user->userid = $eula_user_id;
$eula_user->user_agreement_accepted = 1;
$eula_user = new object();
$eula_user->id = $turnitin_user->id;
$eula_user->user_agreement_accepted = 0;
if ($message == 'turnitin_eula_accepted') {
$eula_user->user_agreement_accepted = 1;
}

// Update the user using the above object
$DB->update_record('turnitintooltwo_users', $eula_user, $bulk=false);
Expand Down Expand Up @@ -226,8 +232,12 @@
$turnitintooltwoview = new turnitintooltwo_view();

$return["aaData"] = $turnitintooltwoview->get_submission_inbox($cm, $turnitintooltwoassignment, $parts, $partid, $start);
$totalsubmitters = $DB->count_records('turnitintooltwo_submissions',
array('turnitintooltwoid' => $turnitintooltwoassignment->turnitintooltwo->id,
'submission_part' => $partid));
$return["end"] = $start + TURNITINTOOLTWO_SUBMISSION_GET_LIMIT;
$return["total"] = $_SESSION["num_submissions"][$partid];
$return["nonsubmitters"] = $return["total"] - $totalsubmitters;

// Remove any leftover submissions from session
if ($return["end"] >= $return["total"]) {
Expand Down Expand Up @@ -372,17 +382,29 @@

$options = array('' => get_string('norubric', 'turnitintooltwo')) + $instructorrubrics;

// Add in rubric if the selected rubric belongs to another instructor.
// Get rubrics that are shared on the Turnitin account.
if ($modulename == "turnitintooltwo") {
$turnitinclass = new turnitintooltwo_class($courseid);
} else {
require_once($CFG->dirroot.'/plagiarism/turnitin/lib.php');
$turnitinclass = new turnitin_class($courseid);
}
$turnitinclass->read_class_from_tii();
$options = $options + $turnitinclass->sharedrubrics;

// Get assignment details.
if (!empty($assignmentid)) {
if ($modulename == "turnitintooltwo") {
$turnitintooltwoassignment = new turnitintooltwo_assignment($assignmentid);
} else {
require_once($CFG->dirroot.'/plagiarism/turnitin/lib.php');
$pluginturnitin = new plagiarism_plugin_turnitin();
$cm = get_coursemodule_from_instance($modulename, $assignmentid);
$plagiarismsettings = $pluginturnitin->get_settings($cm->id);
}
}

// Add in selected rubric if it belongs to another instructor.
if (!empty($assignmentid)) {
if ($modulename == "turnitintooltwo") {
if (!empty($turnitintooltwoassignment->turnitintooltwo->rubric)) {
$options[$turnitintooltwoassignment->turnitintooltwo->rubric] =
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_turnitintooltwo_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ protected function define_structure() {

// Define file annotations
$turnitintooltwo->annotate_files('mod_turnitintooltwo', 'intro', null); // This file area hasn't itemid
$submission->annotate_files('mod_turnitintooltwo', 'submission', 'id');
$submission->annotate_files('mod_turnitintooltwo', 'submissions', 'id');

// Return the root element (turnitintooltwo), wrapped into standard activity structure
return $this->prepare_activity_structure($turnitintooltwo);
Expand Down
5 changes: 4 additions & 1 deletion backup/moodle2/restore_turnitintooltwo_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected function process_turnitintooltwo_submissions($data) {
}

$newitemid = $DB->insert_record('turnitintooltwo_submissions', $data);
$this->set_mapping('turnitintooltwo_submissions', $oldid, $newitemid);
$this->set_mapping('turnitintooltwo_submissions', $oldid, $newitemid, true);
}

protected function after_execute() {
Expand All @@ -165,5 +165,8 @@ protected function after_execute() {
$_SESSION["assignments_to_create"][] = $_SESSION['assignment_id'];
unset($_SESSION['assignment_id']);
}

// Add turnitin related files, itemid based on mapping 'turnitintooltwo_submissions'.
$this->add_related_files('mod_turnitintooltwo', 'submissions', 'turnitintooltwo_submissions');
}
}
26 changes: 26 additions & 0 deletions classes/nonsubmitters/nonsubmitters_message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

class nonsubmitters_message {

/**
* Send non-submitters message to students.
*
* @param string $message
* @return void
*/
public function send_message($userid, $subject, $message) {
$eventdata = new stdClass();
$eventdata->component = 'mod_turnitintooltwo'; //your component name
$eventdata->name = 'nonsubmitters'; //this is the message name from messages.php
$eventdata->userfrom = get_admin();
$eventdata->userto = $userid;
$eventdata->subject = $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->notification = 1; //this is only set to 0 for personal messages between users

message_send($eventdata);
}
}
4 changes: 2 additions & 2 deletions css/font-awesome.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit fc8f1ca

Please sign in to comment.