Skip to content

Commit

Permalink
Merge branch 'MDL-26199' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jun 27, 2011
2 parents 35d4d85 + f19ed87 commit 29e2d0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 4 additions & 0 deletions lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
15 changes: 7 additions & 8 deletions question/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions question/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion question/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand Down

0 comments on commit 29e2d0a

Please sign in to comment.