Skip to content

Commit

Permalink
Show link to attempts list only if student attemtps exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
gustav_delius committed Jun 4, 2005
1 parent a21fc2b commit e0b0ef3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mod/quiz/view.php
Expand Up @@ -113,13 +113,14 @@
// This is all the teacher will get
if ($isteacher) {

$attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0);
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;

notify("<a href=\"report.php?mode=overview&amp;id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>");
$strviewallanswers = get_string("viewallanswers", "quiz", $attemptcount);
$usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)');
$strusers = $course->students;

notify("<a href=\"report.php?mode=overview&amp;id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>");
}
print_footer($course);
exit;
}
Expand Down

0 comments on commit e0b0ef3

Please sign in to comment.