/** * Outputs the file path for the user passed in the $userid parameter * * @global object * @global object * @param object $cm The moodle course module object for this instance * @param object $turnitintool The turnitintool object for this activity * @param object $submission A data object for the submission in turnitintool_submissions * @return string A formatted html similarity score box with similarity score or '-' if it is not to be displayed or unavailable */ function turnitintool_draw_similarityscore($cm, $turnitintool, $submission) { global $CFG, $USER; if (empty($submission->submission_objectid)) { $score = '-'; } else { $result = $submission->submission_score; $objectid = $submission->submission_objectid; if (!is_null($objectid) and (has_capability('mod/turnitintool:grade', turnitintool_get_context('MODULE', $cm->id)) or $turnitintool->studentreports)) { if (has_capability('mod/turnitintool:grade', turnitintool_get_context('MODULE', $cm->id))) { $utp = 2; } else { $utp = 1; } $thisuser = $USER; if (!is_null($result) and !empty($result) and $result != "-2" or $result == "0") { $style = turnitintool_percent_to_gradpos($result); $style2 = ""; $result .= '%'; $reportlink = $CFG->wwwroot . '/mod/turnitintool/view.php?id=' . $cm->id . '&jumppage=report'; $reportlink .= '&userid=' . $thisuser->id . '&objectid=' . $submission->submission_objectid . '&utp=' . $utp; $transmatch = $submission->submission_transmatch == 1 ? 'EN' : ' '; $score = '<div class="origLink"><a href="' . $reportlink . '" target="_blank" title="' . get_string('viewreport', 'turnitintool') . '" class="scoreLink" onclick="screenOpen(\'' . $reportlink . '\',\'' . $submission->id . '\',\'' . $turnitintool->autoupdates . '\');return false;"><span class="scoreBox"' . $style2 . '>' . $result . '<span class="scoreColor"' . $style . '>' . $transmatch . '</span></span></a></div>'; } elseif ($result == -2) { $color = '#FCFCFC'; $style = ' style="background-color: ' . $color . ';text-align: center;"'; $style2 = ' style="padding: 0px;"'; $score = '<div class="origLink">--</div>'; } else { $color = '#FCFCFC'; $style = ' style="background-color: ' . $color . ';text-align: center;"'; $style2 = ' style="padding: 0px;"'; $result = get_string('pending', 'turnitintool'); $score = '<div class="origLink"> <a name="Pending" class="scoreLink"' . $style . '><span class="scoreBox"' . $style2 . '>' . $result . '</span></a></div>'; } } else { $score = '-'; } } return $score; }
/** * Outputs the file path for the user passed in the $userid parameter * * @global object * @global object * @param object $cm The moodle course module object for this instance * @param object $turnitintool The turnitintool object for this activity * @param object $submission A data object for the submission in turnitintool_submissions * @return string A formatted html similarity score box with similarity score or '-' if it is not to be displayed or unavailable */ function turnitintool_draw_similarityscore($cm, $turnitintool, $submission) { global $CFG, $USER; if (empty($submission->submission_objectid)) { $score = '-'; } else { $result = $submission->submission_score; $objectid = $submission->submission_objectid; if (!($part = turnitintool_get_record('turnitintool_parts', 'id', $submission->submission_part))) { turnitintool_print_error('partgeterror', 'turnitintool', NULL, NULL, __FILE__, __LINE__); exit; } if (!is_null($objectid) and (has_capability('mod/turnitintool:grade', get_context_instance(CONTEXT_MODULE, $cm->id)) or $turnitintool->studentreports)) { $owner = turnitintool_get_owner($turnitintool->course); if (has_capability('mod/turnitintool:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) { $utp = 2; } else { $utp = 1; } $thisuser = $USER; if (!is_null($result) and !empty($result) or $result == "0") { $style = turnitintool_percent_to_gradpos($result); $style2 = ""; $result .= '%'; $reportlink = $CFG->wwwroot . '/mod/turnitintool/view.php?id=' . $cm->id . '&jumppage=report'; $reportlink .= '&userid=' . $thisuser->id . '&objectid=' . $submission->submission_objectid . '&utp=' . $utp; $score = '<div class="origLink"><a href="' . $reportlink . '" target="_blank" title="' . get_string('viewreport', 'turnitintool') . '" class="scoreLink"' . $style . ' onclick="screenOpen(\'' . $reportlink . '\',\'' . $submission->id . '\',\'' . $turnitintool->autoupdates . '\');return false;"><span class="scoreBox"' . $style2 . '>' . $result . '</span></a></div>'; } else { $color = '#FCFCFC'; $style = ' style="background-color: ' . $color . ';text-align: center;"'; $style2 = ' style="padding: 0px;"'; $result = get_string('pending', 'turnitintool'); $score = '<div class="origLink"> <a name="Pending" class="scoreLink"' . $style . '><span class="scoreBox"' . $style2 . '>' . $result . '</span></a></div>'; } } else { $score = '-'; } } return $score; }