Browse files

Merge branch 'MDL-26199' of git://github.com/timhunt/moodle

  • Loading branch information...
2 parents 35d4d85 + f19ed87 commit 29e2d0a820f2f4cf3286843177d79544ca45eb1d Sam Hemelryk committed Jun 27, 2011
Showing with 13 additions and 15 deletions.
  1. +4 −0 lib/questionlib.php
  2. +7 −8 question/editlib.php
  3. +1 −6 question/export.php
  4. +1 −1 question/import.php
View
4 lib/questionlib.php
@@ -1434,6 +1434,10 @@ function question_extend_settings_navigation(navigation_node $navigationnode, $c
return;
}
+ if (($cat = $PAGE->url->param('cat')) && preg_match('~\d+,\d+~', $cat)) {
+ $params['cat'] = $cat;
+ }
+
$questionnode = $navigationnode->add(get_string('questionbank', 'question'),
new moodle_url('/question/edit.php', $params), navigation_node::TYPE_CONTAINER);
View
15 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,23 +1604,25 @@ 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;
}
}
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 {
View
7 question/export.php
@@ -36,16 +36,11 @@
// 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();
View
2 question/import.php
@@ -60,7 +60,7 @@
$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']));

0 comments on commit 29e2d0a

Please sign in to comment.