# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: moodle/lib/questionlib.php --- moodle/lib/questionlib.php Base (1.223) +++ moodle/lib/questionlib.php Locally Modified (Based On 1.223) @@ -3009,3 +3009,43 @@ } return md5($attemptid . "_" . $user->secret . "_" . $questionid . "_" . $sessionid); } + +function question_extend_navigation(navigation_node $node, $course, $cm) { + + $params = array(); + if ($cm) { + $params['cmid'] = $cm->id; + } else if ($course) { + $params['courseid'] = $course->id; + } + if ($cat = optional_param('cat', 0, PARAM_SEQUENCE)){ + $params['cat'] = $cat; + } + if (($qpage = optional_param('qpage', -1, PARAM_INT)) > -1) { + $params['qpage'] = $qpage; + } + if (($qperpage = optional_param('qperpage', -1, PARAM_INT)) > -1) { + $params['qperpage'] = $qperpage; + } + if ($sortorder = optional_param('qsortorder', '', PARAM_ALPHA)) { + $params['qsortorder'] = $sortorder; + } + if(($recurse = optional_param('recurse', -1, PARAM_BOOL)) != -1) { + $params['recurse'] = $recurse; + } + if(($showhidden = optional_param('showhidden', -1, PARAM_BOOL)) != -1) { + $params['showhidden'] = $showhidden; + } + if(($showquestiontext = optional_param('showquestiontext', -1, PARAM_BOOL)) != -1) { + $params['showquestiontext'] = $showquestiontext; + } + if (($cpage = optional_param('cpage', 1, PARAM_INT)) != 1){ + $params['cpage'] = $cpage; + } + + $questionbank = $node->add(get_string('questionbankmanagement', 'quiz')); + $questionbank->add(get_string('questions', 'quiz'), new moodle_url('/question/edit.php', $params)); + $questionbank->add(get_string('categories', 'quiz'), new moodle_url('/question/category.php', $params)); + $questionbank->add(get_string('import', 'quiz'), new moodle_url('/question/import.php', $params)); + $questionbank->add(get_string('export', 'quiz'), new moodle_url('/question/export.php', $params)); +} \ No newline at end of file Index: moodle/mod/quiz/edit.php --- moodle/mod/quiz/edit.php Base (1.187) +++ moodle/mod/quiz/edit.php Locally Modified (Based On 1.187) @@ -112,20 +112,24 @@ return $out; } +//these params are only passed from page request to request while we stay on +//this page otherwise they would go in question_edit_setup +$quiz_reordertool = optional_param('reordertool', 0, PARAM_BOOL); +$quiz_qbanktool = optional_param('qbanktool', -1, PARAM_BOOL); + list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) = question_edit_setup('editq', '/mod/quiz/edit.php', true); -$PAGE->set_url($thispageurl); -$PAGE->set_pagelayout('base'); +$url = new moodle_url($thispageurl); +if ($quiz_reordertool) { + $url->param('reordertool', $quiz_reordertool); +} +$PAGE->set_url($url); $defaultcategoryobj = question_make_default_categories($contexts->all()); $defaultcategoryid = $defaultcategoryobj->id; $defaultcategorycontext = $defaultcategoryobj->contextid; $defaultcategory = $defaultcategoryid . ',' . $defaultcategorycontext; -//these params are only passed from page request to request while we stay on -//this page otherwise they would go in question_edit_setup -$quiz_reordertool = optional_param('reordertool', 0, PARAM_BOOL); -$quiz_qbanktool = optional_param('qbanktool', -1, PARAM_BOOL); if ($quiz_qbanktool > -1) { $thispageurl->param('qbanktool', $quiz_qbanktool); set_user_preference('quiz_qbanktool_open', $quiz_qbanktool); @@ -440,11 +444,10 @@ '/question/edit.php?courseid='.$course->id.'">'. get_string('questionbankmanagement', 'quiz').' '; -$PAGE->navbar->add($pagetitle); $PAGE->requires->skip_link_to('questionbank', get_string('skipto', 'access', get_string('questionbank', 'question'))); $PAGE->requires->skip_link_to('quizcontentsblock', get_string('skipto', 'access', get_string('questionsinthisquiz', 'quiz'))); - $PAGE->set_title($pagetitle); +$PAGE->set_heading($pagetitle); $PAGE->set_button($questionbankmanagement); echo $OUTPUT->header(); Index: moodle/mod/quiz/lib.php --- moodle/mod/quiz/lib.php Base (1.362) +++ moodle/mod/quiz/lib.php Locally Modified (Based On 1.362) @@ -28,6 +28,8 @@ /** Require {@link eventslib.php} */ require_once($CFG->libdir . '/eventslib.php'); +/** Require {@link questionlib.php} */ +require_once($CFG->libdir . '/questionlib.php'); /** Require {@link calendar/lib.php} */ require_once($CFG->dirroot . '/calendar/lib.php'); @@ -1597,20 +1599,39 @@ * body of code as there is no guarantee that during an AJAX request they are * available * - * @param navigation_node $navigation The quiz node within the global navigation + * @param navigation_node $quiznode The quiz node within the global navigation * @param stdClass $course The course object returned from the DB * @param stdClass $module The module object returned from the DB * @param stdClass $cm The course module isntance returned from the DB */ -function quiz_extend_navigation($navigation, $course, $module, $cm) { - /** - * This is currently just a stub so that it can be easily expanded upon. - * When expanding just remove this comment and the line below and then add - * you content. - */ - $navigation->nodetype = navigation_node::NODETYPE_LEAF; +function quiz_extend_navigation($quiznode, $course, $module, $cm) { + global $CFG; + + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + + if (has_capability('mod/quiz:view', $context)) { + $url = new moodle_url('/mod/quiz/view.php', array('id'=>$cm->id)); + $quiznode->add(get_string('info', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/info', '')); } + if (has_capability('mod/quiz:viewreports', $context)) { + $url = new moodle_url('/mod/quiz/report.php', array('q'=>$cm->instance)); + $reportnode = $quiznode->add(get_string('results', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')); + + require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php'); + $reportlist = quiz_report_list($context); + foreach ($reportlist as $report) { + if ($report != 'overview') { + $url = new moodle_url('/mod/quiz/report.php', array('q'=>$cm->instance, 'mode'=>$report)); + } else { + $url = new moodle_url('/mod/quiz/report.php', array('q'=>$cm->instance)); + } + $reportnode->add(get_string($report, 'quiz_'.$report), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + } + } + +} + /** * This function extends the settings navigation block for the site. * @@ -1623,27 +1644,29 @@ function quiz_extend_settings_navigation($settings, $quiznode) { global $PAGE, $CFG; - if (has_capability('mod/quiz:view', $PAGE->cm->context)) { - $url = new moodle_url('/mod/quiz/view.php', array('id'=>$PAGE->cm->id)); - $quiznode->add(get_string('info', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/info', '')); + if (has_capability('mod/quiz:manageoverrides', $PAGE->cm->context)) { + $overrides = $quiznode->add(get_string('overrides', 'quiz')); + + $url = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$PAGE->cm->id)); + $overrides->add(get_string('groupoverrides', 'quiz'), $url, navigation_node::TYPE_SETTING); + $overrides->add(get_string('useroverrides', 'quiz'), new moodle_url($url, array('mode'=>'user')), navigation_node::TYPE_SETTING); } - if (has_capability('mod/quiz:viewreports', $PAGE->cm->context)) { - $url = new moodle_url('/mod/quiz/report.php', array('q'=>$PAGE->cm->instance)); - $reportnode = $quiznode->add(get_string('results', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')); - require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php'); - $reportlist = quiz_report_list($PAGE->cm->context); - foreach ($reportlist as $report) { - $url = new moodle_url('/mod/quiz/report.php', array('q'=>$PAGE->cm->instance, 'mode'=>$report)); - $reportnode->add(get_string($report, 'quiz_'.$report), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + if (has_capability('mod/quiz:manage', $PAGE->cm->context)) { + $editnode = $quiznode->add(get_string('edit')); + + $url = new moodle_url('/mod/quiz/edit.php', array('cmid'=>$PAGE->cm->id)); + $text = get_string("editinga", "moodle", get_string('modulename', 'quiz')); + $editnode->add($text, $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('t/edit', '')); + + $url = new moodle_url('/mod/quiz/edit.php', array('cmid'=>$PAGE->cm->id, 'reordertool'=>'1')); + $editnode->add(get_string('orderandpaging','quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('t/edit', '')); } - } + if (has_capability('mod/quiz:preview', $PAGE->cm->context)) { $url = new moodle_url('/mod/quiz/startattempt.php', array('cmid'=>$PAGE->cm->id, 'sesskey'=>sesskey())); $quiznode->add(get_string('preview', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('t/preview', '')); } - if (has_capability('mod/quiz:manage', $PAGE->cm->context)) { - $url = new moodle_url('/mod/quiz/edit.php', array('cmid'=>$PAGE->cm->id)); - $quiznode->add(get_string('edit'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('t/edit', '')); + + question_extend_navigation($quiznode, $PAGE->course, $PAGE->cm); } - } Index: moodle/mod/quiz/overrides.php --- moodle/mod/quiz/overrides.php Base (1.2) +++ moodle/mod/quiz/overrides.php Locally Modified (Based On 1.2) @@ -42,8 +42,10 @@ print_error('invalidcoursemodule'); } -$url = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$cm->id, 'mode'=>$mode)); - +$url = new moodle_url('/mod/quiz/overrides.php', array('cmid'=>$cm->id)); +if ($mode !== 'group') { + $url->param('mode', $mode); +} $PAGE->set_url($url); require_login($cm->course, false, $cm); @@ -56,6 +58,7 @@ // Display a list of overrides $PAGE->set_title(get_string('overrides', 'quiz')); +$PAGE->set_heading($PAGE->title); echo $OUTPUT->header(); // Print heading and tabs (if there is more than one). Index: moodle/mod/quiz/report.php --- moodle/mod/quiz/report.php Base (1.55) +++ moodle/mod/quiz/report.php Locally Modified (Based On 1.55) @@ -37,12 +37,12 @@ } $url = new moodle_url('/mod/quiz/report.php'); - if ($id !== 0) { + if ($id) { $url->param('id', $id); } else { $url->param('q', $q); } - if ($mode !== '') { + if ($mode) { $url->param('mode', $mode); } $PAGE->set_url($url); Index: moodle/mod/quiz/report/default.php --- moodle/mod/quiz/report/default.php Base (1.24) +++ moodle/mod/quiz/report/default.php Locally Modified (Based On 1.24) @@ -28,6 +28,7 @@ $strquiz = get_string("modulename", "quiz"); /// Print the page header $PAGE->set_title(format_string($quiz->name)); + $PAGE->set_heading($PAGE->title); echo $OUTPUT->header(); /// Print the tabs $currenttab = 'reports';