diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-14 12:54:15 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-14 12:54:15 +0000 |
commit | 53ab8cf80e4990ac1daf17c7a23931d26110e2f5 (patch) | |
tree | bb36b1a57232e43d3f874a09a2e3600af392b853 | |
parent | 964aae2967218c594fe5fcbadfdcada731ef2a6e (diff) | |
download | elgg-53ab8cf80e4990ac1daf17c7a23931d26110e2f5.tar.gz elgg-53ab8cf80e4990ac1daf17c7a23931d26110e2f5.tar.bz2 |
Fixes #2723 members listing pages now in core
git-svn-id: http://code.elgg.org/elgg/trunk@7616 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/upgrades/2010121401.php | 7 | ||||
-rw-r--r-- | engine/lib/users.php | 24 | ||||
-rw-r--r-- | languages/en.php | 8 | ||||
-rw-r--r-- | pages/members/index.php | 37 | ||||
-rw-r--r-- | pages/members/search.php | 39 | ||||
-rw-r--r-- | version.php | 2 | ||||
-rw-r--r-- | views/default/core/members/nav.php | 24 | ||||
-rw-r--r-- | views/default/core/members/sidebar.php | 33 | ||||
-rw-r--r-- | views/default/forms/members/name_search.php | 8 | ||||
-rw-r--r-- | views/default/forms/members/tag_search.php | 11 |
10 files changed, 192 insertions, 1 deletions
diff --git a/engine/lib/upgrades/2010121401.php b/engine/lib/upgrades/2010121401.php new file mode 100644 index 000000000..30e4dff32 --- /dev/null +++ b/engine/lib/upgrades/2010121401.php @@ -0,0 +1,7 @@ +<?php +global $CONFIG; + +/** + * Disable members plugin as it has been moved into core. + */ +disable_plugin('members', $CONFIG->site->guid);
\ No newline at end of file diff --git a/engine/lib/users.php b/engine/lib/users.php index a91f143b0..a7153a1be 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1462,6 +1462,29 @@ function user_create_hook_add_site_relationship($event, $object_type, $object) { } /** + * Members page handler + * + * @param array $page url segments + */ +function elgg_members_page_handler($page) { + global $CONFIG; + + if (!isset($page[0])) { + $page[0] = 'newest'; + } + + $vars = array(); + $vars['page'] = $page[0]; + + if ($page[0] == 'search') { + $vars['search_type'] = $page[1]; + require_once("{$CONFIG->path}pages/members/search.php"); + } else { + require_once("{$CONFIG->path}pages/members/index.php"); + } +} + +/** * Sets up user-related menu items * * @return void @@ -1511,6 +1534,7 @@ function users_init() { register_page_handler('register', 'registration_page_handler'); register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); register_page_handler('login', 'elgg_user_login_page_handler'); + register_page_handler('members', 'elgg_members_page_handler'); elgg_register_action("register", '', 'public'); elgg_register_action("useradd", '', 'public'); diff --git a/languages/en.php b/languages/en.php index bbda438a1..b89124c6c 100644 --- a/languages/en.php +++ b/languages/en.php @@ -638,6 +638,13 @@ $english = array( 'river:comments:more' => '+%u more', 'river:generic_comment' => 'commented on %s %s', + 'members:label:newest' => 'Newest', + 'members:label:popular' => 'Popular', + 'members:label:online' => 'Online', + 'members:searchname' => 'Search members by name', + 'members:searchtag' => 'Search members by tag', + 'members:title:searchname' => 'Member search for %s', + 'members:title:searchtag' => 'Members tagged with %s', /** * Generic action words @@ -676,6 +683,7 @@ $english = array( 'site' => 'Site', 'activity' => 'Activity', + 'members' => 'Members', 'up' => 'Up', 'down' => 'Down', diff --git a/pages/members/index.php b/pages/members/index.php new file mode 100644 index 000000000..82adf2a4a --- /dev/null +++ b/pages/members/index.php @@ -0,0 +1,37 @@ +<?php +/** + * Members index + * + */ + +$num_members = get_number_users(); + +$title = elgg_echo('members'); + +$options = array('type' => 'user', 'full_view' => false); +switch ($vars['page']) { + case 'popular': + $options['relationship'] = 'friend'; + $options['inverse_relationship'] = false; + $content = elgg_list_entities_from_relationship_count($options); + break; + case 'online': + $content = get_online_users(); + break; + case 'newest': + default: + $content = elgg_list_entities($options); + break; +} + +$params = array( + 'content' => $content, + 'sidebar' => elgg_view('core/members/sidebar'), + 'title' => $title . " ($num_members)", + 'buttons' => '', + 'filter_override' => elgg_view('core/members/nav', array('selected' => $vars['page'])), +); + +$body = elgg_view_layout('content', $params); + +echo elgg_view_page($title, $body); diff --git a/pages/members/search.php b/pages/members/search.php new file mode 100644 index 000000000..1a0168660 --- /dev/null +++ b/pages/members/search.php @@ -0,0 +1,39 @@ +<?php +/** + * Members search page + * + */ + +if ($vars['search_type'] == 'tag') { + $tag = get_input('tag'); + + $title = elgg_echo('members:title:searchtag', array($tag)); + $content = elgg_view_title($title); + + $options = array(); + $options['query'] = $tag; + $options['type'] = "user"; + $options['offset'] = $offset; + $options['limit'] = $limit; + $results = elgg_trigger_plugin_hook('search', 'tags', $options, array()); + $count = $results['count']; + $users = $results['entities']; + $content .= elgg_view_entity_list($users, $count, $offset, $limit, false, false, true); +} else { + $name = get_input('name'); + + $title = elgg_echo('members:title:searchname', array($name)); + $content = elgg_view_title($title); + + elgg_set_context('search'); + $content .= list_user_search($name); +} + +$params = array( + 'body' => $content, + 'sidebar' => elgg_view('core/members/sidebar'), +); + +$body = elgg_view_layout('one_sidebar', $params); + +echo elgg_view_page($title, $body); diff --git a/version.php b/version.php index 89dd26f69..d2c27318c 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2010111501; +$version = 2010121401; // Human-friendly version name $release = '1.8-svn'; diff --git a/views/default/core/members/nav.php b/views/default/core/members/nav.php new file mode 100644 index 000000000..a713fa8a3 --- /dev/null +++ b/views/default/core/members/nav.php @@ -0,0 +1,24 @@ +<?php +/** + * Members navigation + */ + +$tabs = array( + 'newest' => array( + 'title' => elgg_echo('members:label:newest'), + 'url' => "pg/members/newest/", + 'selected' => $vars['selected'] == 'newest', + ), + 'popular' => array( + 'title' => elgg_echo('members:label:popular'), + 'url' => "pg/members/popular/", + 'selected' => $vars['selected'] == 'popular', + ), + 'online' => array( + 'title' => elgg_echo('members:label:online'), + 'url' => "pg/members/online/", + 'selected' => $vars['selected'] == 'online', + ), +); + +echo elgg_view('navigation/tabs', array('tabs' => $tabs)); diff --git a/views/default/core/members/sidebar.php b/views/default/core/members/sidebar.php new file mode 100644 index 000000000..821547f99 --- /dev/null +++ b/views/default/core/members/sidebar.php @@ -0,0 +1,33 @@ +<?php +/** + * Members sidebar + */ + +// Tag search +$params = array( + 'method' => 'get', + 'action' => elgg_get_site_url() . 'pg/members/search/tag/', + 'disable_security' => true, +); +$body = elgg_view_form('members/tag_search', $params); + +$params = array( + 'title' => elgg_echo('members:searchtag'), + 'body' => $body, +); +echo elgg_view('layout/objects/module', $params); + + +// name search +$params = array( + 'method' => 'get', + 'action' => elgg_get_site_url() . 'pg/members/search/name/', + 'disable_security' => true, +); +$body = elgg_view_form('members/name_search', $params); + +$params = array( + 'title' => elgg_echo('members:searchname'), + 'body' => $body, +); +echo elgg_view('layout/objects/module', $params); diff --git a/views/default/forms/members/name_search.php b/views/default/forms/members/name_search.php new file mode 100644 index 000000000..265290fc9 --- /dev/null +++ b/views/default/forms/members/name_search.php @@ -0,0 +1,8 @@ +<?php + +$params = array( + 'internalname' => 'name', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); diff --git a/views/default/forms/members/tag_search.php b/views/default/forms/members/tag_search.php new file mode 100644 index 000000000..1a281963d --- /dev/null +++ b/views/default/forms/members/tag_search.php @@ -0,0 +1,11 @@ +<?php +/** + * Simple members search by tag form + */ + +$params = array( + 'internalname' => 'tag', +); +echo elgg_view('input/text', $params); + +echo elgg_view('input/submit', array('value' => elgg_echo('search'))); |