From 569f19d8ff89539eb8d38b1ca1b07a2baa41852c Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 18 Dec 2010 17:47:50 +0000 Subject: half way through converting submenu to new menu code - pages and groups are the two major users left git-svn-id: http://code.elgg.org/elgg/trunk@7669 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/invitefriends/index.php | 19 --------- mod/invitefriends/start.php | 46 +++++++++++++++++----- .../views/default/invitefriends/formitems.php | 2 - mod/notifications/groups.php | 13 +++--- mod/notifications/index.php | 13 +++--- mod/notifications/start.php | 20 ++++++++-- .../default/notifications/subscriptions/form.php | 8 +--- .../notifications/subscriptions/groupsform.php | 1 - 8 files changed, 69 insertions(+), 53 deletions(-) delete mode 100644 mod/invitefriends/index.php (limited to 'mod') diff --git a/mod/invitefriends/index.php b/mod/invitefriends/index.php deleted file mode 100644 index 7b4c34562..000000000 --- a/mod/invitefriends/index.php +++ /dev/null @@ -1,19 +0,0 @@ - $body)); - -echo elgg_view_page(elgg_echo('friends:invite'), $body); 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); +} diff --git a/mod/invitefriends/views/default/invitefriends/formitems.php b/mod/invitefriends/views/default/invitefriends/formitems.php index dceac6bbc..6d381a8ed 100644 --- a/mod/invitefriends/views/default/invitefriends/formitems.php +++ b/mod/invitefriends/views/default/invitefriends/formitems.php @@ -7,13 +7,11 @@ */ if ($CONFIG->allow_registration) { - $invite = elgg_echo('friends:invite'); $introduction = elgg_echo('invitefriends:introduction'); $message = elgg_echo('invitefriends:message'); $default = elgg_echo('invitefriends:message:default', array($CONFIG->site->name)); echo <<< HTML -

$invite

-- cgit v1.2.3