Skip to content

Commit

Permalink
MDL-30802 question nav: fix questions link in front page course.
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Dec 23, 2011
1 parent ddb7ae2 commit c9882b7
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions lib/navigationlib.php
Expand Up @@ -3250,7 +3250,7 @@ protected function load_course_settings($forceopen = false) {
}

// Questions
require_once($CFG->dirroot.'/question/editlib.php');
require_once($CFG->libdir . '/questionlib.php');
question_extend_settings_navigation($coursenode, $coursecontext)->trim_if_empty();

if (has_capability('moodle/course:update', $coursecontext)) {
Expand Down Expand Up @@ -3952,23 +3952,9 @@ protected function load_front_page_settings($forceopen = false) {
$frontpage->add(get_string('restore'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/restore', ''));
}

// Manage questions
$questioncaps = array('moodle/question:add',
'moodle/question:editmine',
'moodle/question:editall',
'moodle/question:viewmine',
'moodle/question:viewall',
'moodle/question:movemine',
'moodle/question:moveall');
if (has_any_capability($questioncaps, $this->context)) {
$questionlink = $CFG->wwwroot.'/question/edit.php';
} else if (has_capability('moodle/question:managecategory', $this->context)) {
$questionlink = $CFG->wwwroot.'/question/category.php';
}
if (isset($questionlink)) {
$url = new moodle_url($questionlink, array('courseid'=>$course->id));
$frontpage->add(get_string('questions','quiz'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/questions', ''));
}
// Questions
require_once($CFG->libdir . '/questionlib.php');
question_extend_settings_navigation($frontpage, $coursecontext)->trim_if_empty();

// Manage files
if ($course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $this->context)) {
Expand Down

0 comments on commit c9882b7

Please sign in to comment.