diff --git a/lang/en/plagiarism_turnitin.php b/lang/en/plagiarism_turnitin.php index 5719d48..dcc5a41 100644 --- a/lang/en/plagiarism_turnitin.php +++ b/lang/en/plagiarism_turnitin.php @@ -62,6 +62,7 @@ $string['submitonfinal'] = 'Submit file when student sends for marking'; $string['teacherlogin'] = 'Login to Turnitin as Teacher'; $string['turnitindefaults'] = 'Turnitin Defaults'; +$string['turnitinerrors'] = 'Turnitin Errors'; $string['tii'] = 'Turnitin'; $string['tiiaccountid'] ='Turnitin Account ID'; $string['tiiaccountid_help'] ='This is your Account ID as provided from Turnitin.com'; @@ -88,7 +89,7 @@ $string['tiierrorpaperfail'] = 'Turnitin could not process this file.'; $string['tiierrorpending'] ='File pending submission to Turnitin'; $string['tiiexplain'] = 'Turnitin is a commercial product and you must have a paid subscription to use this service; for more information see http://docs.moodle.org/en/Turnitin_administration'; -$string['tiiexplainerrors'] = 'This page lists any files submitted to Turnitin that are currently in an error state. A list of turnitin Error codes and their description is available here:docs.moodle.org/en/Turnitin_errors
When files are reset, the cron will attempt to submit the file to turnitin again.
NOTE: files with errors in the range 1000-1999 will not benefit from being reset, and will probably always fail.'; +$string['tiiexplainerrors'] = 'This page lists any files submitted to Turnitin that are currently in an error state. A list of turnitin Error codes and their description is available here:docs.moodle.org/en/Turnitin_errors
When files are reset, the cron will attempt to submit the file to turnitin again.
When files are deleted on this page they will not be able to be resubmitted to turnitin and errors will no longer display to teachers or students'; $string['tiisecretkey'] ='Turnitin Secret Key'; $string['tiisecretkey_help'] ='Log into Turnitin.com as your site administrator to obtain this.'; $string['tiisenduseremail'] = 'Send User E-mail'; @@ -98,3 +99,7 @@ $string['turnitin_institutionnode_help'] = 'If you have setup/purchased an institution node with your account enable this to allow the node to be selected when creating assignments. NOTE: if you do not have an institution node, enabling this setting will cause your paper submission to fail.'; $string['useturnitin'] ='Enable Turnitin'; $string['wordcount'] = 'Word count'; +$string['resubmit'] = 'Resubmit'; +$string['fileresubmitted'] = 'File Queued for resubmission'; +$string['filedeleted'] = 'File deleted from queue'; +$string['module'] = 'Module'; \ No newline at end of file diff --git a/lib.php b/lib.php index 2ca2e29..447aa87 100644 --- a/lib.php +++ b/lib.php @@ -19,7 +19,7 @@ * lib.php - Contains Turnitin soecific functions called by Modules. * * @since 2.0 - * @package moodlecore + * @package plagiarism_turnitin * @subpackage plagiarism * @copyright 2010 Dan Marsden http://danmarsden.com * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/settings.php b/settings.php index 292db37..999a5e2 100644 --- a/settings.php +++ b/settings.php @@ -17,7 +17,7 @@ /** * plagiarism.php - allows the admin to configure plagiarism stuff * - * @package administration + * @package plagiarism_turnitin * @author Dan Marsden * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/turnitin_defaults.php b/turnitin_defaults.php index f159d74..2347174 100644 --- a/turnitin_defaults.php +++ b/turnitin_defaults.php @@ -17,7 +17,7 @@ /** * turnitin_errors.php - Displays Turnitin files with a current error state. * - * @package administration + * @package plagiarism_turnitin * @author Dan Marsden * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/turnitin_errors.php b/turnitin_errors.php new file mode 100644 index 0000000..a9105de --- /dev/null +++ b/turnitin_errors.php @@ -0,0 +1,99 @@ +. + +/** + * turnitin_errors.php - Displays Turnitin files with a current error state. + * + * @package plagiarism_turnitin + * @author Dan Marsden + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +require_once(dirname(dirname(__FILE__)) . '/../config.php'); +require_once($CFG->libdir.'/adminlib.php'); +require_once($CFG->libdir.'/plagiarismlib.php'); +require_once($CFG->dirroot.'/plagiarism/turnitin/lib.php'); +require_once('turnitin_form.php'); + +require_login(); +admin_externalpage_setup('plagiarismturnitin'); + +$id = optional_param('id',0,PARAM_INT); +$resetuser = optional_param('reset',0,PARAM_INT); +$delete = optional_param('delete', 0, PARAM_INT); +$page = optional_param('page', 0, PARAM_INT); +$limit = 20; +$baseurl = new moodle_url('turnitin_errors.php', array('page' => $page)); + +echo $OUTPUT->header(); +$currenttab='turnitinerrors'; +require_once('turnitin_tabs.php'); + +echo $OUTPUT->box(get_string('tiiexplainerrors','plagiarism_turnitin')); +$sqlallfiles = "SELECT t.*, u.firstname, u.lastname, u.id as userid, m.name as moduletype FROM {turnitin_files} t, {user} u, {modules} m, {course_modules} cm WHERE m.id=cm.module AND cm.id=t.cm AND t.userid=u.id AND t.statuscode <>'success' AND t.statuscode <>'pending' AND t.statuscode <> '51'"; +$sqlcount = "SELECT COUNT(id) FROM {turnitin_files} WHERE statuscode <>'success' AND statuscode <>'pending' AND statuscode <> '51'"; +if ($resetuser==1 && $id) { + $tfile = $DB->get_record('turnitin_files', array('id'=>$id)); + $tfile->statuscode = 'pending'; + if ($DB->update_record('turnitin_files', $tfile)) { + notify(get_string('fileresubmitted','plagiarism_turnitin')); + } +} elseif ($resetuser==2) { + $tiifiles = get_records_sql($sqlallfiles); + foreach($tiifiles as $tiifile) { + $tiifile->statuscode = 'pending'; + if ($DB->update_record('turnitin_files', $tiifile)) { + notify(get_string('fileresubmitted','plagiarism_turnitin')); + } + } + } +if (!empty($delete)) { + $DB->delete_records('turnitin_files', array('id'=>$id)); + notify(get_string('filedeleted','plagiarism_turnitin')); + +} + +$count = $DB->count_records_sql($sqlcount); + +$turnitin_files = $DB->get_records_sql($sqlallfiles." LIMIT ".$page*$limit.', '.$limit); + + +$table = new html_table(); +$table->head = array(get_string('name'), + get_string('module', 'plagiarism_turnitin'), + get_string('file'), + get_string('status'), ''); +$table->align = array ("left", "left", "left", "center", "center"); +$table->width = "95%"; +foreach ($turnitin_files as $tf) { + $user = "".fullname($tf).""; + + $reset = ''.get_string('resubmit','plagiarism_turnitin').' | '. + ''.get_string('delete').''; + $cmlink = ''.get_string('module', 'plagiarism_turnitin').''; + $table->data[] = array ($user, + $cmlink, + $tf->identifier, + $tf->statuscode, + $reset); +} + if (!empty($table)) { + echo html_writer::table($table); + echo $OUTPUT->paging_bar($count, $page, $limit, $baseurl); + } + +echo $OUTPUT->footer(); \ No newline at end of file diff --git a/turnitin_tabs.php b/turnitin_tabs.php index 502de53..bec008c 100644 --- a/turnitin_tabs.php +++ b/turnitin_tabs.php @@ -1,8 +1,10 @@