mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-27037, wiki does not support visiblegroups functionality
This commit is contained in:
parent
d48dae7507
commit
dc0cabb488
3 changed files with 28 additions and 1 deletions
|
@ -155,6 +155,7 @@ abstract class page_wiki {
|
|||
*/
|
||||
protected function setup_tabs($options = array()) {
|
||||
global $CFG, $PAGE;
|
||||
$groupmode = groups_get_activity_groupmode($PAGE->cm);
|
||||
|
||||
if (empty($CFG->usecomments) || !has_capability('mod/wiki:viewcomment', $PAGE->context)){
|
||||
unset($this->tabs['comments']);
|
||||
|
@ -164,6 +165,19 @@ abstract class page_wiki {
|
|||
unset($this->tabs['edit']);
|
||||
}
|
||||
|
||||
if ($groupmode and $groupmode == VISIBLEGROUPS) {
|
||||
$currentgroup = groups_get_activity_group($PAGE->cm);
|
||||
$manage = has_capability('mod/wiki:managewiki', $PAGE->cm->context);
|
||||
$edit = has_capability('mod/wiki:editpage', $PAGE->context);
|
||||
if (!$manage and !($edit and groups_is_member($currentgroup))) {
|
||||
unset($this->tabs['edit']);
|
||||
}
|
||||
} else {
|
||||
if (!has_capability('mod/wiki:editpage', $PAGE->context)) {
|
||||
unset($this->tabs['edit']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($options)) {
|
||||
$this->tabs_options = array('activetab' => substr(get_class($this), 10));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue