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
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<?php
/**
* View a list of items
*
* @package Elgg
*
* @uses $vars['items'] Array of ElggEntity or ElggAnnotation objects
* @uses $vars['offset'] Index of the first list item in complete list
* @uses $vars['limit'] Number of items per page
* @uses $vars['count'] Number of items in the complete list
* @uses $vars['base_url'] Base URL of list (optional)
* @uses $vars['pagination'] Show pagination? (default: true)
* @uses $vars['position'] Position of the pagination: before, after, or both
* @uses $vars['full_view'] Show the full view of the items (default: false)
* @uses $vars['list_class'] Additional CSS class for the <ul> element
* @uses $vars['item_class'] Additional CSS class for the <li> elements
*/
$items = $vars['items'];
$offset = $vars['offset'];
$limit = $vars['limit'];
$count = $vars['count'];
$base_url = $vars['base_url'];
$pagination = elgg_get_array_value('pagination', $vars, true);
$full_view = elgg_get_array_value('full_view', $vars, false);
$offset_key = elgg_get_array_value('offset_key', $vars, 'offset');
$position = elgg_get_array_value('position', $vars, 'after');
$list_class = 'elgg-list';
if (isset($vars['list_class'])) {
$list_class = "{$vars['list_class']} $list_class";
}
if (elgg_in_context('gallery')) {
$list_class = "$list_class elgg-gallery";
}
$item_class = 'elgg-list-item';
if (isset($vars['item_class'])) {
$item_class = "{$vars['item_class']} $item_class";
}
$html = "";
$nav = "";
if ($pagination && $count) {
$nav .= elgg_view('navigation/pagination', array(
'baseurl' => $base_url,
'offset' => $offset,
'count' => $count,
'limit' => $limit,
'offset_key' => $offset_key,
));
}
if (is_array($items) && count($items) > 0) {
$html .= "<ul class=\"$list_class\">";
foreach ($items as $item) {
if (elgg_instanceof($item)) {
$id = "elgg-{$item->getType()}-{$item->getGUID()}";
} else {
$id = "item-{$item->getType()}-{$item->id}";
}
$html .= "<li id=\"$id\" class=\"$item_class\">";
$html .= elgg_view_list_item($item, $full_view, $vars);
$html .= '</li>';
}
$html .= '</ul>';
}
if ($position == 'before' || $position == 'both') {
$html = $nav . $html;
}
if ($position == 'after' || $position == 'both') {
$html .= $nav;
}
echo $html;
|