Some work on the penalty mechanism. Took out the multiplicative scheme because it is just too difficult to understand. Made all question types print grading details when quiz is in adaptive mode. Made improvements to the presentation of the grading details. Enabled the penalty mechanism in a few more (on my way towards doing it for all).
This commit is contained in:
@@ -145,10 +145,6 @@
|
||||
$attemptoptions[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
|
||||
$penaltyoptions = array();
|
||||
$penaltyoptions[QUIZ_PENALTYNONE] = get_string('penaltynone', 'quiz');
|
||||
$penaltyoptions[QUIZ_PENALTYMULTIPLY] = get_string('penaltymultiply', 'quiz');
|
||||
$penaltyoptions[QUIZ_PENALTYSUBTRACT] = get_string('penaltysubtract', 'quiz');
|
||||
?>
|
||||
|
||||
<table cellpadding="9" cellspacing="0" align="center">
|
||||
@@ -300,7 +296,7 @@
|
||||
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($penaltyoptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
|
||||
+1
-1
@@ -335,7 +335,7 @@
|
||||
}
|
||||
|
||||
/// Delete any teacher preview attempts if the quiz has been modified
|
||||
if (isset($_REQUEST['delete']) or isset($_REQUEST['repaginate']) or isset($_REQUEST['addrandom']) or isset($_REQUEST['addquestion']) or isset($_REQUEST['up']) or isset($_REQUEST['down']) or isset($_REQUEST['add'])) {
|
||||
if (isset($_REQUEST['setgrades']) or isset($_REQUEST['delete']) or isset($_REQUEST['repaginate']) or isset($_REQUEST['addrandom']) or isset($_REQUEST['addquestion']) or isset($_REQUEST['up']) or isset($_REQUEST['down']) or isset($_REQUEST['add'])) {
|
||||
delete_records('quiz_attempts', 'preview', '1', 'quiz', $modform->id);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ $string['confirmattemptclose'] = 'You still have an unfinished attempt. Do you w
|
||||
$string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.';
|
||||
$string['continueattemptfail'] = 'Error: Could not load the last attempt';
|
||||
$string['continueattemptquiz'] = 'Continue the last attempt';
|
||||
$string['correct'] = 'Correct';
|
||||
$string['deleteitemtypecheck'] = 'Are you absolutely sure you want to delete \'$a\'?';
|
||||
$string['duplicateresponse'] = 'This submission has been ignored because you gave an equivalent answer earlier.';
|
||||
$string['editingitemtype'] = 'Editing an Item Type';
|
||||
@@ -35,11 +36,12 @@ $string['event3'] = 'Grade';
|
||||
$string['event5'] = 'Validate';
|
||||
$string['event6'] = 'Close';
|
||||
$string['fillcorrect'] = 'Fill with correct';
|
||||
$string['gradeavailable'] = 'Maximum possible marks: $a';
|
||||
$string['gradingdetails'] = 'Marks for this submission: $a->raw/$a->max.';
|
||||
$string['gradingdetailsnopenalty'] = 'Marks for this submission: $a->raw/$a->max. Counting all previous submissions this gives <strong>$a->cur/$a->max</strong>.';
|
||||
$string['gradingdetailszeropenalty'] = 'Marks for this submission: $a->raw/$a->max. You were not penalized for this submission. Counting all previous submissions this gives <strong>$a->cur/$a->max</strong>.';
|
||||
$string['gradingdetailspenalty'] = 'Marks for this submission: $a->raw/$a->max with a penalty of $a->penalty. Counting all previous submissions this gives <strong>$a->cur/$a->max</strong>.';
|
||||
$string['gradeavailable'] = 'Maximum possible marks: $a ';
|
||||
$string['gradingdetails'] = 'Marks for this submission: $a->raw/$a->max. ';
|
||||
$string['gradingdetailsadjustment'] = 'With previous penalties this gives <strong>$a->cur/$a->max</strong>. ';
|
||||
$string['gradingdetailszeropenalty'] = 'You were not penalized for this submission. ';
|
||||
$string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a. ';
|
||||
$string['incorrect'] = 'Incorrect';
|
||||
$string['info'] = 'Info';
|
||||
$string['invalidsource'] = 'The source is not accepted as valid by the server $a->rendering_server.';
|
||||
$string['invalidsourcetype'] = 'Invalid source type.';
|
||||
@@ -67,6 +69,7 @@ $string['notypes'] = 'No item types have been defined! The administrator must ad
|
||||
$string['notypeselected'] = 'No type selected';
|
||||
$string['numberabbr'] = '#';
|
||||
$string['outof'] = ' out of a maximum of ';
|
||||
$string['partiallycorrect'] = 'Partially correct';
|
||||
$string['penalty'] = 'Penalty';
|
||||
$string['penaltynone'] = 'None';
|
||||
$string['penaltymultiply'] = 'Multiplicative';
|
||||
|
||||
+44
-70
@@ -46,14 +46,6 @@ define('QUIZ_EVENTVALIDATE', '5');
|
||||
define('QUIZ_EVENTCLOSE', '6');
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* The different penalty schemes
|
||||
*/
|
||||
define('QUIZ_PENALTYNONE', '0');
|
||||
define('QUIZ_PENALTYMULTIPLY', '1');
|
||||
define('QUIZ_PENALTYSUBTRACT', '2');
|
||||
/**#@-*/
|
||||
|
||||
/**#@+
|
||||
* The defined question types
|
||||
*
|
||||
@@ -595,7 +587,7 @@ class quiz_default_questiontype {
|
||||
echo '<div class="grade">';
|
||||
echo get_string('marks', 'quiz').': ';
|
||||
if ($quiz->optionflags & QUIZ_ADAPTIVE) {
|
||||
echo '<br /> ';
|
||||
echo '<br />';
|
||||
echo ('' === $state->last_graded->grade) ? '--/' : format_float($state->last_graded->grade, $quiz->decimalpoints).'/';
|
||||
}
|
||||
echo $question->maxgrade.'</div>';
|
||||
@@ -608,7 +600,7 @@ class quiz_default_questiontype {
|
||||
|
||||
echo '</td></tr><tr><td valign="top">';
|
||||
|
||||
if ($options->scores) {
|
||||
if ($question->maxgrade and $options->scores and ($quiz->optionflags & QUIZ_ADAPTIVE)) {
|
||||
$this->print_question_grading_details($question, $state, $quiz, $options);
|
||||
}
|
||||
|
||||
@@ -699,14 +691,7 @@ class quiz_default_questiontype {
|
||||
* @param object $quiz The quiz to which the question belongs. The
|
||||
* grading details may be rendered differently
|
||||
* depending on the quiz settings.
|
||||
* @param object $options An object describing the rendering options. The
|
||||
* fields are:
|
||||
* ->readonly Review / interactive mode
|
||||
* ->feedback Show feedback
|
||||
* ->validation Show how the response was
|
||||
* interpreted
|
||||
* ->correct_responses Show solutions
|
||||
* These are all boolean values.
|
||||
* @param object $options An object describing the rendering options.
|
||||
*/
|
||||
function print_question_grading_details(&$question, &$state, $quiz, $options) {
|
||||
/* The default implementation prints the number of marks if no attempt
|
||||
@@ -716,35 +701,46 @@ class quiz_default_questiontype {
|
||||
responses (and penalties) */
|
||||
|
||||
if (!empty($question->maxgrade)) {
|
||||
echo '<div class="grading_details">';
|
||||
if (!('' === $state->last_graded->grade)) {
|
||||
// Display the grading details from the last graded state
|
||||
$grade->cur = format_float($state->last_graded->grade, $quiz->decimalpoints);
|
||||
$grade->max = $question->maxgrade;
|
||||
$grade->raw = format_float($state->last_graded->raw_grade, $quiz->decimalpoints);
|
||||
if (QUIZ_EVENTCLOSE == $state->event) {
|
||||
/* No further attempts are possible so don't bother
|
||||
displaying the penalty */
|
||||
print_string('gradingdetailsnopenalty', 'quiz', $grade);
|
||||
} else if ('' !== $state->last_graded->penalty && ((float)
|
||||
$state->last_graded->penalty) > 0.0) {
|
||||
// A penalty was applied so display it
|
||||
$grade->penalty = $state->last_graded->penalty;
|
||||
print_string('gradingdetailspenalty', 'quiz', $grade);
|
||||
} else if ($state->last_graded->raw_grade >=
|
||||
$question->maxgrade) {
|
||||
/* No penalty was applied because the response was
|
||||
correct so don't bother noting that no penalty was
|
||||
applied for the attempt */
|
||||
print_string('gradingdetailsnopenalty', 'quiz', $grade);
|
||||
|
||||
// let student know wether the answer was correct
|
||||
echo '<div class="correctness">';
|
||||
if ($state->last_graded->raw_grade >= $question->maxgrade) {
|
||||
print_string('correct', 'quiz');
|
||||
} else if ($state->last_graded->raw_grade > 0) {
|
||||
print_string('partiallycorrect', 'quiz');
|
||||
} else {
|
||||
/* No penalty was applied even though the answer was
|
||||
not correct (eg. a syntax error) so tell the student
|
||||
that they were not penalised for the attempt */
|
||||
print_string('gradingdetailszeropenalty', 'quiz', $grade);
|
||||
print_string('incorrect', 'quiz');
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
echo '<div class="gradingdetails">';
|
||||
// print grade for this submission
|
||||
print_string('gradingdetails', 'quiz', $grade);
|
||||
// print details of grade adjustment due to penalties
|
||||
if ($state->last_graded->raw_grade > $state->last_graded->grade){
|
||||
print_string('gradingdetailsadjustment', 'quiz', $grade);
|
||||
}
|
||||
// print info about new penalty
|
||||
// penalty is relevant only if the answer is not correct and further attempts are possible
|
||||
if (($state->last_graded->raw_grade < $question->maxgrade) and (QUIZ_EVENTCLOSE !== $state->event)) {
|
||||
if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
|
||||
// A penalty was applied so display it
|
||||
print_string('gradingdetailspenalty', 'quiz', $state->last_graded->penalty);
|
||||
} else {
|
||||
/* No penalty was applied even though the answer was
|
||||
not correct (eg. a syntax error) so tell the student
|
||||
that they were not penalised for the attempt */
|
||||
print_string('gradingdetailszeropenalty', 'quiz');
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,14 +775,6 @@ class quiz_default_questiontype {
|
||||
* question will likely be rendered differently
|
||||
* depending on the quiz settings.
|
||||
* @param object $options An object describing the rendering options.
|
||||
* The fields are:
|
||||
* ->readonly Review / interactive mode
|
||||
* ->feedback Show feedback for the graded
|
||||
* responses
|
||||
* ->validation Show how the current responses
|
||||
* responses were interpreted
|
||||
* ->correct_responses Show solutions
|
||||
* These are all boolean values.
|
||||
*/
|
||||
function print_question_formulation_and_controls(&$question, &$state, $quiz, $options) {
|
||||
/* This default implementation prints an error and must be overridden
|
||||
@@ -818,14 +806,7 @@ class quiz_default_questiontype {
|
||||
* @param object $quiz The quiz to which the question belongs. The
|
||||
* choice of buttons will likely depend on the quiz
|
||||
* settings.
|
||||
* @param object $options An object describing the rendering options. The
|
||||
* fields are:
|
||||
* ->readonly Review / interactive mode
|
||||
* ->feedback Show feedback
|
||||
* ->validation Show how the response was
|
||||
* interpreted
|
||||
* ->correct_responses Show solutions
|
||||
* These are all boolean values.
|
||||
* @param object $options An object describing the rendering options.
|
||||
*/
|
||||
function print_question_submit_buttons(&$question, &$state, $quiz, $options) {
|
||||
/* The default implementation should be suitable for most question
|
||||
@@ -959,7 +940,7 @@ class quiz_default_questiontype {
|
||||
if (empty($state->raw_grade)) {
|
||||
$state->raw_grade = 0.0;
|
||||
}
|
||||
$state->penalty = 0;
|
||||
$state->penalty = $question->penalty * $question->maxgrade;
|
||||
// Only allow one attempt at the question
|
||||
$state->event = QUIZ_EVENTCLOSE;
|
||||
return true;
|
||||
@@ -1378,7 +1359,8 @@ function quiz_restore_state(&$question, &$state) {
|
||||
*
|
||||
* The state object representing the current state of the session for the
|
||||
* question is saved to the quiz_states table with ->responses[''] saved
|
||||
* to the answer field of the database table.
|
||||
* to the answer field of the database table. The information in the
|
||||
* quiz_newest_states table is updated.
|
||||
* The question type specific data is then saved.
|
||||
* @return boolean Indicates success or failure.
|
||||
* @param object $question The question for which session is to be saved.
|
||||
@@ -1411,7 +1393,7 @@ function quiz_save_question_session(&$question, &$state) {
|
||||
$new->questionid = $question->id;
|
||||
$new->new = $state->id;
|
||||
$new->newgraded = $state->id;
|
||||
$new->sumpenalty = '0.0';
|
||||
$new->sumpenalty = $state->sumpenalty;
|
||||
if (!insert_record('quiz_newest_states', $new)) {
|
||||
error('Could not insert entry in quiz_newest_states');
|
||||
}
|
||||
@@ -1785,19 +1767,11 @@ function quiz_search_for_duplicate_responses(&$question, &$state) {
|
||||
* scheme to apply is given by the ->penaltyscheme field.
|
||||
*/
|
||||
function quiz_apply_penalty(&$question, &$state, $quiz) {
|
||||
switch ($quiz->penaltyscheme) {
|
||||
case QUIZ_PENALTYMULTIPLY:
|
||||
$state->grade = (1 - $state->sumpenalty) * $state->raw_grade;
|
||||
$state->sumpenalty += $state->penalty * (1-$state->sumpenalty);
|
||||
break;
|
||||
case QUIZ_PENALTYSUBTRACT:
|
||||
$state->grade = $state->raw_grade - ($question->maxgrade * $state->sumpenalty);
|
||||
if ($quiz->penaltyscheme) {
|
||||
$state->grade = $state->raw_grade - $state->sumpenalty;
|
||||
$state->sumpenalty += (float) $state->penalty;
|
||||
break;
|
||||
case QUIZ_PENALTYNONE:
|
||||
default:
|
||||
$state->grade = $state->raw_grade;
|
||||
break;
|
||||
} else {
|
||||
$state->grade = $state->raw_grade;
|
||||
}
|
||||
// Ensure that the grade does not go down
|
||||
$state->grade = max($state->grade, $state->last_graded->grade);
|
||||
|
||||
+2
-7
@@ -109,11 +109,6 @@
|
||||
$attemptoptions[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
|
||||
$penaltyoptions = array();
|
||||
$penaltyoptions[QUIZ_PENALTYNONE] = get_string('penaltynone', 'quiz');
|
||||
$penaltyoptions[QUIZ_PENALTYMULTIPLY] = get_string('penaltymultiply', 'quiz');
|
||||
$penaltyoptions[QUIZ_PENALTYSUBTRACT] = get_string('penaltysubtract', 'quiz');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -289,7 +284,7 @@
|
||||
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($penaltyoptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
@@ -488,7 +483,7 @@
|
||||
<td align="right"><b><?php print_string("penaltyscheme", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($penaltyoptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
choose_from_menu($yesnooptions, "penaltyscheme", "$form->penaltyscheme", "");
|
||||
helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz");
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<?php if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
@@ -66,7 +66,14 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penalty", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penalty", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("correctanswerformula", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -113,7 +120,7 @@
|
||||
<td>
|
||||
<input type="hidden" name="multiplier[]" value="1.0" />
|
||||
<input align="left" type="text" id="defaultunit" name="unit[]"
|
||||
size="5" value="<?php p($units[0]->unit) ?>"
|
||||
size="5" value="<?php p($units[0]->unit) ?>"
|
||||
alt="<?php print_string("unit", "quiz") ?>" />
|
||||
<b>(<?php print_string("optional", "quiz") ?>)</b>
|
||||
</td>
|
||||
@@ -133,12 +140,12 @@ for ($i=1; $i<count($units); $i++) {
|
||||
<b><?php print_string("multiplier", "quiz") ?>:</b>
|
||||
<input type="text" id="<?php p("multiplier$i") ?>" size="10"
|
||||
align="right" name="multiplier[]"
|
||||
value="<?php p($unit->multiplier) ?>"
|
||||
value="<?php p($unit->multiplier) ?>"
|
||||
alt="<?php print_string("multiplier", "quiz") ?>" />
|
||||
<b> <?php print_string("unit", "quiz") ?>:</b>
|
||||
<input align="left" type="text" id="<?php p("unit$i") ?>"
|
||||
name="unit[]"
|
||||
size="5" value="<?php p($unit->unit) ?>"
|
||||
size="5" value="<?php p($unit->unit) ?>"
|
||||
alt="<?php print_string("unit", "quiz") ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -164,7 +171,7 @@ function determineMinAndMax() {
|
||||
/* It could perhaps be an idea to parse the formula here
|
||||
* but as it is necessary at the server anyway, we can
|
||||
* it leave like this for the moment. */
|
||||
|
||||
|
||||
} else if (''!=defaultunit.value && !isNaN(defaultunit.value)) {
|
||||
alert('<?php print_string("unitmustnotbenumeric","quiz") ?>');
|
||||
return false;
|
||||
|
||||
@@ -429,9 +429,6 @@ class quiz_calculated_qtype extends quiz_dataset_dependent_questiontype {
|
||||
return $str;
|
||||
}
|
||||
|
||||
function print_question_grading_details(&$question, &$state, $quiz, $options) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
//// END OF CLASS ////
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<?php quiz_category_select_menu($course->id, true, true, $question->category); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -21,7 +21,7 @@
|
||||
<?php if (isset($err["name"])) formerr($err["name"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("question", "quiz") ?>:</b>
|
||||
<br /><br /><br /><font size="1">
|
||||
@@ -35,7 +35,7 @@
|
||||
</font>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
<?php
|
||||
if (isset($err["questiontext"])) {
|
||||
formerr($err["questiontext"]);
|
||||
echo "<br />";
|
||||
@@ -57,7 +57,7 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -70,7 +70,14 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penalty", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penalty", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("answerhowmany", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
@@ -82,7 +89,7 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("choices", "quiz") ?></b>:</td>
|
||||
<td><?php print_string("fillouttwochoices", "quiz") ?></td>
|
||||
@@ -101,7 +108,7 @@
|
||||
<td align="right"><b><?php echo get_string("choice", "quiz")." $i"; ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="answer[]" size="50" value="<?php p($answers[$i-1]->answer) ?>" alt="<?php echo get_string("choice", "quiz")." $i"; ?>"/>
|
||||
<?php
|
||||
<?php
|
||||
print_string("grade");
|
||||
echo ": ";
|
||||
choose_from_menu($gradeoptionsfull, "fraction[]", $answers[$i-1]->fraction, "");
|
||||
@@ -109,14 +116,14 @@
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("feedback", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<textarea name="feedback[]" rows="2" cols="50"><?php p($answers[$i-1]->feedback) ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
@@ -361,15 +361,12 @@ class quiz_multichoice_qtype extends quiz_default_questiontype {
|
||||
$state->raw_grade = min(max((float) $state->raw_grade,
|
||||
0.0), 1.0) * $question->maxgrade;
|
||||
// Apply the penalty for this attempt
|
||||
$state->penalty = 0;
|
||||
$state->penalty = $question->penalty * $question->maxgrade;
|
||||
// Only allow one attempt at the question
|
||||
$state->event = QUIZ_EVENTCLOSE;
|
||||
// $state->event = QUIZ_EVENTCLOSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
function print_question_grading_details(&$question, &$state, $quiz, $options) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
//// END OF CLASS ////
|
||||
|
||||
|
||||
@@ -64,7 +64,14 @@
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("penalty", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
<input type="text" name="penalty" size="3" value="<?php p($question->penalty) ?>" alt="<?php print_string("penalty", "quiz") ?>" />
|
||||
<?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
|
||||
<?php if (isset($err["penalty"])) formerr($err["penalty"]); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("correctanswer", "quiz") ?>:</b></td>
|
||||
<td>
|
||||
|
||||
@@ -232,14 +232,6 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
|
||||
* responses are in ->last_graded->responses).
|
||||
* @param object $quiz The quiz to which the question belongs.
|
||||
* @param object $options An object describing the rendering options.
|
||||
* The fields are:
|
||||
* ->readonly Review / interactive mode
|
||||
* ->feedback Show feedback for the graded
|
||||
* responses
|
||||
* ->validation Show how the current responses
|
||||
* responses were interpreted
|
||||
* ->correct_responses Show solutions
|
||||
* These are all boolean values.
|
||||
*/
|
||||
function print_question_formulation_and_controls(&$question, &$state,
|
||||
$quiz, $options) {
|
||||
@@ -414,7 +406,7 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
|
||||
'rawScore'][0];
|
||||
if (isset($output->outcomeVars[RQP_URI_OUTCOME . 'penalty'])) {
|
||||
$state->penalty = (float) $output->outcomeVars[RQP_URI_OUTCOME .
|
||||
'penalty'][0];
|
||||
'penalty'][0] * $question->maxgrade;
|
||||
} else {
|
||||
$state->penalty = 0;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class quiz_shortanswer_qtype extends quiz_default_questiontype {
|
||||
// Make sure we don't assign negative or too high marks
|
||||
$state->raw_grade = min(max((float) $state->raw_grade,
|
||||
0.0), 1.0) * $question->maxgrade;
|
||||
$state->penalty = $question->penalty;
|
||||
$state->penalty = $question->penalty * $question->maxgrade;
|
||||
// Only allow one attempt at the question
|
||||
// $state->event = QUIZ_EVENTCLOSE;
|
||||
return true;
|
||||
@@ -215,9 +215,6 @@ class quiz_shortanswer_qtype extends quiz_default_questiontype {
|
||||
return false;
|
||||
}
|
||||
|
||||
function print_question_grading_details(&$question, &$state, $quiz, $options) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
//// END OF CLASS ////
|
||||
|
||||
|
||||
@@ -218,17 +218,6 @@ class quiz_truefalse_qtype extends quiz_default_questiontype {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This questiontype does not have to print any additional grading details
|
||||
*
|
||||
* @param object $question
|
||||
* @param object $state
|
||||
* @param object $quiz
|
||||
* @param object $options
|
||||
*/
|
||||
function print_question_grading_details(&$question, &$state, $quiz, $options) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
//// END OF CLASS ////
|
||||
|
||||
|
||||
@@ -30,6 +30,14 @@ body#mod-quiz-attempts table#attempts td {
|
||||
border-right-style: solid;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.grade {
|
||||
font-size: small;
|
||||
margin-top: 10pt
|
||||
}
|
||||
.gradingdetails {
|
||||
font-size: small;
|
||||
}
|
||||
.feedbacktext {
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user