From 9624187313a96a46c1d3a3d95c30f74c34777c3a Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 22 Aug 2008 02:46:54 +0000 Subject: [PATCH] MDL-6353 Also make the repagination UI better by making it always visible, and convert the show/hide page breaks and reordering tool check boxes to be buttons. --- lang/en_utf8/quiz.php | 2 + mod/quiz/editlib.php | 75 ++++++++++++++++++-------------- theme/standard/styles_layout.css | 5 ++- 3 files changed, 48 insertions(+), 34 deletions(-) diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index 9f6b647e0bfd9..01b1220bd947c 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -295,6 +295,8 @@ $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'; diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 1b83bc765cb20..c969ff93d8e01 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -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 ''; echo "\n"; -/// Form to choose to show pagebreaks and to repaginate quiz - echo '
'; - echo '
'; - echo $pageurl->hidden_params_out(array('showbreaks', 'reordertool')); - echo ''; - echo ''; - echo ''; - print_string('showbreaks', 'quiz'); + if (!$quiz->shufflequestions) { + echo '
'; + + /// 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 '
'; - if ($showbreaks) { + /// Repaginate form. + echo ''; + echo '
'; + echo $pageurl->hidden_params_out(); + echo ''; $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 '
  '; - 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 ' '; + echo '
'; + echo ''; } - echo '
'; - echo ''; - print_string('reordertool', 'quiz'); - echo ' '; - helpbutton('reorderingtool', get_string('reordertool', 'quiz'), 'quiz'); - - echo '
'; - echo '
'; - echo ''; - return $sumgrade; } diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 62a513219db62..a38d34198ab68 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -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; }