From 2ef37109d866708def220d082c0430f77efd6410 Mon Sep 17 00:00:00 2001 From: cash Date: Wed, 26 Jan 2011 02:03:29 +0000 Subject: adding margin to admin buttons git-svn-id: http://code.elgg.org/elgg/trunk@7931 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/start.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'mod/reportedcontent/start.php') diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index d92eb05a2..9708c3b14 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -19,15 +19,22 @@ function reportedcontent_init() { elgg_extend_view('css/screen', 'reportedcontent/css'); elgg_extend_view('css/admin', 'reportedcontent/admin_css'); - // Extend context menu and footer with report content link + // Extend footer with report content link if (isloggedin()) { - elgg_extend_view('profile/menu/links', 'reportedcontent/user_report'); elgg_extend_view('footer/links', 'reportedcontent/footer_link'); } + elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu'); + // Add admin menu item elgg_add_admin_menu_item('reportedcontent', elgg_echo('reportedcontent'), 'utilities'); + elgg_register_widget_type( + 'reportedcontent', + elgg_echo('reportedcontent'), + elgg_echo('reportedcontent:widget:description'), + 'admin'); + // Register actions $action_path = elgg_get_plugin_path() . "reportedcontent/actions"; elgg_register_action('reportedcontent/add', "$action_path/add.php"); @@ -58,3 +65,25 @@ function reportedcontent_page_handler($page) { echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); } + +/** + * Add report user link to hover menu + */ +function reportedcontent_user_hover_menu($hook, $type, $return, $params) { + $user = $params['entity']; + + $profile_url = urlencode($user->getURL()); + $name = urlencode($user->name); + $url = "pg/reportedcontent/add/?address=$profile_url&title=$name"; + + if (isloggedin() && get_loggedin_userid() != $user->guid) { + $item = new ElggMenuItem( + 'reportuser', + elgg_echo('reportedcontent:user'), + $url); + $item->setSection('action'); + $return[] = $item; + } + + return $return; +} \ No newline at end of file -- cgit v1.2.3