aboutsummaryrefslogtreecommitdiff
path: root/mod/subgroups/views/default/groups/sidebar/subgroups.php
blob: 35ffbaef930c93678abbce9b54178effe86f4f8a (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
<?php
/**
 * Subgroups sidebar
 *
 * @package ElggSubgroups
 *
 * @uses $vars['entity'] Group entity
 * @uses $vars['limit']  The number of subgroups to display
 */

$owner = elgg_get_page_owner_entity();

if(!elgg_instanceof($owner, 'group')) {
	return false;
}

$limit = elgg_extract('limit', $vars, 10);

$all_link = elgg_view('output/url', array(
	'href' => 'subgroups/owner/' . $owner->guid,
	'text' => elgg_echo('subgroups:more'),
	'is_trusted' => true,
));

$params = array(
	'type' => 'group',
	'container_guid' => $owner->guid,
	'limit' => $limit,
	'types' => 'group',
	'list_type' => 'gallery',
	'gallery_class' => 'elgg-gallery-groups',
	'full_view' => false
);

$params['count'] = true;
if(elgg_get_entities($params) == 0) {
	return true;
}
$params['count'] = false;

$body = elgg_list_entities($params);
$body .= "<div class='center mts'>$all_link</div>";

echo elgg_view_module('aside', elgg_echo('subgroups'), $body);