aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/admin.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-26 23:36:49 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-26 23:36:49 +0000
commit09acb61949e1051fc25e8fcf5936068415281802 (patch)
tree41006f6633590b7bf1718403590e0f2f3118d078 /engine/lib/admin.php
parent10682a7e334c5f5e0d805c974007fc5518023986 (diff)
downloadelgg-09acb61949e1051fc25e8fcf5936068415281802.tar.gz
elgg-09acb61949e1051fc25e8fcf5936068415281802.tar.bz2
simplified admin menu registration function in preparation for adding sections
git-svn-id: http://code.elgg.org/elgg/trunk@8500 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/admin.php')
-rw-r--r--engine/lib/admin.php61
1 files changed, 34 insertions, 27 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 1e4b63cdd..be01a150c 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -113,32 +113,33 @@ function elgg_admin_notice_exists($id) {
* Used in conjuction with http://elgg.org/admin/section_id/child_section style
* page handler.
*
- * @param string $section_id The Unique ID of section
- * @param string $section_title Human readable section title.
- * @param string $parent_id If a child section, the parent section id.
- * @param int $weight The menu item weight
+ * The text of the menu item is obtained from elgg_echo(admin:$parent_id:$menu_id)
+ *
+ * @param string $menu_id The Unique ID of section
+ * @param string $parent_id If a child section, the parent section id.
+ * @param int $weight The menu item weight
*
* @return bool
* @since 1.8.0
*/
-function elgg_add_admin_menu_item($section_id, $section_title, $parent_id = NULL, $weight = 100) {
+function elgg_add_admin_menu_item($menu_id, $parent_id = NULL, $weight = 100) {
// in the admin section parents never have links
if ($parent_id) {
- $href = "pg/admin/$parent_id/$section_id";
+ $href = "pg/admin/$parent_id/$menu_id";
} else {
$href = NULL;
}
- $name = $section_id;
+ $name = $menu_id;
if ($parent_id) {
- $name = "$name:$parent_id";
+ $name = "$parent_id:$name";
}
return elgg_register_menu_item('page', array(
'name' => $name,
'href' => $href,
- 'text' => $section_title,
+ 'text' => elgg_echo("admin:$name"),
'context' => 'admin',
'parent_name' => $parent_id,
'weight' => $weight,
@@ -174,32 +175,32 @@ function admin_init() {
elgg_register_simplecache_view('js/admin');
// statistics
- elgg_add_admin_menu_item('statistics', elgg_echo('admin:statistics'), null, 60);
- elgg_add_admin_menu_item('overview', elgg_echo('admin:statistics:overview'), 'statistics');
+ elgg_add_admin_menu_item('statistics', null, 60);
+ elgg_add_admin_menu_item('overview', 'statistics');
// site
- elgg_add_admin_menu_item('site', elgg_echo('admin:site'), null, 20);
- elgg_add_admin_menu_item('basic', elgg_echo('admin:site:basic'), 'site', 10);
- elgg_add_admin_menu_item('advanced', elgg_echo('admin:site:advanced'), 'site', 20);
+ elgg_add_admin_menu_item('site', null, 20);
+ elgg_add_admin_menu_item('basic', 'site', 10);
+ elgg_add_admin_menu_item('advanced', 'site', 20);
// appearance
- elgg_add_admin_menu_item('appearance', elgg_echo('admin:appearance'), null, 30);
- elgg_add_admin_menu_item('menu_items', elgg_echo('admin:appearance:menu_items'), 'appearance', 10);
- elgg_add_admin_menu_item('profile_fields', elgg_echo('admin:appearance:profile_fields'), 'appearance', 20);
+ elgg_add_admin_menu_item('appearance', null, 30);
+ elgg_add_admin_menu_item('menu_items', 'appearance', 10);
+ elgg_add_admin_menu_item('profile_fields', 'appearance', 20);
// users
- elgg_add_admin_menu_item('users', elgg_echo('admin:users'), null, 40);
- elgg_add_admin_menu_item('add', elgg_echo('admin:users:add'), 'users', 10);
- elgg_add_admin_menu_item('online', elgg_echo('admin:users:online'), 'users', 20);
- elgg_add_admin_menu_item('newest', elgg_echo('admin:users:newest'), 'users', 30);
+ elgg_add_admin_menu_item('users', null, 40);
+ elgg_add_admin_menu_item('add', 'users', 10);
+ elgg_add_admin_menu_item('online', 'users', 20);
+ elgg_add_admin_menu_item('newest', 'users', 30);
// plugins
- elgg_add_admin_menu_item('plugins', elgg_echo('admin:plugins'), null, 50);
- elgg_add_admin_menu_item('simple', elgg_echo('admin:plugins:simple'), 'plugins', 10);
- elgg_add_admin_menu_item('advanced', elgg_echo('admin:plugins:advanced'), 'plugins', 20);
+ elgg_add_admin_menu_item('plugins', null, 50);
+ elgg_add_admin_menu_item('simple', 'plugins', 10);
+ elgg_add_admin_menu_item('advanced', 'plugins', 20);
// utilities
- elgg_add_admin_menu_item('utilities', elgg_echo('admin:utilities'), null, 70);
+ elgg_add_admin_menu_item('utilities', null, 70);
// dashboard
elgg_register_menu_item('page', array(
@@ -250,12 +251,18 @@ function elgg_admin_add_plugin_settings_menu() {
return FALSE;
}
- elgg_add_admin_menu_item('plugin_settings', elgg_echo('admin:plugin_settings'), null, 51);
+ elgg_add_admin_menu_item('plugin_settings', null, 51);
foreach ($active_plugins as $plugin) {
$plugin_id = $plugin->getID();
if (elgg_view_exists("settings/$plugin_id/edit")) {
- elgg_add_admin_menu_item($plugin_id, $plugin->manifest->getName(), 'plugin_settings');
+ elgg_register_menu_item('page', array(
+ 'name' => $plugin_id,
+ 'href' => "pg/admin/plugin_settings/$plugin_id",
+ 'text' => $plugin->manifest->getName(),
+ 'parent_name' => 'plugin_settings',
+ 'context' => 'admin',
+ ));
}
}
}