diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-25 22:18:16 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-25 22:18:16 +0000 |
commit | a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6 (patch) | |
tree | af382c4f81d43b63c4afe60ace1824c298390d47 /mod/file/start.php | |
parent | 58bd19d7cf35e6159124716d0da48d91354d3a2f (diff) | |
download | elgg-a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6.tar.gz elgg-a201a5bba863a6d0dfa3b68d73a227cfcc7f66b6.tar.bz2 |
updated owner blocks for users and groups
git-svn-id: http://code.elgg.org/elgg/trunk@7721 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/start.php')
-rw-r--r-- | mod/file/start.php | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/mod/file/start.php b/mod/file/start.php index 31362308c..bb291680e 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -60,7 +60,7 @@ // Register entity type register_entity_type('object','file'); - elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'file_user_ownerblock_menu'); + elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'file_owner_block_menu'); // embed support elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); @@ -70,24 +70,6 @@ } /** - * Sets up submenus for the file system. Triggered on pagesetup. - * - */ - function file_submenus() { - - global $CONFIG; - - $page_owner = elgg_get_page_owner(); - - // Group submenu option - if ($page_owner instanceof ElggGroup && elgg_get_context() == "groups") { - if($page_owner->file_enable != "no"){ - add_submenu_item(elgg_echo("file:group",array($page_owner->name)), $CONFIG->wwwroot . "pg/file/" . $page_owner->username); - } - } - } - - /** * File page handler * * @param array $page Array of page elements, forwarded by the page handling mechanism @@ -161,9 +143,18 @@ /** * Add a menu item to the user ownerblock */ -function file_user_ownerblock_menu($hook, $type, $return, $params) { - $item = new ElggMenuItem('file', elgg_echo('file'), "pg/file/owner/{$params['user']->username}"); - elgg_register_menu_item('user_ownerblock', $item); +function file_owner_block_menu($hook, $type, $return, $params) { + if (elgg_instanceof($params['entity'], 'user')) { + $url = "pg/file/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('file', elgg_echo('file'), $url); + elgg_register_menu_item('owner_block', $item); + } else { + if ($params['entity']->file_enable != "no") { + $url = "pg/file/owner/{$params['entity']->username}"; + $item = new ElggMenuItem('file', elgg_echo('file:group'), $url); + elgg_register_menu_item('owner_block', $item); + } + } } /** @@ -317,7 +308,6 @@ function file_user_ownerblock_menu($hook, $type, $return, $params) { // Make sure test_init is called on initialisation elgg_register_event_handler('init','system','file_init'); - elgg_register_event_handler('pagesetup','system','file_submenus'); // Register actions elgg_register_action("file/upload", $CONFIG->pluginspath . "file/actions/upload.php"); |