From f8180ec8d8425600663379ed1fb8fb8db6dbf34c Mon Sep 17 00:00:00 2001 From: mindforge Date: Wed, 14 Sep 2005 11:17:24 +0000 Subject: [PATCH] Merged from 1.5. --- lang/en/quiz.php | 7 ++++++- mod/quiz/edit.php | 23 +++++++++++++++++------ mod/quiz/editlib.php | 16 ++++++++++++---- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lang/en/quiz.php b/lang/en/quiz.php index d9b8fdc3677..02483523517 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -1,4 +1,4 @@ -modform)) { + $modform = $SESSION->modform; + } else { + exit; + } } else { // we might get here after editing a question in // a popup window. So close window automatically. @@ -95,7 +106,7 @@ if (self.name == 'editquestion') { modform)) { + if (isset($SESSION->modform)) { $modform = $SESSION->modform; } else { exit; @@ -472,7 +483,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) ? $modform->instance : 0, $SESSION->quiz_recurse, $page, $perpage, $SESSION->quiz_showhidden); + isset($modform->instance) ? $modform->instance : 0, $SESSION->quiz_recurse, $page, $perpage, $SESSION->quiz_showhidden, $sortorder); print_simple_box_end(); if (!isset($modform->instance)) { print_continue("index.php?id=$modform->course"); diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 9164b91157a..8e9d00fcea9 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -439,7 +439,7 @@ function quiz_print_category_form($course, $current, $recurse=1, $showhidden=fal * @param boolean $showhidden True if also hidden questions should be displayed */ function quiz_print_cat_question_list($course, $categoryid, $quizid, - $recurse=1, $page, $perpage, $showhidden=false) { + $recurse=1, $page, $perpage, $showhidden=false, $sortorder='qtype, name ASC') { global $QUIZ_QUESTION_TYPE, $USER; $strcategory = get_string("category", "quiz"); @@ -463,6 +463,10 @@ function quiz_print_cat_question_list($course, $categoryid, $quizid, $strcreatemultiple = get_string("createmultiple", "quiz"); $strpreview = get_string("preview","quiz"); + $strsortalpha = get_string("sortalpha", "quiz"); + $strsortage = get_string("sortage", "quiz"); + $strsortsubmit = get_string("sortsubmit", "quiz"); + if (!$categoryid) { echo "

"; print_string("selectcategoryabove", "quiz"); @@ -526,10 +530,10 @@ function quiz_print_cat_question_list($course, $categoryid, $quizid, return; } - if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND parent = '0' $showhidden", 'qtype, name ASC', '*', $page*$perpage, $perpage)) { + if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND parent = '0' $showhidden", $sortorder, '*', $page*$perpage, $perpage)) { // There are no questions on the requested page. $page = 0; - if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND parent = '0' $showhidden", 'qtype, name ASC', '*', 0, $perpage)) { + if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND parent = '0' $showhidden", $sortorder, '*', 0, $perpage)) { // There are no questions at all echo "

"; print_string("noquestions", "quiz"); @@ -549,7 +553,11 @@ function quiz_print_cat_question_list($course, $categoryid, $quizid, echo ''; $actionwidth = $canedit ? 95 : 70; echo ""; - echo " + $sortoptions = array('qtype, name ASC' => $strsortalpha, + 'id ASC' => $strsortage); + $orderselect = choose_from_menu ($sortoptions, 'sortorder', $sortorder, false, 'this.form.submit();', '0', true); + $orderselect .= ''; + echo ""; echo "\n"; foreach ($questions as $question) {
$straction$strquestionname$strquestionname $orderselect $strtype