1 | <?php |
||
2 | |||
3 | /** |
||
4 | * List members of a collection |
||
5 | * |
||
6 | * @uses $vars['collection'] Access collection |
||
7 | */ |
||
8 | $collection = elgg_extract('collection', $vars); |
||
9 | if (!$collection instanceof ElggAccessCollection) { |
||
10 | return; |
||
11 | } |
||
12 | |||
13 | $offset_key = "col_{$collection->id}"; |
||
14 | $offset = get_input($offset_key, 0); |
||
15 | $limit = max(20, elgg_get_config('default_limit')); |
||
16 | |||
17 | $members = $collection->getMembers([ |
||
18 | 'limit' => $limit, |
||
19 | 'offset' => $offset, |
||
20 | ]); |
||
21 | |||
22 | if ($members) { |
||
23 | foreach ($members as $member) { |
||
24 | // We set volatile data, so that we can use the default user listing |
||
25 | // and modify the entity menu |
||
26 | $member->setVolatileData('friends:collection', $collection); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | $count = $collection->getMembers([ |
||
31 | 'count' => true, |
||
32 | ]); |
||
33 | |||
34 | echo elgg_view_entity_list($members, [ |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
35 | 'count' => $count, |
||
36 | 'limit' => $limit, |
||
37 | 'offset' => $offset, |
||
38 | 'offset_key' => $offset_key, |
||
39 | 'collection' => $collection, |
||
40 | 'no_results' => elgg_echo('friends:collection:members:no_results'), |
||
41 | ]); |
||
42 |