From: moodler Date: Sun, 24 Sep 2006 13:54:22 +0000 (+0000) Subject: Better use of mod/quiz:view to hide quiz information (they already have the X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=847a041fb73f208f9735328b92a47cea312214d5;p=moodle.git Better use of mod/quiz:view to hide quiz information (they already have the name from the course page etc) --- diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 1912dc7b96..fbabffb680 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -39,7 +39,6 @@ // Check login and get context. require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); - require_capability('mod/quiz:view', $context); // if no questions have been set up yet redirect to edit.php if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { @@ -79,34 +78,41 @@ $currenttab = 'info'; include('tabs.php'); - // Print quiz name and description. + // Print quiz name + print_heading(format_string($quiz->name)); - if (trim(strip_tags($quiz->intro))) { - $formatoptions->noclean = true; - print_simple_box(format_text($quiz->intro, FORMAT_MOODLE, $formatoptions), "center"); - } + if (has_capability('mod/quiz:view', $context)) { - // Print information about number of attempts and grading method. - if ($quiz->attempts > 1) { - echo "

".get_string("attemptsallowed", "quiz").": $quiz->attempts

"; - } - if ($quiz->attempts != 1) { - echo "

".get_string("grademethod", "quiz").": ".$QUIZ_GRADE_METHOD[$quiz->grademethod]."

"; - } + // Print quiz description + if (trim(strip_tags($quiz->intro))) { + $formatoptions->noclean = true; + print_simple_box(format_text($quiz->intro, FORMAT_MOODLE, $formatoptions), "center"); + } - // Print information about timings. - $timenow = time(); - $available = ($quiz->timeopen < $timenow and ($timenow < $quiz->timeclose or !$quiz->timeclose)); - if ($available) { - if ($quiz->timelimit) { - echo "

".get_string("quiztimelimit","quiz", format_time($quiz->timelimit * 60))."

"; + // Print information about number of attempts and grading method. + if ($quiz->attempts > 1) { + echo "

".get_string("attemptsallowed", "quiz").": $quiz->attempts

"; + } + if ($quiz->attempts != 1) { + echo "

".get_string("grademethod", "quiz").": ".$QUIZ_GRADE_METHOD[$quiz->grademethod]."

"; + } + + // Print information about timings. + $timenow = time(); + $available = ($quiz->timeopen < $timenow and ($timenow < $quiz->timeclose or !$quiz->timeclose)); + if ($available) { + if ($quiz->timelimit) { + echo "

".get_string("quiztimelimit","quiz", format_time($quiz->timelimit * 60))."

"; + } + quiz_view_dates($quiz); + } else if ($timenow < $quiz->timeopen) { + echo "

".get_string("quiznotavailable", "quiz", userdate($quiz->timeopen)); + } else { + echo "

".get_string("quizclosed", "quiz", userdate($quiz->timeclose)); } - quiz_view_dates($quiz); - } else if ($timenow < $quiz->timeopen) { - echo "

".get_string("quiznotavailable", "quiz", userdate($quiz->timeopen)); } else { - echo "

".get_string("quizclosed", "quiz", userdate($quiz->timeclose)); + $available = false; } // Show number of attempts summary to those who can view reports.