mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New modular plugin structure for quiz reports.
The code for reviewing an existing attempt is now separate in review.php and now has a log entry of it's own. The overview and regrade reports are now in separate subdirectories under the "report" directory. Each has a primary "report.php" file which implements the report as a class. These existing reports are very simple, but now more complex ones can easily be written. (I am about to do one).
- Loading branch information
moodler
committed
Jul 24, 2003
1 parent
350a05c
commit 29d5d0b
Showing
13 changed files
with
329 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?PHP // $Id$ | ||
|
||
//////////////////////////////////////////////////////////////////// | ||
/// Default class for report plugins | ||
/// | ||
/// Doesn't do anything on it's own -- it needs to be extended. | ||
/// This class displays quiz reports. Because it is called from | ||
/// within /mod/quiz/report.php you can assume that the page header | ||
/// and footer are taken care of. | ||
/// | ||
/// This file can refer to itself as report.php to pass variables | ||
/// to itself - all these will also be globally available. You must | ||
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname". | ||
//////////////////////////////////////////////////////////////////// | ||
|
||
// Included by ../report.php | ||
|
||
class quiz_default_report { | ||
|
||
function display($cm, $course, $quiz) { /// This function just displays the report | ||
return true; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?PHP // $Id$ | ||
|
||
/// Overview report just displays a big table of all the attempts | ||
|
||
class quiz_report extends quiz_default_report { | ||
|
||
function display($quiz, $cm, $course) { /// This function just displays the report | ||
|
||
global $CFG; | ||
|
||
if (!$grades = quiz_get_grade_records($quiz)) { | ||
return; | ||
} | ||
|
||
$strname = get_string("name"); | ||
$strattempts = get_string("attempts", "quiz"); | ||
$strbestgrade = get_string("bestgrade", "quiz"); | ||
|
||
$table->head = array(" ", $strname, $strattempts, "$strbestgrade /$quiz->grade"); | ||
$table->align = array("center", "left", "left", "center"); | ||
$table->width = array(10, "*", "*", 20); | ||
|
||
foreach ($grades as $grade) { | ||
$picture = print_user_picture($grade->userid, $course->id, $grade->picture, false, true); | ||
|
||
if ($attempts = quiz_get_user_attempts($quiz->id, $grade->userid)) { | ||
$userattempts = quiz_get_user_attempts_string($quiz, $attempts, $grade->grade); | ||
} | ||
|
||
$table->data[] = array ($picture, | ||
"<a href=\"$CFG->wwwroot/user/view.php?id=$grade->userid&course=$course->id\">". | ||
"$grade->firstname $grade->lastname</a>", | ||
"$userattempts", round($grade->grade,0)); | ||
} | ||
|
||
print_table($table); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.