From ac28ee3f7abac584c0b787604112611fe8f6b207 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 2 Jan 2011 01:08:42 +0000 Subject: updated group widget git-svn-id: http://code.elgg.org/elgg/trunk@7811 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/widgets/save.php | 2 + mod/groups/languages/en.php | 3 + mod/groups/views/default/groups/featured.php | 11 ++-- .../default/widgets/a_users_groups/content.php | 74 ++++++++-------------- .../views/default/widgets/a_users_groups/edit.php | 37 +++++++---- 5 files changed, 59 insertions(+), 68 deletions(-) diff --git a/actions/widgets/save.php b/actions/widgets/save.php index a78f4ca75..b1649cc17 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -6,6 +6,8 @@ * @subpackage Widgets.Management */ +elgg_set_context('widgets'); + $guid = get_input('guid'); $params = get_input('params'); diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index 47c570c7f..01dd8a231 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -73,6 +73,9 @@ $english = array( 'groups:member' => "members", 'groups:searchtag' => "Search for groups by tag", + 'groups:more' => 'More groups', + 'groups:none' => 'No groups', + /* * Access diff --git a/mod/groups/views/default/groups/featured.php b/mod/groups/views/default/groups/featured.php index 50e473d1c..ef2be5885 100644 --- a/mod/groups/views/default/groups/featured.php +++ b/mod/groups/views/default/groups/featured.php @@ -8,16 +8,13 @@ */ if ($vars['featured']) { - + + elgg_push_context('widgets'); $body = ''; foreach ($vars['featured'] as $group) { - $icon = elgg_view("groups/icon", array( - 'entity' => $group, - 'size' => 'tiny', - )); - $body .= ""; + $body .= elgg_view_entity($group, false); } + elgg_pop_context(); echo elgg_view('layout/objects/module', array( 'title' => elgg_echo("groups:featured"), diff --git a/mod/groups/views/default/widgets/a_users_groups/content.php b/mod/groups/views/default/widgets/a_users_groups/content.php index 462ac419c..b9060dbb0 100644 --- a/mod/groups/views/default/widgets/a_users_groups/content.php +++ b/mod/groups/views/default/widgets/a_users_groups/content.php @@ -1,54 +1,32 @@ num_display; -if (!$number) { - $number = 4; -} - -//the page owner -$owner = $vars['entity']->owner_guid; +$num = $vars['entity']->num_display; -$groups = elgg_get_entities_from_relationship(array( +$options = array( + 'type' => 'group', 'relationship' => 'member', - 'relationship_guid' => $owner, - 'types' => 'group', - 'limit' => $number, -)); - - -if ($groups) { - - echo "
"; - - foreach ($groups as $group) { - $icon = elgg_view( - "groups/icon", array( - 'entity' => $group, - 'size' => 'small', - ) - ); - - $group_link = $group->getURL(); - - echo <<<___END - -
- $icon -
-

- $group->name
- $group->briefdescription -

-
-
-
-___END; - - } - echo "
"; + 'relationship_guid' => $vars['entity']->owner_guid, + 'limit' => $num, + 'full_view' => FALSE, + 'pagination' => FALSE, +); +$content = elgg_list_entities_from_relationship($options); + +echo $content; + +if ($content) { + $url = "pg/group/member/" . elgg_get_page_owner()->username; + $more_link = elgg_view('output/url', array( + 'href' => $url, + 'text' => elgg_echo('groups:more'), + )); + echo "$more_link"; +} else { + echo elgg_echo('groups:none'); } diff --git a/mod/groups/views/default/widgets/a_users_groups/edit.php b/mod/groups/views/default/widgets/a_users_groups/edit.php index fa47cdd62..7465f4b70 100644 --- a/mod/groups/views/default/widgets/a_users_groups/edit.php +++ b/mod/groups/views/default/widgets/a_users_groups/edit.php @@ -1,14 +1,25 @@ +num_display)) { + $vars['entity']->num_display = 4; +} + +$params = array( + 'internalname' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20), +); +$dropdown = elgg_view('input/pulldown', $params); + +?>

- : - -

\ No newline at end of file + : + +

-- cgit v1.2.3