2002-10-13 13:51:56 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
// This script uses installed report plugins to print quiz reports
|
2002-10-13 13:51:56 +00:00
|
|
|
|
2003-01-05 14:19:20 +00:00
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
2002-10-13 13:51:56 +00:00
|
|
|
|
|
|
|
optional_variable($id); // Course Module ID, or
|
|
|
|
optional_variable($q); // quiz ID
|
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
optional_variable($mode, "overview"); // Report mode
|
2002-10-21 15:00:51 +00:00
|
|
|
|
2002-10-13 13:51:56 +00:00
|
|
|
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", $q)) {
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (!isteacher($course->id)) {
|
2003-07-24 05:18:00 +00:00
|
|
|
error("You are not allowed to use this script");
|
2002-10-13 13:51:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
add_to_log($course->id, "quiz", "report", "report.php?id=$cm->id", "$quiz->id");
|
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
/// Print the page header
|
2003-07-28 02:04:58 +00:00
|
|
|
if (empty($noheader)) {
|
2002-10-13 13:51:56 +00:00
|
|
|
|
2003-07-28 02:04:58 +00:00
|
|
|
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");
|
|
|
|
$strreport = get_string("report", "quiz");
|
|
|
|
|
|
|
|
print_header("$course->shortname: $quiz->name", "$course->fullname",
|
|
|
|
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A>
|
|
|
|
-> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreport",
|
2003-12-29 09:24:16 +00:00
|
|
|
"", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
|
2003-07-28 02:04:58 +00:00
|
|
|
|
|
|
|
print_heading($quiz->name);
|
|
|
|
|
2002-10-22 04:25:58 +00:00
|
|
|
|
2003-07-28 02:04:58 +00:00
|
|
|
/// Print list of available quiz reports
|
|
|
|
|
2003-11-20 16:01:21 +00:00
|
|
|
$allreports = get_list_of_plugins("mod/quiz/report");
|
|
|
|
$reportlist = array ("overview", "regrade"); // Standard reports we want to show first
|
|
|
|
|
|
|
|
foreach ($allreports as $report) {
|
|
|
|
if (!in_array($report, $reportlist)) {
|
|
|
|
$reportlist[] = $report;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-28 02:04:58 +00:00
|
|
|
echo "<table cellpadding=10 align=center><tr>";
|
2003-11-20 16:01:21 +00:00
|
|
|
foreach ($reportlist as $report) {
|
2003-07-28 02:04:58 +00:00
|
|
|
$strreport = get_string("report$report", "quiz");
|
|
|
|
if ($report == $mode) {
|
|
|
|
echo "<td><u>$strreport</u></td>";
|
|
|
|
} else {
|
|
|
|
echo "<td><a href=\"report.php?id=$cm->id&mode=$report\">$strreport</a></td>";
|
|
|
|
}
|
2003-01-01 14:47:11 +00:00
|
|
|
}
|
2003-07-28 02:04:58 +00:00
|
|
|
echo "</tr></table><hr size=\"1\" noshade=\"noshade\" />";
|
2002-10-22 04:25:58 +00:00
|
|
|
}
|
|
|
|
|
2002-10-22 06:52:23 +00:00
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
/// Open the selected quiz report and display it
|
2002-10-22 06:52:23 +00:00
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
if (! is_readable("report/$mode/report.php")) {
|
|
|
|
error("Report not known ($mode)");
|
2002-10-22 06:52:23 +00:00
|
|
|
}
|
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
include("report/default.php"); // Parent class
|
|
|
|
include("report/$mode/report.php");
|
2002-10-13 13:51:56 +00:00
|
|
|
|
2003-07-24 05:18:00 +00:00
|
|
|
$report = new quiz_report();
|
2002-10-13 13:51:56 +00:00
|
|
|
|
2003-07-28 02:04:58 +00:00
|
|
|
if (! $report->display($quiz, $cm, $course)) { // Run the report!
|
2003-07-24 05:18:00 +00:00
|
|
|
error("Error occurred during pre-processing!");
|
2002-10-13 13:51:56 +00:00
|
|
|
}
|
|
|
|
|
2003-07-28 02:04:58 +00:00
|
|
|
if (empty($noheader)) {
|
|
|
|
print_footer($course);
|
|
|
|
}
|
|
|
|
|
2002-10-13 13:51:56 +00:00
|
|
|
|
|
|
|
?>
|