Skip to content

Commit

Permalink
MDL-6353 Also make the repagination UI better by making it always vis…
Browse files Browse the repository at this point in the history
…ible, and convert the show/hide page breaks and reordering tool check boxes to be buttons.
  • Loading branch information
tjhunt committed Aug 22, 2008
1 parent 4c07690 commit 9624187
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
2 changes: 2 additions & 0 deletions lang/en_utf8/quiz.php
Expand Up @@ -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';
Expand Down
75 changes: 42 additions & 33 deletions mod/quiz/editlib.php
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion theme/standard/styles_layout.css
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9624187

Please sign in to comment.