// Check if run in last 30min. echo $OUTPUT->box(get_string('cronwarning', 'plagiarism_urkund'), 'generalbox admin warning'); } $warning = ''; if (!empty($a->countallevents)) { $warning = ' warning'; } echo $OUTPUT->box(get_string('waitingevents', 'plagiarism_urkund', $a), 'generalbox admin' . $warning) . "<br/>"; if ($resetuser == 1 && $id && confirm_sesskey()) { if (urkund_reset_file($id)) { echo $OUTPUT->notification(get_string('fileresubmitted', 'plagiarism_urkund')); } } else { if ($resetuser == 2 && $id && confirm_sesskey()) { $plagiarismfile = $DB->get_record('plagiarism_urkund_files', array('id' => $id), '*', MUST_EXIST); $file = urkund_get_score(plagiarism_plugin_urkund::get_settings(), $plagiarismfile, true); // Reset attempts as this was a manual check. $file->attempt = $file->attempt - 1; $DB->update_record('plagiarism_urkund_files', $file); if ($file->statuscode == URKUND_STATUSCODE_ACCEPTED) { echo $OUTPUT->notification(get_string('scorenotavailableyet', 'plagiarism_urkund')); } else { if ($file->statuscode == URKUND_STATUSCODE_PROCESSED) { echo $OUTPUT->notification(get_string('scoreavailable', 'plagiarism_urkund')); } else { echo $OUTPUT->notification(get_string('unknownwarning', 'plagiarism_urkund')); print_object($file); } } } }
/** * Used to obtain similarity scores from URKUND for submitted files. * * @param object $plagiarismsettings - from a call to plagiarism_get_settings. * */ function urkund_get_scores($plagiarismsettings) { global $DB; mtrace("getting URKUND similarity scores"); // Get all files set that have been submitted. $files = $DB->get_recordset('plagiarism_urkund_files', array('statuscode' => URKUND_STATUSCODE_ACCEPTED)); foreach ($files as $plagiarismfile) { urkund_get_score($plagiarismsettings, $plagiarismfile); } $files->close(); // Get all old files using the old identifier. $files = $DB->get_recordset('plagiarism_urkund_files', array('statuscode' => URKUND_STATUSCODE_ACCEPTED_OLD)); foreach ($files as $plagiarismfile) { urkund_get_score($plagiarismsettings, $plagiarismfile); } $files->close(); }