From f19ed874ee0866e6b78f03e6897233182f030c28 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 17 Jun 2011 18:31:22 +0100 Subject: [PATCH] MDL-26199 further changes needed to make the question bank navigation behave. --- question/editlib.php | 15 +++++++-------- question/export.php | 7 +------ question/import.php | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/question/editlib.php b/question/editlib.php index 9848e870a32..afb8891bc0d 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -1595,9 +1595,6 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec $thiscontext = null; } } - if (strpos($baseurl, '/question/') === 0) { - navigation_node::override_active_url($thispageurl); - } if ($thiscontext){ $contexts = new question_edit_contexts($thiscontext); @@ -1607,16 +1604,14 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec $contexts = null; } - - $pagevars['qpage'] = optional_param('qpage', -1, PARAM_INT); //pass 'cat' from page to page and when 'category' comes from a drop down menu //then we also reset the qpage so we go to page 1 of //a new cat. - $pagevars['cat'] = optional_param('cat', 0, PARAM_SEQUENCE);// if empty will be set up later - if ($category = optional_param('category', 0, PARAM_SEQUENCE)){ - if ($pagevars['cat'] != $category){ // is this a move to a new category? + $pagevars['cat'] = optional_param('cat', 0, PARAM_SEQUENCE); // if empty will be set up later + if ($category = optional_param('category', 0, PARAM_SEQUENCE)) { + if ($pagevars['cat'] != $category) { // is this a move to a new category? $pagevars['cat'] = $category; $pagevars['qpage'] = 0; } @@ -1624,6 +1619,10 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec if ($pagevars['cat']){ $thispageurl->param('cat', $pagevars['cat']); } + if (strpos($baseurl, '/question/') === 0) { + navigation_node::override_active_url($thispageurl); + } + if ($pagevars['qpage'] > -1) { $thispageurl->param('qpage', $pagevars['qpage']); } else { diff --git a/question/export.php b/question/export.php index 16000f7f177..dec240ae354 100644 --- a/question/export.php +++ b/question/export.php @@ -36,16 +36,11 @@ list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = // get display strings $strexportquestions = get_string('exportquestions', 'question'); -// make sure we are using the user's most recent category choice -if (empty($categoryid)) { - $categoryid = $pagevars['cat']; -} - list($catid, $catcontext) = explode(',', $pagevars['cat']); $category = $DB->get_record('question_categories', array("id" => $catid, 'contextid' => $catcontext), '*', MUST_EXIST); /// Header -$PAGE->set_url($thispageurl->out()); +$PAGE->set_url($thispageurl); $PAGE->set_title($strexportquestions); $PAGE->set_heading($COURSE->fullname); echo $OUTPUT->header(); diff --git a/question/import.php b/question/import.php index 56e889268c1..444d32fd169 100644 --- a/question/import.php +++ b/question/import.php @@ -60,7 +60,7 @@ if ($contexts === null) { // need to get the course from the chosen category $contexts->require_one_edit_tab_cap($edittab); } -$PAGE->set_url($thispageurl->out()); +$PAGE->set_url($thispageurl); $import_form = new question_import_form($thispageurl, array('contexts'=>$contexts->having_one_edit_tab_cap('import'), 'defaultcategory'=>$pagevars['cat']));