diff options
Diffstat (limited to 'mod/invitefriends/start.php')
-rw-r--r-- | mod/invitefriends/start.php | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index abba12f20..bd470f144 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -5,16 +5,42 @@ * @package ElggInviteFriends */ +elgg_register_event_handler('init', 'system', 'invitefriends_init'); + +function invitefriends_init() { + register_page_handler('invite', 'invitefriends_page_handler'); + + elgg_register_action('invitefriends/invite', elgg_get_plugin_path() . 'invitefriends/actions/invite.php'); + + $params = array( + 'name' => 'invite', + 'title' => elgg_echo('friends:invite'), + 'url' => "pg/invite/", + 'contexts' => array('friends'), + ); + elgg_register_menu_item('page', $params); +} + /** - * Add menu item for invite friends + * Page handler function + * + * @param array $page Page URL segments */ -function invitefriends_pagesetup() { - if (elgg_get_context() == "friends" || - elgg_get_context() == "friendsof" || - elgg_get_context() == "collections") { - add_submenu_item(elgg_echo('friends:invite'), "mod/invitefriends/",'invite'); - } -} +function invitefriends_page_handler($page) { + gatekeeper(); -elgg_register_action('invitefriends/invite', elgg_get_plugin_path() . 'invitefriends/actions/invite.php'); -elgg_register_event_handler('pagesetup', 'system', 'invitefriends_pagesetup'); + elgg_set_context('friends'); + set_page_owner(get_loggedin_userid()); + + $title = elgg_echo('friends:invite'); + + $body = elgg_view('invitefriends/form'); + + $params = array( + 'content' => $body, + 'title' => $title, + ); + $body = elgg_view_layout('one_sidebar', $params); + + echo elgg_view_page($title, $body); +} |