Merged from STABLE
This commit is contained in:
@@ -489,10 +489,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!$isteacher) {
|
||||
include('attempt_close_js.php');
|
||||
}
|
||||
|
||||
// Finish the page
|
||||
if (empty($popup)) {
|
||||
print_footer($course);
|
||||
|
||||
@@ -740,7 +740,7 @@ function quiz_upgrade($oldversion) {
|
||||
|
||||
// Remove duplicate entries from quiz_numerical
|
||||
if ($dups = get_records_sql("
|
||||
SELECT question, answer, count(*) num
|
||||
SELECT question, answer, count(*) as num
|
||||
FROM {$CFG->prefix}quiz_numerical
|
||||
GROUP BY question, answer
|
||||
HAVING count(*) > 1"
|
||||
@@ -765,7 +765,7 @@ function quiz_upgrade($oldversion) {
|
||||
|
||||
// Remove duplicate entries from quiz_shortanswer
|
||||
if ($dups = get_records_sql("
|
||||
SELECT question, answers, count(*) num
|
||||
SELECT question, answers, count(*) as num
|
||||
FROM {$CFG->prefix}quiz_shortanswer
|
||||
GROUP BY question, answers
|
||||
HAVING count(*) > 1"
|
||||
@@ -790,7 +790,7 @@ function quiz_upgrade($oldversion) {
|
||||
|
||||
// Remove duplicate entries from quiz_multichoice
|
||||
if ($dups = get_records_sql("
|
||||
SELECT question, answers, count(*) num
|
||||
SELECT question, answers, count(*) as num
|
||||
FROM {$CFG->prefix}quiz_multichoice
|
||||
GROUP BY question, answers
|
||||
HAVING count(*) > 1"
|
||||
|
||||
+1
-1
@@ -472,7 +472,7 @@ if (self.name == 'editquestion') {
|
||||
// continues with list of questions
|
||||
print_simple_box_start("center", "100%");
|
||||
quiz_print_cat_question_list($course, $modform->category,
|
||||
isset($modform->instance), $SESSION->quiz_recurse, $page, $perpage, $SESSION->quiz_showhidden);
|
||||
isset($modform->instance) ? $modform->instance : 0, $SESSION->quiz_recurse, $page, $perpage, $SESSION->quiz_showhidden);
|
||||
print_simple_box_end();
|
||||
if (!isset($modform->instance)) {
|
||||
print_continue("index.php?id=$modform->course");
|
||||
|
||||
@@ -431,13 +431,13 @@ function quiz_print_category_form($course, $current, $recurse=1, $showhidden=fal
|
||||
*
|
||||
* @param object $course The course object
|
||||
* @param int $categoryid The id of the question category to be displayed
|
||||
* @param boolean $quizselected True if we are in the context of a particular quiz
|
||||
* @param int $quizid The quiz id if we are in the context of a particular quiz, 0 otherwise
|
||||
* @param int $recurse This is 1 if subcategories should be included, 0 otherwise
|
||||
* @param int $page The number of the page to be displayed
|
||||
* @param int $perpage Number of questions to show per page
|
||||
* @param boolean $showhidden True if also hidden questions should be displayed
|
||||
*/
|
||||
function quiz_print_cat_question_list($course, $categoryid, $quizselected=true,
|
||||
function quiz_print_cat_question_list($course, $categoryid, $quizid,
|
||||
$recurse=1, $page, $perpage, $showhidden=false) {
|
||||
global $QUIZ_QUESTION_TYPE, $USER;
|
||||
|
||||
@@ -466,7 +466,7 @@ function quiz_print_cat_question_list($course, $categoryid, $quizselected=true,
|
||||
echo "<p align=\"center\"><b>";
|
||||
print_string("selectcategoryabove", "quiz");
|
||||
echo "</b></p>";
|
||||
if ($quizselected) {
|
||||
if ($quizid) {
|
||||
echo "<p>";
|
||||
print_string("addingquestions", "quiz");
|
||||
echo "</p>";
|
||||
@@ -559,11 +559,11 @@ function quiz_print_cat_question_list($course, $categoryid, $quizselected=true,
|
||||
echo "<tr>\n";
|
||||
if ($canedit) {
|
||||
echo "<td>\n";
|
||||
if ($quizselected) {
|
||||
if ($quizid) {
|
||||
echo "<a title=\"$straddtoquiz\" href=\"edit.php?addquestion=$question->id&sesskey=$USER->sesskey\"><img
|
||||
src=\"../../pix/t/moveleft.gif\" border=\"0\" alt=\"$straddtoquiz\" /></a> ";
|
||||
}
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/mod/quiz/preview.php?id=$question->id','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img
|
||||
echo "<a title=\"$strpreview\" href=\"javascript:void();\" onClick=\"openpopup('/mod/quiz/preview.php?id=$question->id&quizid=$quizid','$strpreview','scrollbars=yes,resizable=yes,width=700,height=480', false)\"><img
|
||||
src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a> ";
|
||||
echo "<a title=\"$stredit\" href=\"question.php?id=$question->id\"><img
|
||||
src=\"../../pix/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a> ";
|
||||
@@ -597,7 +597,7 @@ function quiz_print_cat_question_list($course, $categoryid, $quizselected=true,
|
||||
echo '<a href="javascript:select_all_in(\'TABLE\', null, \'categoryquestions\');">'.$strselectall.'</a> /'.
|
||||
' <a href="javascript:deselect_all_in(\'TABLE\', null, \'categoryquestions\');">'.$strselectnone.'</a>'.
|
||||
'</td><td align="right"><b>'.get_string('withselected', 'quiz').':</b></td></tr><tr><td>';
|
||||
if ($quizselected) {
|
||||
if ($quizid) {
|
||||
echo "<input type=\"submit\" name=\"add\" value=\"<< $straddtoquiz\" />\n";
|
||||
echo '</td><td>';
|
||||
}
|
||||
@@ -606,7 +606,7 @@ function quiz_print_cat_question_list($course, $categoryid, $quizselected=true,
|
||||
quiz_category_select_menu($course->id, false, true, $category->id);
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if ($quizselected) {
|
||||
if ($quizid) {
|
||||
for ($i=1;$i<=10; $i++) {
|
||||
$randomcount[$i] = $i;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
|
||||
foreach ($wrappedquestions as $wrapped) {
|
||||
if (!$QUIZ_QTYPES[$wrapped->qtype]
|
||||
->get_question_options($wrapped)) {
|
||||
error("Unable to recognized questiontype " .
|
||||
$wrapped->qtype);
|
||||
notify("Unable to get options for questiontype
|
||||
{$wrapped->qtype} (id={$wrapped->id})");
|
||||
}
|
||||
$wrapped->maxgrade = $wrapped->defaultgrade;
|
||||
$question->options->questions[$sequence[$wrapped->id]] = clone($wrapped);
|
||||
|
||||
@@ -265,21 +265,21 @@ class quiz_multichoice_qtype extends quiz_default_questiontype {
|
||||
|
||||
if ($question->options->single) {
|
||||
$type = 'type="radio"';
|
||||
$name = "name=\"{$question->name_prefix}\"";
|
||||
$name = "name=\"{$question->name_prefix}\"";
|
||||
$checked = $aid == $state->responses['']
|
||||
? 'checked="checked"' : '';
|
||||
} else {
|
||||
$type = ' type="checkbox" ';
|
||||
$name = "name=\"{$question->name_prefix}$aid\"";
|
||||
$name = "name=\"{$question->name_prefix}{$aid}\"";
|
||||
$checked = isset($state->responses[$aid])
|
||||
? 'checked="checked"' : '';
|
||||
}
|
||||
|
||||
$id = $question->name_prefix . $aid;
|
||||
$fullid = "id=\"$id\"";
|
||||
|
||||
// Print the control
|
||||
echo "<input $readonly $name $checked $type value=\"$aid\" alt=\""
|
||||
. s($answer->answer) . '" />';
|
||||
|
||||
echo "<input $readonly $fullid $name $checked $type value=\"$aid\"" .
|
||||
"alt=\"" . s($answer->answer) . '" />';
|
||||
echo '</td>';
|
||||
|
||||
// Print the text by the control highlighting if correct responses
|
||||
@@ -288,13 +288,13 @@ class quiz_multichoice_qtype extends quiz_default_questiontype {
|
||||
// selection case
|
||||
if ($options->readonly && $options->correct_responses &&
|
||||
in_array($aid, $correctanswers)) {
|
||||
echo '<td valign="top" class="highlight">' .
|
||||
echo '<td valign="top" class="highlight"><label for="'.$id.'">'.
|
||||
format_text("$qnumchar. $answer->answer", FORMAT_MOODLE ,
|
||||
$formatoptions) . '</td>';
|
||||
$formatoptions) . '</label></td>';
|
||||
} else {
|
||||
echo '<td valign="top">' .
|
||||
echo '<td valign="top"><label for="'.$id.'">'.
|
||||
format_text("$qnumchar. $answer->answer", FORMAT_MOODLE,
|
||||
$formatoptions) . '</td>';
|
||||
$formatoptions) . '</label></td>';
|
||||
}
|
||||
|
||||
// Print feedback by selected options if feedback is on
|
||||
|
||||
@@ -192,17 +192,20 @@ class quiz_truefalse_qtype extends quiz_default_questiontype {
|
||||
|
||||
// Print the controls
|
||||
$inputname = ' name="'.$question->name_prefix.'" ';
|
||||
$trueid = $question->name_prefix.'true';
|
||||
$falseid = $question->name_prefix.'false';
|
||||
echo '<table align="right" cellpadding="5"><tr><td align="right">';
|
||||
echo $stranswer . ': </td>';
|
||||
echo '<td' . $truecorrect . '>';
|
||||
echo '<input type="radio"' . $truechecked . $readonly . $inputname;
|
||||
echo 'value="' . $answers['true']->id . '" alt="';
|
||||
echo s($answers['true']->answer) . '" />' . s($answers['true']->answer);
|
||||
echo 'id="'.$trueid . '" value="' . $answers['true']->id . '" alt="';
|
||||
echo s($answers['true']->answer) . '" /><label for="'.$trueid . '">';
|
||||
echo s($answers['true']->answer) . '</label>';
|
||||
echo '</td><td' . $falsecorrect . '>';
|
||||
echo '<input type="radio"' . $falsechecked . $readonly . $inputname;
|
||||
echo 'value="' . $answers['false']->id . '" alt="';
|
||||
echo s($answers['false']->answer) . '" />';
|
||||
p($answers['false']->answer);
|
||||
echo 'id="'.$falseid . '" value="' . $answers['false']->id . '" alt="';
|
||||
echo s($answers['false']->answer) . '" /><label for="'.$falseid . '">';
|
||||
echo s($answers['false']->answer) . '</label>';
|
||||
if (!empty($marked) && (!$options->readonly || $marked !== $selected)) {
|
||||
/* This should never happen but it is here both for robustness and
|
||||
to serve as an example for question type authors */
|
||||
|
||||
Reference in New Issue
Block a user