]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-6353 Also make the repagination UI better by making it always visible, and conver...
authortjhunt <tjhunt>
Fri, 22 Aug 2008 02:46:54 +0000 (02:46 +0000)
committertjhunt <tjhunt>
Fri, 22 Aug 2008 02:46:54 +0000 (02:46 +0000)
lang/en_utf8/quiz.php
mod/quiz/editlib.php
theme/standard/styles_layout.css

index 9f6b647e0bfd9308aa56eb0a16805960556fb6f8..01b1220bd947cf32fc77d2a4421f888c6c0462a2 100644 (file)
@@ -295,6 +295,8 @@ $string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a.';
 $string['gradingdetailszeropenalty'] = 'You were not penalized for this submission.';
 $string['guestsno'] = 'Sorry, guests cannot see or attempt quizzes';
 $string['history'] = 'History of Responses:';
+$string['hidebreaks'] = 'Hide page breaks';
+$string['hidereordertool'] = 'Hide the reordering tool';
 $string['hotpot'] = 'Hot Potatoes format';
 $string['illegalformulasyntax'] = 'Illegal formula syntax starting with \'$a\'';
 $string['imagedisplay'] = 'Image to display';
index 1b83bc765cb20b0fa7a662a4a0151bbb435f35b4..c969ff93d8e0120c2f8a5c4d6ba8ebf1748c7ea4 100644 (file)
@@ -135,7 +135,7 @@ function quiz_update_question_instance($grade, $questionid, $quizid) {
 * @param boolean $showbreaks  Indicates whether the page breaks should be displayed
 * @param boolean $showbreaks  Indicates whether the reorder tool should be displayed
 */
-function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $showbreaks=true, $reordertool=false) {
+function quiz_print_question_list($quiz, moodle_url $pageurl, $allowdelete=true, $showbreaks=true, $reordertool=false) {
     global $USER, $CFG, $QTYPES, $DB;
 
     $strorder = get_string("order");
@@ -318,44 +318,53 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete=true, $showbreak
     echo '</fieldset>';
     echo "</form>\n";
 
-/// Form to choose to show pagebreaks and to repaginate quiz
-    echo '<form method="post" action="edit.php" id="showbreaks">';
-    echo '<fieldset class="invisiblefieldset">';
-    echo $pageurl->hidden_params_out(array('showbreaks', 'reordertool'));
-    echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
-    echo '<input type="hidden" name="showbreaks" value="0" />';
-    echo '<input type="checkbox" name="showbreaks" value="1"';
-    if ($showbreaks) {
-        echo ' checked="checked"';
-    }
-    echo ' onclick="form.submit(); return true;" />';
-    print_string('showbreaks', 'quiz');
+    if (!$quiz->shufflequestions) {
+        echo '<div id="showhidepagingcontrols">';
+
+    /// Button to show or hide pagebreaks.
+        if ($showbreaks) {
+            $newshowbreaks = 0;
+            $caption = get_string('hidebreaks', 'quiz');
+        } else {
+            $newshowbreaks = 1;
+            $caption = get_string('showbreaks', 'quiz');
+        }
+        print_single_button($pageurl->out(true),
+                array('showbreaks' => $newshowbreaks) + $pageurl->params(), $caption);
+
+        echo ' ';
+
+    /// Button to show or hide the reordering tool.
+        if ($reordertool) {
+            $newreordertool = 0;
+            $caption = get_string('hidereordertool', 'quiz');
+        } else {
+            $newreordertool = 1;
+            $caption = get_string('reordertool', 'quiz');
+        }
+        print_single_button($pageurl->out(true),
+                array('reordertool' => $newreordertool) + $pageurl->params(), $caption);
+        helpbutton('reorderingtool', get_string('reordertool', 'quiz'), 'quiz');
+
+        echo '</div>';
 
-    if ($showbreaks) {
+    /// Repaginate form.
+        echo '<form method="post" action="edit.php" id="showbreaks">';
+        echo '<div>';
+        echo $pageurl->hidden_params_out();
+        echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
         $perpage= array();
-        for ($i=0; $i<=50; ++$i) {
+        $perpage[0] = get_string('allinone', 'quiz');
+        for ($i=1; $i<=50; ++$i) {
             $perpage[$i] = $i;
         }
-        $perpage[0] = get_string('allinone', 'quiz');
-        echo '<br />&nbsp;&nbsp;';
-        print_string('repaginate', 'quiz',
-         choose_from_menu($perpage, 'questionsperpage', $quiz->questionsperpage, '', '', '', true));
+        print_string('repaginate', 'quiz', choose_from_menu($perpage, 'questionsperpage',
+                $quiz->questionsperpage, '', '', '', true));
+        echo ' <input type="submit" name="repaginate" value="'. get_string('go') .'" />';
+        echo '</div>';
+        echo '</form>';
     }
 
-    echo '<br /><input type="hidden" name="reordertool" value="0" />';
-    echo '<input type="checkbox" name="reordertool" value="1"';
-    if ($reordertool) {
-        echo ' checked="checked"';
-    }
-    echo ' onclick="form.submit(); return true;" />';
-    print_string('reordertool', 'quiz');
-    echo ' ';
-    helpbutton('reorderingtool', get_string('reordertool', 'quiz'), 'quiz');
-
-    echo '<div class="quizquestionlistcontrols"><input type="submit" name="repaginate" value="'. get_string('go') .'" /></div>';
-    echo '</fieldset>';
-    echo '</form>';
-
     return $sumgrade;
 }
 
index 62a513219db62bb27a92c58796686bcb9aa140a9..a38d34198ab68052f925897ba517f7329b98443b 100644 (file)
@@ -3981,9 +3981,12 @@ table.quizreviewsummary td.cell {
 #mod-quiz-edit .quizquestions h2 {
   margin-top: 0;
 }
-#mod-quiz-edit #showbreaks {
+#mod-quiz-edit #showhidepagingcontrols {
   margin-top: 0.7em;
 }
+#mod-quiz-edit #showhidepagingcontrols .singlebutton {
+  display: inline;
+}
 .quizquestionlistcontrols {
   text-align: center;
 }