diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-28 19:17:36 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-10-28 19:17:36 +0000 |
commit | 7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch) | |
tree | 6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /engine/lib/usersettings.php | |
parent | bd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff) | |
download | elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2 |
Standardized code in all of core, not including language files, tests, or core mods.
git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/usersettings.php')
-rw-r--r-- | engine/lib/usersettings.php | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/engine/lib/usersettings.php b/engine/lib/usersettings.php index a815556dd..bec202b8a 100644 --- a/engine/lib/usersettings.php +++ b/engine/lib/usersettings.php @@ -3,31 +3,41 @@ * Elgg user settings functions. * Functions for adding and manipulating options on the user settings panel. * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Settings.User */ /** * Register a user settings page with the admin panel. - * This function extends the view "usersettings/main" with the provided view. This view should provide a description - * and either a control or a link to. + * This function extends the view "usersettings/main" with the provided view. + * This view should provide a description and either a control or a link to. * * Usage: * - To add a control to the main admin panel then extend usersettings/main - * - To add a control to a new page create a page which renders a view usersettings/subpage (where subpage is your new page - - * nb. some pages already exist that you can extend), extend the main view to point to it, and add controls to your - * new view. + * - To add a control to a new page create a page which renders a view + * usersettings/subpage (where subpage is your new page - + * nb. some pages already exist that you can extend), extend the main view + * to point to it, and add controls to your new view. * * At the moment this is essentially a wrapper around elgg_extend_view(). * * @param string $new_settings_view The view associated with the control you're adding - * @param string $view The view to extend, by default this is 'usersettings/main'. - * @param int $priority Optional priority to govern the appearance in the list. + * @param string $view The view to extend, by default this is 'usersettings/main'. + * @param int $priority Optional priority to govern the appearance in the list. + * + * @return bool */ -function extend_elgg_settings_page( $new_settings_view, $view = 'usersettings/main', $priority = 500) { +function extend_elgg_settings_page($new_settings_view, $view = 'usersettings/main', +$priority = 500) { + return elgg_extend_view($view, $new_settings_view, $priority); } +/** + * Set up the page for user settings + * + * @return void + */ function usersettings_pagesetup() { // Get config global $CONFIG; @@ -35,12 +45,24 @@ function usersettings_pagesetup() { // Menu options if (get_context() == "settings") { $user = get_loggedin_user(); - add_submenu_item(elgg_echo('usersettings:user:opt:linktext'),$CONFIG->wwwroot . "pg/settings/user/{$user->username}/"); - add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'),$CONFIG->wwwroot . "pg/settings/plugins/{$user->username}/"); - add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'),$CONFIG->wwwroot . "pg/settings/statistics/{$user->username}/"); + add_submenu_item(elgg_echo('usersettings:user:opt:linktext'), + $CONFIG->wwwroot . "pg/settings/user/{$user->username}/"); + + add_submenu_item(elgg_echo('usersettings:plugins:opt:linktext'), + $CONFIG->wwwroot . "pg/settings/plugins/{$user->username}/"); + + add_submenu_item(elgg_echo('usersettings:statistics:opt:linktext'), + $CONFIG->wwwroot . "pg/settings/statistics/{$user->username}/"); } } +/** + * Page handler for user settings + * + * @param array $page Pages array + * + * @return void + */ function usersettings_page_handler($page) { global $CONFIG; @@ -69,12 +91,14 @@ function usersettings_page_handler($page) { /** * Initialise the admin page. + * + * @return void */ function usersettings_init() { // Page handler - register_page_handler('settings','usersettings_page_handler'); + register_page_handler('settings', 'usersettings_page_handler'); } /// Register init function -register_elgg_event_handler('init','system','usersettings_init'); -register_elgg_event_handler('pagesetup','system','usersettings_pagesetup');
\ No newline at end of file +register_elgg_event_handler('init', 'system', 'usersettings_init'); +register_elgg_event_handler('pagesetup', 'system', 'usersettings_pagesetup');
\ No newline at end of file |