aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 02:14:39 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-19 02:14:39 +0000
commit72c83e4904a13c0e07d0d328ccbd201d16a617cc (patch)
treecae9eee563d5dce2cf22896ecdfbdf516611abe0
parentabf3fcae3f90b4c52e40d3ef8bb11f92c7a03d1c (diff)
downloadelgg-72c83e4904a13c0e07d0d328ccbd201d16a617cc.tar.gz
elgg-72c83e4904a13c0e07d0d328ccbd201d16a617cc.tar.bz2
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
-rw-r--r--mod/blog/start.php10
-rw-r--r--mod/bookmarks/start.php10
-rw-r--r--mod/file/start.php10
-rw-r--r--mod/pages/start.php10
-rwxr-xr-xmod/profile/views/default/profile/ownerblock.php43
5 files changed, 42 insertions, 41 deletions
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');
@@ -231,6 +233,14 @@ function blog_url_handler($entity) {
}
/**
+ * 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.
*
* @param unknown_type $hook
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');
@@ -313,6 +315,14 @@ function bookmark_url($entity) {
}
/**
+ * 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
*
* @param unknown_type $hook
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');
}
@@ -93,6 +95,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.
*
* @param array $page
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 = "<li><a href=\"".elgg_get_site_url()."pg/blog/{$username}\">Blog</a></li>";
-}else{
- $blog_link = "";
-}
-if(is_plugin_enabled('bookmarks')){
- $bookmark_link = "<li><a href=\"".elgg_get_site_url()."pg/bookmarks/{$username}\">Bookmarks</a></li>";
-}else{
- $bookmark_link = "";
-}
-if(is_plugin_enabled('document')){
- $docs_link = "<li><a href=\"".elgg_get_site_url()."pg/document/{$username}\">Documents</a></li>";
-}else{
- $docs_link = "";
-}
-if(is_plugin_enabled('feeds')){
- $feeds_link = "<li><a href=\"".elgg_get_site_url()."pg/feeds/{$username}\">Feeds</a></li>";
-}else{
- $feeds_link = "";
-}
-if(is_plugin_enabled('tidypics')){
- $tidypics_link = "<li><a href=\"".elgg_get_site_url()."pg/photos/owned/{$username}\">Photos</a></li>";
-}else{
- $tidypics_link = "";
-}
-if(is_plugin_enabled('videolist')){
- $video_link = "<li><a href=\"".elgg_get_site_url()."pg/videolist/owned/{$username}\">Videos</a></li>";
-}else{
- $video_link = "";
-}
+$menu = elgg_view_menu('user_ownerblock', array('user' => elgg_get_page_owner()));
//contruct the display
$display = <<<EOT
@@ -118,14 +86,7 @@ $display = <<<EOT
{$more_info}
{$profile_actions}
<div class="owner_block_links">
- <ul>
- {$blog_link}
- {$bookmark_link}
- {$docs_link}
- {$feeds_link}
- {$tidypics_link}
- {$video_link}
- </ul>
+ $menu
</div>
<!-- if admin user -->
{$admin_links}