aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views/default/widgets/a_users_groups/view.php
blob: 687ba7251fd8b9da7586d7a0e9df40c3300c2dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

/** 
 *  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
$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) {

	echo "<div class=\"groupmembershipwidget\">";

	foreach ($groups as $group) {
		$icon = elgg_view(
				"groups/icon", array(
				'entity' => $group,
				'size' => 'small',
				)
		);

		$group_link = $group->getURL();

		echo <<<___END

<div class="contentWrapper">
	$icon
	<div class="search_listing_info">
		<p>
			<span><a href="$group_link">$group->name</a></span><br />
			$group->briefdescription
		</p>
	</div>
	<div class="clearfloat"></div>
</div>
___END;

	}
	echo "</div>";
}