moodle/mod/quiz/view.php

62 lines
1.7 KiB
PHP
Raw Normal View History

<?PHP // $Id$
// This page prints a particular instance of quiz
require("../../config.php");
require("lib.php");
optional_variable($id); // Course Module ID, or
optional_variable($q); // quiz ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
if (! $quiz = get_record("quiz", "id", $cm->instance)) {
error("Course module is incorrect");
}
} else {
if (! $quiz = get_record("quiz", "id", $a)) {
error("Course module is incorrect");
}
if (! $course = get_record("course", "id", $quiz->course)) {
error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id)) {
error("Course Module ID was incorrect");
}
}
require_login($course->id);
add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", "$quiz->id");
// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
print_header("$course->shortname: $quiz->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> -> $quiz->name",
"", "", true, update_module_icon($cm->id, $course->id));
// Print the main part of the page
echo "YOUR CODE GOES HERE";
// Finish the page
print_footer($course);
?>