Skip to content

Instantly share code, notes, and snippets.

@mkolb
Created October 25, 2012 13:54
Show Gist options
  • Save mkolb/3952670 to your computer and use it in GitHub Desktop.
Save mkolb/3952670 to your computer and use it in GitHub Desktop.
blog + groups fix
if (has_capability('moodle/course:viewparticipants', $this->page->context)) {
$participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CONTAINER, get_string('participants'), 'participants');
$currentgroup = groups_get_course_group($course, true);
if ($course->id == SITEID) {
$blogparams = array('courseid' => '');
} else if ($course->id && !$currentgroup) {
$blogparams = array('courseid' => clean_param($course->id, PARAM_INT));
} else {
$blogparams = array('group' => clean_param($currentgroup, PARAM_INT));
}
if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())))
and has_capability('moodle/blog:view', get_context_instance(CONTEXT_SYSTEM))) {
$blogsurls = new moodle_url('/blog/index.php', $blogparams);
$participants->add(get_string('blogscourse','blog'), $blogsurls->out());
}
if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
$participants->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$course->id)));
}
} else if (count($this->extendforuser) > 0 || $this->page->course->id == $course->id) {
$participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment