From 88c3d54f0a6ceb0b539af4e922157b101b945542 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 4 Mar 2010 16:36:48 +0000 Subject: Merged interface changes to profile in. git-svn-id: http://code.elgg.org/elgg/trunk@5284 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/profile_lib.php | 73 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 mod/profile/profile_lib.php (limited to 'mod/profile/profile_lib.php') diff --git a/mod/profile/profile_lib.php b/mod/profile/profile_lib.php new file mode 100644 index 000000000..176c6e4de --- /dev/null +++ b/mod/profile/profile_lib.php @@ -0,0 +1,73 @@ + + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.com/ + */ + +/** + * Returns the html for a user profile. + * + * @param string $username The username of the profile to display + * @param string $section Which section is currently selected. + * + * return mixed FALSE or html for the profile. + */ +function profile_get_user_profile_html($user, $section = 'activity') { + $body = elgg_view('profile/profile_navigation', array('section' => $section, 'entity' => $user)); + $view_options = array('entity' => $user); + + switch($section){ + case 'widgets': + $body .= elgg_view_layout('widgets', $view_options); + break; + + case 'friends': + $body .= elgg_view('profile/profile_contents/friends', $view_options); + break; + + case 'twitter': + $body .= elgg_view('profile/profile_contents/twitter', $view_options); + break; + + case 'details': + $body .= elgg_view('profile/profile_contents/details', $view_options); + break; + + default: + case 'activity': + $body .= elgg_view('profile/profile_contents/activity', $view_options); + break; + } + + return $body; +} + +/** + * Dispatch the html for the edit section + * + * @param unknown_type $user + * @param unknown_type $page + * @return string + */ +function profile_get_user_edit_content($user, $page) { + $section = (isset($page[2])) ? $page[2] : 'details'; + + switch ($section) { + case 'icon': + $content = elgg_view_title(elgg_echo('profile:edit')); + $content .= elgg_view("profile/editicon", array('entity' => $user)); + break; + default: + case 'details': + $content = elgg_view_title(elgg_echo('profile:edit')); + $content .= elgg_view("profile/edit", array('entity' => $user)); + break; + } + + return $content; +} \ No newline at end of file -- cgit v1.2.3