From 72c83e4904a13c0e07d0d328ccbd201d16a617cc Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 19 Dec 2010 02:14:39 +0000 Subject: pulled user owner block menu out of profile plugin with new menu code git-svn-id: http://code.elgg.org/elgg/trunk@7677 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/start.php | 10 ++++++ mod/bookmarks/start.php | 10 ++++++ mod/file/start.php | 10 ++++++ mod/pages/start.php | 10 ++++++ mod/profile/views/default/profile/ownerblock.php | 43 ++---------------------- 5 files changed, 42 insertions(+), 41 deletions(-) (limited to 'mod') diff --git a/mod/blog/start.php b/mod/blog/start.php index fb9e7d6ef..3086d9087 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -38,6 +38,8 @@ function blog_init() { register_notification_object('object', 'blog', elgg_echo('blog:newpost')); elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'blog_notify_message'); + elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'blog_user_ownerblock_menu'); + // pingbacks //elgg_register_event_handler('create', 'object', 'blog_incoming_ping'); //elgg_register_plugin_hook_handler('pingback:object:subtypes', 'object', 'blog_pingback_subtypes'); @@ -230,6 +232,14 @@ function blog_url_handler($entity) { return "pg/blog/read/{$user->username}/{$entity->guid}/$friendly_title"; } +/** + * Add a menu item to the user ownerblock + */ +function blog_user_ownerblock_menu($hook, $type, $return, $params) { + $item = new ElggMenuItem('blog', elgg_echo('blog'), "pg/blog/owner/{$params['user']->username}"); + elgg_register_menu_item('user_ownerblock', $item); +} + /** * Register blogs with ECML. * diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php index 30272bb69..ee9d4be2d 100644 --- a/mod/bookmarks/start.php +++ b/mod/bookmarks/start.php @@ -40,6 +40,8 @@ function bookmarks_init() { // Add group menu option add_group_tool_option('bookmarks',elgg_echo('bookmarks:enablebookmarks'),true); + elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'bookmarks_user_ownerblock_menu'); + // Extend Groups profile page elgg_extend_view('groups/tool_latest','bookmarks/group_bookmarks'); @@ -312,6 +314,14 @@ function bookmark_url($entity) { return "pg/bookmarks/" . $entity->getOwnerEntity()->username . "/read/" . $entity->getGUID() . "/" . $title; } +/** + * Add a menu item to the user ownerblock + */ +function bookmarks_user_ownerblock_menu($hook, $type, $return, $params) { + $item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), "pg/bookmarks/owner/{$params['user']->username}"); + elgg_register_menu_item('user_ownerblock', $item); +} + /** * Returns a more meaningful message * diff --git a/mod/file/start.php b/mod/file/start.php index 227a5c33c..31362308c 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -60,6 +60,8 @@ // Register entity type register_entity_type('object','file'); + elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'file_user_ownerblock_menu'); + // embed support elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); elgg_register_plugin_hook_handler('embed_get_items', 'file', 'file_embed_get_items'); @@ -156,6 +158,14 @@ return null; } +/** + * 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); +} + /** * Returns an overall file type from the mimetype * diff --git a/mod/pages/start.php b/mod/pages/start.php index e90c6db54..83c765ccd 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -64,6 +64,8 @@ function pages_init() { 'write_access_id' => 'access', ); + elgg_register_plugin_hook_handler('register', 'menu:user_ownerblock', 'pages_user_ownerblock_menu'); + // register ecml views to parse elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook'); } @@ -92,6 +94,14 @@ function pages_submenus() { } } +/** + * Add a menu item to the user ownerblock + */ +function pages_user_ownerblock_menu($hook, $type, $return, $params) { + $item = new ElggMenuItem('pages', elgg_echo('pages'), "pg/pages/owner/{$params['user']->username}"); + elgg_register_menu_item('user_ownerblock', $item); +} + /** * Pages page handler. * diff --git a/mod/profile/views/default/profile/ownerblock.php b/mod/profile/views/default/profile/ownerblock.php index 3fb5f509e..c0b5fd898 100755 --- a/mod/profile/views/default/profile/ownerblock.php +++ b/mod/profile/views/default/profile/ownerblock.php @@ -74,39 +74,7 @@ if (isadminloggedin()) { $admin_links = ''; } - -//check tools are enabled - hard-coded for phase1 -// @todo - provide a view to extend for profile pages ownerblock tool-links -if(is_plugin_enabled('blog')){ - $blog_link = "
  • Blog
  • "; -}else{ - $blog_link = ""; -} -if(is_plugin_enabled('bookmarks')){ - $bookmark_link = "
  • Bookmarks
  • "; -}else{ - $bookmark_link = ""; -} -if(is_plugin_enabled('document')){ - $docs_link = "
  • Documents
  • "; -}else{ - $docs_link = ""; -} -if(is_plugin_enabled('feeds')){ - $feeds_link = "
  • Feeds
  • "; -}else{ - $feeds_link = ""; -} -if(is_plugin_enabled('tidypics')){ - $tidypics_link = "
  • Photos
  • "; -}else{ - $tidypics_link = ""; -} -if(is_plugin_enabled('videolist')){ - $video_link = "
  • Videos
  • "; -}else{ - $video_link = ""; -} +$menu = elgg_view_menu('user_ownerblock', array('user' => elgg_get_page_owner())); //contruct the display $display = << - + $menu {$admin_links} -- cgit v1.2.3