$query .= "({$userid},'{$cid}','gbviewasid','{$line['assessmentid']}',{$now})"; mysql_query($query) or die("Query failed : " . mysql_error()); } echo "<h4>{$line['name']}</h4>\n"; echo "<p>Started: " . tzdate("F j, Y, g:i a", $line['starttime']) . "<BR>\n"; if ($line['endtime'] == 0) { echo "Not Submitted</p>\n"; } else { echo "Last change: " . tzdate("F j, Y, g:i a", $line['endtime']) . "</p>\n"; } $query = "SELECT COUNT(id) from imas_questions WHERE assessmentid='{$line['assessmentid']}' AND category<>'0'"; $result = mysql_query($query) or die("Query failed : {$query}; " . mysql_error()); if (mysql_result($result, 0, 0) > 0) { include "../assessment/catscores.php"; $sp = explode(';', $line['bestscores']); catscores(explode(',', $line['questions']), explode(',', $sp[0]), $line['defpoints'], $line['defoutcome'], $cid); } $scores = array(); $qs = explode(',', $line['questions']); $sp = explode(';', $line['bestscores']); foreach (explode(',', $sp[0]) as $k => $score) { $scores[$qs[$k]] = getpts($score); } echo "<h4>Question Breakdown</h4>\n"; echo "<table cellpadding=5 class=gb><thead><tr><th>Question</th><th>Points / Possible</th></tr></thead><tbody>\n"; $query = "SELECT imas_questionset.description,imas_questions.id,imas_questions.points,imas_questions.withdrawn FROM imas_questionset,imas_questions WHERE imas_questionset.id=imas_questions.questionsetid"; $query .= " AND imas_questions.id IN ({$line['questions']})"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $i = 1; $totpt = 0; $totposs = 0;
} else { echo 0; } echo " minutes</p>\n"; } else { echo '</tbody></table>'; } //echo "<p><a href=\"gradebook.php?stu=$stu&cid=$cid\">Return to GradeBook</a></p>\n"; echo '<p>Items with grade link <span class="manualgrade">highlighted</span> require manual grading.<br/>'; echo "Note: Average Attempts, Regens, and Time only counts those who attempted the problem<br/>"; echo 'All averages only include those who have started the assessment</p>'; $query = "SELECT COUNT(id) from imas_questions WHERE assessmentid='{$aid}' AND category<>'0'"; $result = mysql_query($query) or die("Query failed : {$query}; " . mysql_error()); if (mysql_result($result, 0, 0) > 0) { include "../assessment/catscores.php"; catscores($qs, $avgscore, $defpoints, $defoutcome, $cid); } echo '<div class="cpmid">Experimental:<br/>'; echo "<a href=\"gb-itemresults.php?cid={$cid}&aid={$aid}\">Summary of assessment results</a> (only meaningful for non-randomized questions)<br/>"; echo "<a href=\"gb-aidexport.php?cid={$cid}&aid={$aid}\">Export student answer details</a></div>"; require "../footer.php"; function getpts($sc) { if (strpos($sc, '~') === false) { if ($sc > 0) { return $sc; } else { return 0; } } else { $sc = explode('~', $sc);
function showscores($questions, $attempts, $testsettings) { global $isdiag, $allowregen, $isreview, $noindivscores, $scores, $bestscores, $qi, $superdone, $timelimitkickout, $reviewatend; $total = 0; $lastattempttotal = 0; for ($i = 0; $i < count($bestscores); $i++) { if (getpts($bestscores[$i]) > 0) { $total += getpts($bestscores[$i]); } if (getpts($scores[$i]) > 0) { $lastattempttotal += getpts($scores[$i]); } } $totpossible = totalpointspossible($qi); $average = round(100 * (double) $total / (double) $totpossible, 1); $doendredirect = false; $outmsg = ''; if ($testsettings['endmsg'] != '') { $endmsg = unserialize($testsettings['endmsg']); $redirecturl = ''; if (isset($endmsg['msgs'])) { foreach ($endmsg['msgs'] as $sc => $msg) { //array must be reverse sorted if ($endmsg['type'] == 0 && $total >= $sc || $endmsg['type'] == 1 && $average >= $sc) { $outmsg = $msg; break; } } if ($outmsg == '') { $outmsg = $endmsg['def']; } if (!isset($endmsg['commonmsg'])) { $endmsg['commonmsg'] = ''; } if (strpos($outmsg, 'redirectto:') !== false) { $redirecturl = trim(substr($outmsg, 11)); echo "<input type=\"button\" value=\"", _('Continue'), "\" onclick=\"window.location.href='{$redirecturl}'\"/>"; return false; } } } if ($isdiag) { global $userid; $query = "SELECT * from imas_users WHERE id='{$userid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $userinfo = mysql_fetch_array($result, MYSQL_ASSOC); echo "<h3>{$userinfo['LastName']}, {$userinfo['FirstName']}: "; echo substr($userinfo['SID'], 0, strpos($userinfo['SID'], '~')); echo "</h3>\n"; } echo "<h3>", _('Scores:'), "</h3>\n"; if (!$noindivscores && !$reviewatend) { echo "<table class=scores>"; for ($i = 0; $i < count($scores); $i++) { echo "<tr><td>"; if ($bestscores[$i] == -1) { $bestscores[$i] = 0; } if ($scores[$i] == -1) { $scores[$i] = 0; echo _('Question') . ' ' . ($i + 1) . ': </td><td>'; echo _('Last attempt: '); echo _('Not answered'); echo "</td>"; echo "<td> ", _('Score in Gradebook: '); echo printscore($bestscores[$i], $i); echo "</td>"; echo "</tr>\n"; } else { echo _('Question') . ' ' . ($i + 1) . ': </td><td>'; echo _('Last attempt: '); echo printscore($scores[$i], $i); echo "</td>"; echo "<td> ", _('Score in Gradebook: '); echo printscore($bestscores[$i], $i); echo "</td>"; echo "</tr>\n"; } } echo "</table>"; } global $testid; recordtestdata(); if ($testsettings['testtype'] != "NoScores") { echo "<p>", sprintf(_('Total Points on Last Attempts: %d out of %d possible'), $lastattempttotal, $totpossible), "</p>\n"; //if ($total<$testsettings['minscore']) { if ($testsettings['minscore'] < 10000 && $total < $testsettings['minscore'] || $testsettings['minscore'] > 10000 && $total < ($testsettings['minscore'] - 10000) / 100 * $totpossible) { echo "<p><b>", sprintf(_('Total Points Earned: %d out of %d possible: '), $total, $totpossible); } else { echo "<p><b>", sprintf(_('Total Points in Gradebook: %d out of %d possible: '), $total, $totpossible); } echo "{$average} % </b></p>\n"; if ($outmsg != '') { echo "<p style=\"color:red;font-weight: bold;\">{$outmsg}</p>"; if ($endmsg['commonmsg'] != '' && $endmsg['commonmsg'] != '<p></p>') { echo $endmsg['commonmsg']; } } //if ($total<$testsettings['minscore']) { if ($testsettings['minscore'] < 10000 && $total < $testsettings['minscore'] || $testsettings['minscore'] > 10000 && $total < ($testsettings['minscore'] - 10000) / 100 * $totpossible) { if ($testsettings['minscore'] < 10000) { $reqscore = $testsettings['minscore']; } else { $reqscore = $testsettings['minscore'] - 10000 . '%'; } echo "<p><span style=\"color:red;\"><b>", sprintf(_('A score of %s is required to receive credit for this assessment'), $reqscore), "<br/>", _('Grade in Gradebook: No Credit (NC)'), "</span></p> "; } } else { echo "<p><b>", _('Your scores have been recorded for this assessment.'), "</b></p>"; } //if timelimit is exceeded $now = time(); if (!$timelimitkickout && $testsettings['timelimit'] > 0 && $now - $GLOBALS['starttime'] > $testsettings['timelimit']) { $over = $now - $GLOBALS['starttime'] - $testsettings['timelimit']; echo "<p>", _('Time limit exceeded by'), " "; if ($over > 60) { $overmin = floor($over / 60); echo "{$overmin} ", _('minutes'), ", "; $over = $over - $overmin * 60; } echo "{$over} ", _('seconds'), ".<br/>\n"; echo _('Grade is subject to acceptance by the instructor'), "</p>\n"; } if (!$superdone) { // $total < $totpossible && if ($noindivscores) { echo "<p>", _('<a href="showtest.php?reattempt=all">Reattempt assessment</a> on questions allowed (note: where reattempts are allowed, all scores, correct and incorrect, will be cleared)'), "</p>"; } else { if (canimproveany()) { echo "<p>", _('<a href="showtest.php?reattempt=canimprove">Reattempt assessment</a> on questions that can be improved where allowed'), "</p>"; } if (hasreattemptsany()) { echo "<p>", _('<a href="showtest.php?reattempt=all">Reattempt assessment</a> on all questions where allowed'), "</p>"; } } if ($allowregen) { echo "<p>", _('<a href="showtest.php?regenall=missed">Try similar problems</a> for all questions with less than perfect scores where allowed.'), "</p>"; echo "<p>", _('<a href="showtest.php?regenall=all">Try similar problems</a> for all questions where allowed.'), "</p>"; } } if ($testsettings['testtype'] != "NoScores") { $hascatset = false; foreach ($qi as $qii) { if ($qii['category'] != '0') { $hascatset = true; break; } } if ($hascatset) { include "../assessment/catscores.php"; catscores($questions, $bestscores, $testsettings['defpoints'], $testsettings['defoutcome'], $testsettings['courseid']); } } if ($reviewatend) { global $testtype, $scores, $saenddate, $isteacher, $istutor, $seeds, $attempts, $rawscores, $noraw; $showa = false; for ($i = 0; $i < count($questions); $i++) { echo '<div>'; if (!$noraw) { if (strpos($rawscores[$i], '~') !== false) { $col = explode('~', $rawscores[$i]); } else { $col = array($rawscores[$i]); } } else { $col = scorestocolors($noraw ? $scores[$i] : $rawscores[$i], $qi[$questions[$i]]['points'], $qi[$questions[$i]]['answeights'], $noraw); } displayq($i, $qi[$questions[$i]]['questionsetid'], $seeds[$i], $showa, false, $attempts[$i], false, false, false, $col); echo "<div class=review>", _('Question') . " " . ($i + 1) . ". ", _('Last Attempt:'); echo printscore($scores[$i], $i); echo '<br/>', _('Score in Gradebook: '); echo printscore($bestscores[$i], $i); echo '</div>'; } } return true; }