mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Quiz grades can be set to zero.
If so, then grades are not shown to students, nor is a column added to the gradebook (although they are still stored and calculated internally)
This commit is contained in:
parent
5721d84f89
commit
ed1daaa9d7
@ -134,7 +134,9 @@
|
||||
$strscore = get_string("score", "quiz");
|
||||
|
||||
print_heading("$strscore: $result->sumgrades/$quiz->sumgrades ($result->percentage %)");
|
||||
print_heading("$strgrade: $result->grade/$quiz->grade");
|
||||
if ($quiz->grade) {
|
||||
print_heading("$strgrade: $result->grade/$quiz->grade");
|
||||
}
|
||||
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
|
@ -210,6 +210,11 @@ function quiz_cron () {
|
||||
function quiz_grades($quizid) {
|
||||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
|
||||
$quiz = get_record("quiz", "id", $quizid);
|
||||
if (empty($quiz) or empty($quiz->grade)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$return->grades = get_records_menu("quiz_grades", "quiz", $quizid, "", "userid,grade");
|
||||
$return->maxgrade = get_field("quiz", "grade", "id", "$quizid");
|
||||
return $return;
|
||||
|
@ -41,7 +41,7 @@
|
||||
$form->shuffleanswers = 1;
|
||||
}
|
||||
if (!isset($form->grade)) {
|
||||
$form->grade = "";
|
||||
$form->grade = 0;
|
||||
}
|
||||
if (!isset($form->questions)) {
|
||||
$form->questions = "";
|
||||
@ -202,7 +202,7 @@
|
||||
<td align=right><p><b><?php print_string("maximumgrade") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
for ($i=100; $i>=0; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
choose_from_menu($grades, "grade", "$form->grade", "");
|
||||
|
@ -103,7 +103,9 @@
|
||||
$table->data[] = array("$strtimetaken:", $timetaken);
|
||||
$table->data[] = array("$strtimecompleted:", userdate($attempt->timefinish));
|
||||
$table->data[] = array("$strscore:", "$result->sumgrades/$quiz->sumgrades ($result->percentage %)");
|
||||
$table->data[] = array("$strgrade:", "$result->grade/$quiz->grade");
|
||||
if ($quiz->grade) {
|
||||
$table->data[] = array("$strgrade:", "$result->grade/$quiz->grade");
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
|
@ -101,26 +101,42 @@
|
||||
$mygrade = quiz_get_best_grade($quiz->id, $USER->id);
|
||||
|
||||
if ($numattempts) {
|
||||
$table->head = array($strattempt, $strtimetaken, $strtimecompleted, "$strgrade / $quiz->grade");
|
||||
$table->align = array("center", "center", "left", "right");
|
||||
$table->width = array("", "", "", "");
|
||||
if ($quiz->grade) {
|
||||
$table->head = array($strattempt, $strtimetaken, $strtimecompleted, "$strgrade / $quiz->grade");
|
||||
$table->align = array("center", "center", "left", "right");
|
||||
$table->width = array("", "", "", "");
|
||||
} else { // No grades are being used
|
||||
$table->head = array($strattempt, $strtimetaken, $strtimecompleted);
|
||||
$table->align = array("center", "center", "left");
|
||||
$table->width = array("", "", "");
|
||||
}
|
||||
foreach ($attempts as $attempt) {
|
||||
if ($timetaken = ($attempt->timefinish - $attempt->timestart)) {
|
||||
$timetaken = format_time($timetaken);
|
||||
} else {
|
||||
$timetaken = "-";
|
||||
}
|
||||
$attemptgrade = format_float(($attempt->sumgrades/$quiz->sumgrades)*$quiz->grade);
|
||||
if ($attemptgrade == $mygrade) {
|
||||
$attemptgrade = "<span class=highlight>$attemptgrade</span>";
|
||||
if ($quiz->grade) {
|
||||
$attemptgrade = format_float(($attempt->sumgrades/$quiz->sumgrades)*$quiz->grade);
|
||||
if ($attemptgrade == $mygrade) {
|
||||
$attemptgrade = "<span class=highlight>$attemptgrade</span>";
|
||||
}
|
||||
if (!$available and $quiz->review) {
|
||||
$attemptgrade = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attemptgrade</a>";
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attempt->attempt</a>";
|
||||
}
|
||||
$table->data[] = array( $attempt->attempt,
|
||||
format_time($attempt->timefinish - $attempt->timestart),
|
||||
userdate($attempt->timefinish),
|
||||
$attemptgrade);
|
||||
} else { // No grades are being used
|
||||
if (!$available and $quiz->review) {
|
||||
$attempt->attempt = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attempt->attempt</a>";
|
||||
}
|
||||
$table->data[] = array( $attempt->attempt,
|
||||
format_time($attempt->timefinish - $attempt->timestart),
|
||||
userdate($attempt->timefinish));
|
||||
}
|
||||
if (!$available and $quiz->review) {
|
||||
$attemptgrade = "<a href=\"review.php?q=$quiz->id&attempt=$attempt->id\">$attemptgrade</a>";
|
||||
}
|
||||
$table->data[] = array( $attempt->attempt,
|
||||
format_time($attempt->timefinish - $attempt->timestart),
|
||||
userdate($attempt->timefinish),
|
||||
$attemptgrade);
|
||||
}
|
||||
print_table($table);
|
||||
}
|
||||
@ -140,7 +156,7 @@
|
||||
if ($numattempts < $quiz->attempts or !$quiz->attempts) {
|
||||
if ($available) {
|
||||
$options["id"] = $cm->id;
|
||||
if ($numattempts) {
|
||||
if ($numattempts and $quiz->grade) {
|
||||
print_heading("$strbestgrade: $mygrade / $quiz->grade.");
|
||||
}
|
||||
echo "<BR>";
|
||||
@ -150,7 +166,9 @@
|
||||
}
|
||||
} else {
|
||||
print_heading(get_string("nomoreattempts", "quiz"));
|
||||
print_heading(get_string("yourfinalgradeis", "quiz", "$mygrade / $quiz->grade"));
|
||||
if ($quiz->grade) {
|
||||
print_heading(get_string("yourfinalgradeis", "quiz", "$mygrade / $quiz->grade"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user