Fixed display of information about existing attempts.

This commit is contained in:
gustav_delius 2006-04-12 23:24:58 +00:00
parent 375ab4586f
commit ffa6ed53e4
5 changed files with 21 additions and 21 deletions

View File

@ -47,7 +47,7 @@ $string['attempts'] = 'Attempts';
$string['attemptsonly'] = 'Show only students with attempts';
$string['attemptsallowed'] = 'Attempts allowed';
$string['attemptselection'] = 'Select which attempts to analyze per user: ';
$string['attemptsexist'] = 'This quiz has already been attempted.<br />You can no longer add or remove questions.';
$string['attemptsexist'] = 'You can no longer add or remove questions.';
$string['attemptsunlimited'] = 'Unlimited attempts';
$string['back'] = 'Back to preview question';
$string['backtoquiz'] = 'Back to quiz editing';
@ -305,6 +305,7 @@ $string['notavailabletostudents'] = 'Note: This quiz is not currently available
$string['notenoughanswers'] = 'This type of question requires at least $a answers';
$string['notenoughsubquestions'] = 'Not enough sub-questions have been defined!<br />Do you want to go back and fix this question?';
$string['notimedependentitems'] = 'Time dependent items are not currently supported by the quiz module. As a work around, set a time limit for the whole quiz. Do you wish to choose a different item (or use the current item regardless)?';
$string['numattempts'] = '$a->studentnum $a->studentstring have made $a->attemptnum attempts';
$string['numberabbr'] = '#';
$string['numerical'] = 'Numerical';
$string['none']= 'None';

View File

@ -322,17 +322,14 @@ if (self.name == 'editquestion') {
print_simple_box_start("center");
$attemptcount = count_records('quiz_attempts', 'quiz', $modform->instance, 'preview', 0);
$strviewallanswers = get_string("viewallanswers","quiz",$attemptcount);
$strattemptsexist = get_string("attemptsexist","quiz");
$usercount = count_records_select('quiz_attempts', "quiz = '$modform->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$strusers = $course->students;
$a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0);
$a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$a->studentstring = $course->students;
if (! $cm = get_coursemodule_from_instance("quiz", $modform->instance, $course->id)) {
error("Course Module ID was incorrect");
}
echo "<center>\n";
echo "$strattemptsexist<br /><a href=\"report.php?mode=overview&amp;id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>";
echo "<a href=\"report.php?mode=overview&amp;id=$cm->id\">".get_string('numattempts', 'quiz', $a)."</a><br />".get_string("attemptsexist","quiz");
echo "</center><br/ >\n";
$sumgrades = quiz_print_question_list($modform, false, $SESSION->quiz_showbreaks, $SESSION->quiz_reordertool);

View File

@ -104,12 +104,11 @@
$closequiz = $quiz->timeclose ? userdate($quiz->timeclose) : '';
if (isteacher($course->id)) {
if ($usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)')) {
$attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0);
$strviewallreports = get_string('viewallreports', 'quiz', $attemptcount);
$gradecol = "<a href=\"report.php?mode=overview&amp;q=$quiz->id\">$strviewallreports ($usercount $strusers)</a>";
if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
$a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$a->studentstring = $course->students;
$gradecol = "<a href=\"report.php?mode=overview&amp;q=$quiz->id\">".get_string('numattempts', 'quiz', $a).'</a>';
} else {
$answercount = 0;
$gradecol = "";
}
} else {

View File

@ -62,7 +62,13 @@ class quiz_report extends quiz_default_report {
}
break;
}
/// Print information on the number of existing attempts
if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
$a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$a->studentstring = $course->students;
notify(get_string('numattempts', 'quiz', $a));
}
/// Check to see if groups are being used in this quiz
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
if (!$download) {

View File

@ -115,14 +115,11 @@
// This is all the teacher will get
if ($isteacher) {
if ($attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
$strviewallanswers = get_string("viewallanswers", "quiz", $attemptcount);
$usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$strusers = $course->students;
if ($a->attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) {
$a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$a->studentstring = $course->students;
notify("<a href=\"report.php?mode=overview&amp;id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>");
notify("<a href=\"report.php?mode=overview&amp;id=$cm->id\">".get_string('numattempts', 'quiz', $a).'</a>');
}
echo '</td></tr></table>';