Commit c39834fd authored by Alexander Del Ponte's avatar Alexander Del Ponte Committed by Cecilia Vela Gurovic
Browse files

Bug 1749408: Make it possible for PlugIns defining a grouptab

behatnotneeded

Change-Id: If9c4bfbc7e1113cd4de131712db821a048ba2136
parent a51cddc7
......@@ -154,15 +154,20 @@ class PluginArtefactBlog extends PluginArtefact {
return 'artefact/blog/view/index.php';
}
public static function group_tabs($groupid) {
return array(
'blogs' => array(
'path' => 'groups/blogs',
'url' => 'artefact/blog/index.php?group=' . $groupid,
'title' => get_string('Blogs', 'artefact.blog'),
'weight' => 65,
),
);
public static function group_tabs($groupid, $role) {
if ($role) {
return array(
'blogs' => array(
'path' => 'groups/blogs',
'url' => 'artefact/blog/index.php?group=' . $groupid,
'title' => get_string('Blogs', 'artefact.blog'),
'weight' => 65,
),
);
}
else {
return array();
}
}
}
......
......@@ -52,15 +52,20 @@ class PluginArtefactFile extends PluginArtefact {
);
}
public static function group_tabs($groupid) {
return array(
'files' => array(
'path' => 'groups/files',
'url' => 'artefact/file/groupfiles.php?group='.$groupid,
'title' => get_string('Files', 'artefact.file'),
'weight' => 80,
),
);
public static function group_tabs($groupid, $role) {
if ($role) {
return array(
'files' => array(
'path' => 'groups/files',
'url' => 'artefact/file/groupfiles.php?group='.$groupid,
'title' => get_string('Files', 'artefact.file'),
'weight' => 80,
),
);
}
else {
return array();
}
}
public static function get_event_subscriptions() {
......
......@@ -73,7 +73,7 @@ abstract class PluginArtefact extends Plugin implements IPluginArtefact {
* - url relative to wwwroot
* @return array
*/
public static function group_tabs($groupid) {
public static function group_tabs($groupid, $role) {
return array();
}
......
......@@ -1753,4 +1753,16 @@ class BlockInstance {
}
return $js;
}
/**
* This function returns an array of menu items to be displayed
* on a group page when viewed by group members.
* Each item should be a StdClass object containing -
* - title language pack key
* - url relative to wwwroot
* @return array
*/
public static function group_tabs($groupid, $role) {
return array();
}
}
......@@ -91,8 +91,4 @@ abstract class GroupType implements IGroupType {
public static function can_become_admin($userid) {
return true;
}
public static function get_group_artefact_plugins() {
return array('file', 'blog');
}
}
......@@ -2062,16 +2062,16 @@ function group_get_menu_tabs() {
);
}
if ($role) {
safe_require('grouptype', $group->grouptype);
$artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
if ($plugins = plugins_installed('artefact')) {
foreach ($plugins as &$plugin) {
if (!in_array($plugin->name, $artefactplugins)) {
continue;
}
safe_require('artefact', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('artefact',$plugin->name), 'group_tabs', $group->id);
foreach (plugin_types_installed() as $plugin_type_installed) {
foreach (plugins_installed($plugin_type_installed) as $plugin) {
safe_require($plugin_type_installed, $plugin->name);
if (method_exists(generate_class_name($plugin_type_installed, $plugin->name),'group_tabs')) {
$plugin_menu = call_static_method(
generate_class_name($plugin_type_installed, $plugin->name),
'group_tabs',
$group->id,
$role
);
$menu = array_merge($menu, $plugin_menu);
}
}
......
......@@ -89,4 +89,16 @@ abstract class PluginModule extends Plugin {
public static function institution_staff_menu_items() {
return array();
}
/**
* This function returns an array of menu items to be displayed
* on a group page when viewed by group members.
* Each item should be a StdClass object containing -
* - title language pack key
* - url relative to wwwroot
* @return array
*/
public static function group_tabs($groupid, $role) {
return array();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment