aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-22 17:56:16 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-22 17:56:16 +0000
commitf7b20eb31aeab71ab42e1f4e66d5b12506e9d526 (patch)
treeba070a7f5f23fff7fabeea8013d25f779a09a985
parentfbf1ce69b529129c1d92772c2805f99480bd4650 (diff)
downloadelgg-f7b20eb31aeab71ab42e1f4e66d5b12506e9d526.tar.gz
elgg-f7b20eb31aeab71ab42e1f4e66d5b12506e9d526.tar.bz2
Updated groups to 1.7 api.
git-svn-id: http://code.elgg.org/elgg/trunk@5851 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/groups/languages/en.php1
-rw-r--r--mod/groups/views/default/forms/groups/invite.php24
-rw-r--r--mod/groups/views/default/groups/groupprofile.php33
-rw-r--r--mod/groups/views/default/sharing/invite.php19
-rw-r--r--mod/groups/views/default/widgets/a_users_groups/view.php50
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 @@
<?php
/**
* Elgg groups plugin
- *
+ *
* @package ElggGroups
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
@@ -12,21 +12,29 @@
$group = $vars['entity'];
$owner = get_entity($vars['entity']->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) {
?>
<form action="<?php echo $vars['url']; ?>action/groups/invite" method="post" class="margin_top">
<?php
echo elgg_view('input/securitytoken');
- if ($friends = get_entities_from_relationship('friend',$_SESSION['guid'],false,'user','',0,'',9999)) {
- echo elgg_view('friends/picker',array('entities' => $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'));
+
?>
<input type="hidden" name="forward_url" value="<?php echo $forward_url; ?>" />
<input type="hidden" name="group_guid" value="<?php echo $group->guid; ?>" />
<input type="submit" value="<?php echo elgg_echo('invite'); ?>" />
</form>
+<?php
+} else {
+ echo elgg_echo('groups:nofriendsatall');
+} \ No newline at end of file
diff --git a/mod/groups/views/default/groups/groupprofile.php b/mod/groups/views/default/groups/groupprofile.php
index 5232e9a6f..f1ca92e4e 100644
--- a/mod/groups/views/default/groups/groupprofile.php
+++ b/mod/groups/views/default/groups/groupprofile.php
@@ -35,44 +35,57 @@
));
?>
</div>
-
+
<div class="group_stats">
<?php
echo "<p><b>" . elgg_echo("groups:owner") . ": </b><a href=\"" . get_user($vars['entity']->owner_guid)->getURL() . "\">" . get_user($vars['entity']->owner_guid)->name . "</a></p>";
?>
- <p><?php echo elgg_echo('groups:members') . ": " . get_entities_from_relationship('member', $vars['entity']->guid, true, 'user', '', 0, '', 9999, 0, true); ?></p>
+ <p><?php
+ $options = array(
+ 'relationship' => '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;
+
+ ?></p>
</div>
</div>
-
+
<div class="group_profile_column info">
<?php
if ($vars['full'] == true) {
if (is_array($vars['config']->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 "<p class=\"{$even_odd}\">";
echo "<b>";
echo elgg_echo("groups:{$shortname}");
echo ": </b>";
-
+
$options = array(
'value' => $vars['entity']->$shortname
);
-
+
if ($valtype == 'tags') {
$options['tag_names'] = $shortname;
}
-
+
echo elgg_view("output/{$valtype}", $options);
-
+
echo "</p>";
}
}
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 @@
<?php
/**
* Elgg groups plugin
- *
+ *
* @package ElggGroups
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
@@ -11,26 +11,27 @@
$owner = $vars['owner'];
$group = $vars['group'];
-
- if ($friends = get_entities_from_relationship('friend',$owner->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 @@
<?php
- /**
- * Group profile widget - this displays a users groups on their profile
- **/
-
- //the number of groups to display
+ /**
+ * Group profile widget - this displays a users groups on their profile
+ **/
+
+ //the number of groups to display
$number = (int) $vars['entity']->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 "<div class=\"groupmembershipwidget\">";
foreach($groups as $group){
@@ -26,17 +34,17 @@
"groups/icon", array(
'entity' => $group,
'size' => 'small',
- )
+ )
);
-
+
echo "<div class=\"contentWrapper\">" . $icon . " <div class='search_listing_info'><p><span>" . $group->name . "</span><br />";
echo $group->briefdescription . "</p></div><div class=\"clearfloat\"></div></div>";
-
+
}
echo "</div>";
- }
+ }
+
+// echo $groups;
- // echo $groups;
-
?> \ No newline at end of file