aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views/default/widgets/a_users_groups/view.php
blob: 462ac419c94ddbd70de9c8774cb709ab77b081f7 (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
52
53
54
<?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 = elgg_get_entities_from_relationship(array(
	'relationship' => 'member',
	'relationship_guid' => $owner,
	'types' => 'group',
	'limit' => $number,
));


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="clearfix"></div>
</div>
___END;

	}
	echo "</div>";
}