aboutsummaryrefslogtreecommitdiff
path: root/mod/groups/views/default/group/default.php
blob: d025a894bb3eaa44ad22fefde6c5b11a1904f8ee (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
55
56
57
58
59
60
61
62
63
64
65
66
<?php 
/**
 * Group entity view
 * 
 * @package ElggGroups
 */

$group = $vars['entity'];

$icon = elgg_view_entity_icon($group, 'tiny');

//get the membership type
$membership = $group->membership;
if ($membership == ACCESS_PUBLIC) {
	$mem = elgg_echo("groups:open");
} else {
	$mem = elgg_echo("groups:closed");
}

// number of members
$num_members = get_group_members($group->guid, 10, 0, 0, true);
$members_string = elgg_echo('groups:member');

$metadata = "<ul class=\"elgg-list-metadata\"><li>$mem</li>";
$metadata .= "<li>$num_members $members_string</li>";

// feature link
if (isadminloggedin()) {
	if ($group->featured_group == "yes") {
		$url = "action/groups/featured?group_guid={$group->guid}&action_type=unfeature";
		$wording = elgg_echo("groups:makeunfeatured");
	} else {
		$url = "action/groups/featured?group_guid={$group->guid}&action_type=feature";
		$wording = elgg_echo("groups:makefeatured");
	}
	$feature_link = elgg_view('output/url', array(
		'href' => $url,
		'text' => $wording,
		'is_action' => true,
	));
	$metadata .= "<li>$feature_link</li>";
}

$metadata .= elgg_view("entity/metadata", array('entity' => $group));

$metadata .= "</ul>";

if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
	$metadata = '';
}


if ($vars['full']) {
	echo elgg_view("groups/profile/profile_block", $vars);
} else {
	// brief view

	$params = array(
		'entity' => $group,
		'metadata' => $metadata,
		'subtitle' => $group->briefdescription,
	);
	$list_body = elgg_view('layout/objects/list/body', $params);

	echo elgg_view_image_block($icon, $list_body);
}