Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
0aa571a2
Commit
0aa571a2
authored
Mar 26, 2015
by
Aaron Wells
Committed by
Gerrit Code Review
Mar 26, 2015
Browse files
Merge "Allow plugins to register admin menu items (Bug #1431540)"
parents
50cdb600
14f82418
Changes
5
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/lib.php
View file @
0aa571a2
...
...
@@ -169,6 +169,45 @@ abstract class PluginArtefact extends Plugin implements IPluginArtefact {
public
static
function
right_nav_menu_items
()
{
return
array
();
}
/**
* This function returns an array of admin menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
admin_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution staff menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_staff_menu_items
()
{
return
array
();
}
}
/**
...
...
htdocs/auth/lib.php
View file @
0aa571a2
...
...
@@ -2536,6 +2536,45 @@ class PluginAuth extends Plugin {
return
array
();
}
/**
* This function returns an array of admin menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
admin_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution staff menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_staff_menu_items
()
{
return
array
();
}
public
static
function
update_active_flag
(
$event
,
$user
)
{
if
(
!
isset
(
$user
[
'id'
]))
{
log_warn
(
"update_active_flag called without a user id"
);
...
...
htdocs/interaction/lib.php
View file @
0aa571a2
...
...
@@ -111,6 +111,45 @@ abstract class PluginInteraction extends Plugin implements IPluginInteraction {
public
static
function
right_nav_menu_items
()
{
return
array
();
}
/**
* This function returns an array of admin menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
admin_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution staff menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_staff_menu_items
()
{
return
array
();
}
}
/**
...
...
htdocs/lib/web.php
View file @
0aa571a2
...
...
@@ -2372,6 +2372,19 @@ function admin_nav() {
'weight'
=>
76
,
);
}
// enable plugins to augment the admin menu structure
foreach
(
array
(
'artefact'
,
'interaction'
,
'module'
,
'auth'
)
as
$plugintype
)
{
if
(
$plugins
=
plugins_installed
(
$plugintype
))
{
foreach
(
$plugins
as
&
$plugin
)
{
if
(
safe_require_plugin
(
$plugintype
,
$plugin
->
name
))
{
$plugin_menu
=
call_static_method
(
generate_class_name
(
$plugintype
,
$plugin
->
name
),
'admin_menu_items'
);
$menu
=
array_merge
(
$menu
,
$plugin_menu
);
}
}
}
}
return
$menu
;
}
...
...
@@ -2546,8 +2559,19 @@ function institutional_admin_nav() {
);
};
return
$ret
;
// enable plugins to augment the institution admin menu structure
foreach
(
array
(
'artefact'
,
'interaction'
,
'module'
,
'auth'
)
as
$plugintype
)
{
if
(
$plugins
=
plugins_installed
(
$plugintype
))
{
foreach
(
$plugins
as
&
$plugin
)
{
if
(
safe_require_plugin
(
$plugintype
,
$plugin
->
name
))
{
$plugin_menu
=
call_static_method
(
generate_class_name
(
$plugintype
,
$plugin
->
name
),
'institution_menu_items'
);
$ret
=
array_merge
(
$ret
,
$plugin_menu
);
}
}
}
}
return
$ret
;
}
/**
...
...
@@ -2559,7 +2583,7 @@ function institutional_admin_nav() {
* @return a data structure containing the staff navigation
*/
function
staff_nav
()
{
return
array
(
$menu
=
array
(
'usersearch'
=>
array
(
'path'
=>
'usersearch'
,
'url'
=>
'admin/users/search.php'
,
...
...
@@ -2582,6 +2606,20 @@ function staff_nav() {
'accesskey'
=>
'i'
,
),
);
// enable plugins to augment the institution staff menu structure
foreach
(
array
(
'artefact'
,
'interaction'
,
'module'
,
'auth'
)
as
$plugintype
)
{
if
(
$plugins
=
plugins_installed
(
$plugintype
))
{
foreach
(
$plugins
as
&
$plugin
)
{
if
(
safe_require_plugin
(
$plugintype
,
$plugin
->
name
))
{
$plugin_menu
=
call_static_method
(
generate_class_name
(
$plugintype
,
$plugin
->
name
),
'institution_staff_menu_items'
);
$menu
=
array_merge
(
$menu
,
$plugin_menu
);
}
}
}
}
return
$menu
;
}
/**
...
...
htdocs/module/lib.php
View file @
0aa571a2
...
...
@@ -50,4 +50,43 @@ abstract class PluginModule extends Plugin {
public
static
function
right_nav_menu_items
()
{
return
array
();
}
/**
* This function returns an array of admin menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
admin_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_menu_items
()
{
return
array
();
}
/**
* This function returns an array of institution staff menu items
* to be displayed
*
* See the function find_menu_children() in lib/web.php
* for a description of the expected array structure.
*
* @return array
*/
public
static
function
institution_staff_menu_items
()
{
return
array
();
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment