From f7b20eb31aeab71ab42e1f4e66d5b12506e9d526 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 22 Apr 2010 17:56:16 +0000 Subject: Updated groups to 1.7 api. git-svn-id: http://code.elgg.org/elgg/trunk@5851 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/groups/languages/en.php | 1 + mod/groups/views/default/forms/groups/invite.php | 24 +++++++---- mod/groups/views/default/groups/groupprofile.php | 33 +++++++++----- mod/groups/views/default/sharing/invite.php | 19 ++++---- .../views/default/widgets/a_users_groups/view.php | 50 +++++++++++++--------- 5 files changed, 79 insertions(+), 48 deletions(-) diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index d3f035f5f..04794e91f 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -54,6 +54,7 @@ 'groups:invite' => 'Invite friends', 'groups:inviteto' => "Invite friends to '%s'", 'groups:nofriends' => "You have no friends left who have not been invited to this group.", + 'groups:nofriendsatall' => 'You have no friends to invite!', 'groups:viagroups' => "via groups", 'groups:group' => "Group", 'groups:search:tags' => "tag", diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php index e5042aa4e..07fe7ad97 100644 --- a/mod/groups/views/default/forms/groups/invite.php +++ b/mod/groups/views/default/forms/groups/invite.php @@ -1,7 +1,7 @@ owner_guid); $forward_url = $group->getURL(); - - + + $friends = elgg_get_entities_from_relationship($options); + $options = array( + 'relationship' => 'friend', + 'relationship_guid' => get_loggedin_user()->guid, + 'type' => 'user', + 'limit' => 9999 + ); +if ($friends) { ?>
$friends, 'internalname' => 'user_guid', 'highlight' => 'all')); - } - // echo elgg_view('sharing/invite',array('shares' => $shares, 'owner' => $owner, 'group' => $group)); - + echo elgg_view('friends/picker',array('entities' => $friends, 'internalname' => 'user_guid', 'highlight' => 'all')); + ?>
+ - +
" . elgg_echo("groups:owner") . ": owner_guid)->getURL() . "\">" . get_user($vars['entity']->owner_guid)->name . "

"; ?> -

guid, true, 'user', '', 0, '', 9999, 0, true); ?>

+

'member', + 'relationship_guid' => $vars['entity']->guid, + 'inverse_relationship' => TRUE, + 'limit' => 0, + 'count' => TRUE + ); + + $count = elgg_get_entities_from_relationship($options); + + echo elgg_echo('groups:members') . ": " . $count; + + ?>

- +
group) && sizeof($vars['config']->group) > 0){ - + foreach($vars['config']->group as $shortname => $valtype) { if ($shortname != "name") { $value = $vars['entity']->$shortname; - + if (!empty($value)) { //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; } - + echo "

"; echo ""; echo elgg_echo("groups:{$shortname}"); echo ": "; - + $options = array( 'value' => $vars['entity']->$shortname ); - + if ($valtype == 'tags') { $options['tag_names'] = $shortname; } - + echo elgg_view("output/{$valtype}", $options); - + echo "

"; } } diff --git a/mod/groups/views/default/sharing/invite.php b/mod/groups/views/default/sharing/invite.php index 5c3d6b316..bd8e7c821 100644 --- a/mod/groups/views/default/sharing/invite.php +++ b/mod/groups/views/default/sharing/invite.php @@ -1,7 +1,7 @@ getGUID(),false,'user','')) { - + + $options = array('relationship' => 'friend', 'relationship_guid' => $owner->getGUID(), 'type' => 'user'); + if ($friends = elgg_get_entities_from_relationship($options)) { + foreach($friends as $friend) { - + if (!$group->isMember($friend)) { $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny')); - $label .= "{$friend->name}"; + $label .= "{$friend->name}"; $options[$label] = $friend->getGUID(); } } - + if ($options) { echo elgg_view('input/checkboxes',array( - + 'internalname' => 'user_guid', 'options' => $options, - + )); } else diff --git a/mod/groups/views/default/widgets/a_users_groups/view.php b/mod/groups/views/default/widgets/a_users_groups/view.php index 3328a8778..f020e07c4 100644 --- a/mod/groups/views/default/widgets/a_users_groups/view.php +++ b/mod/groups/views/default/widgets/a_users_groups/view.php @@ -1,24 +1,32 @@ num_display; if (!$number) $number = 4; - - //the page owner + + //the page owner $owner = $vars['entity']->owner_guid; - - //$groups = get_users_membership($owner); - //$groups = list_entities_from_relationship('member',$owner,false,'group','',0,$number,false,false,false); - $groups = get_entities_from_relationship('member', $owner, false, "group", "", 0, "", $number, 0, false, 0); - - - if($groups){ - + + //$groups = get_users_membership($owner); + //$groups = list_entities_from_relationship('member',$owner,false,'group','',0,$number,false,false,false); + + $options = array( + 'relationship' => 'member', + 'relationship_guid' => $owner, + 'type' => 'group', + 'limit' => $number, + ); + + $groups = elgg_get_entities_from_relationship($options); + + + if($groups){ + echo "
"; foreach($groups as $group){ @@ -26,17 +34,17 @@ "groups/icon", array( 'entity' => $group, 'size' => 'small', - ) + ) ); - + echo "
" . $icon . "

" . $group->name . "
"; echo $group->briefdescription . "

"; - + } echo "
"; - } + } + +// echo $groups; - // echo $groups; - ?> \ No newline at end of file -- cgit v1.2.3