Skip to content

Commit

Permalink
small fix to the versioning code
Browse files Browse the repository at this point in the history
  • Loading branch information
gustav_delius committed Mar 7, 2005
1 parent a2b8226 commit 9274189
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mod/quiz/edit.php
Expand Up @@ -328,7 +328,7 @@
}
notify("$strattemptsexist<br /><a href=\"report.php?id=$cm->id\">$strviewallanswers ($usercount $strusers)</a>");

$sumgrades = quiz_print_question_list($modform->questions, $modform->grades, false);
$sumgrades = quiz_print_question_list($modform->questions, $modform->grades, false, $modform->instance);
if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $modform->instance)) {
error('Failed to set sumgrades');
}
Expand Down Expand Up @@ -357,7 +357,7 @@
echo '<tr><td width="50%" valign="top">';
print_simple_box_start("center", "100%");
print_heading($modform->name);
$sumgrades = quiz_print_question_list($modform->questions, $modform->grades);
$sumgrades = quiz_print_question_list($modform->questions, $modform->grades, true, $modform->instance);
if (!set_field('quiz', 'sumgrades', $sumgrades, 'id', $modform->instance)) {
error('Failed to set sumgrades');
}
Expand Down
7 changes: 4 additions & 3 deletions mod/quiz/locallib.php
Expand Up @@ -1217,7 +1217,7 @@ function quiz_gradesmenu_options($defaultgrade) {
return $gradesmenu;
}

function quiz_print_question_list($questionlist, $grades, $allowdelete=true) {
function quiz_print_question_list($questionlist, $grades, $allowdelete=true, $quizid=0) {
// Prints a list of quiz questions in a small layout form with knobs
// returns sum of maximum grades
// $questionlist is comma-separated list
Expand Down Expand Up @@ -1295,9 +1295,10 @@ function quiz_print_question_list($questionlist, $grades, $allowdelete=true) {
echo '<td align="center">';

if ($canedit) {
$context = $quizid ? '&amp;contextquiz='.$quizid : '';
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/mod/quiz/preview.php?id=$qnum','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\">
<img src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>&nbsp;";
echo "<a title=\"$stredit\" href=\"question.php?id=$qnum\">
echo "<a title=\"$stredit\" href=\"question.php?id=$qnum$context\">
<img src=\"../../pix/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>&nbsp;";
if ($allowdelete) {
echo "<a title=\"$strremove\" href=\"edit.php?delete=$qnum&amp;sesskey=$USER->sesskey\">
Expand Down Expand Up @@ -2006,7 +2007,7 @@ function quizzes_question_used($id) {

function quiz_parse_fieldname($name, $nameprefix='question') {
$reg = array();
if(preg_match("/q(\\d+)(\w+)/", $name, $reg)) {
if (preg_match("/$nameprefix(\\d+)(\w+)/", $name, $reg)) {
return array('mode' => $reg[2], 'id' => (int)$reg[1]);
} else {
return false;
Expand Down

0 comments on commit 9274189

Please sign in to comment.