MDL-26199 further changes needed to make the question bank navigation behave.

This commit is contained in:
Tim Hunt
2011-06-23 07:18:49 +01:00
parent 8356e6cff8
commit f19ed874ee
3 changed files with 9 additions and 15 deletions
+7 -8
View File
@@ -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 {
+1 -6
View File
@@ -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();
+1 -1
View File
@@ -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']));