aboutsummaryrefslogtreecommitdiff
path: root/views/default/layout/objects/gallery.php
blob: 4135de9dfec53fb437bd75ee2f87c6c1eea5ff39 (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
67
68
69
70
71
72
73
74
75
<?php
/**
 * Gallery view
 *
 * @uses $vars['items']
 *
 * @todo not complete - number of columns
 */

$items = $vars['items'];
if (!is_array($items) && sizeof($items) == 0) {
	return true;
}

elgg_push_context('gallery');

$offset = $vars['offset'];
$limit = $vars['limit'];
$count = $vars['count'];
$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');

$num_columns = 4;


if ($pagination && $count) {
	$nav .= elgg_view('navigation/pagination', array(
		'offset' => $offset,
		'count' => $count,
		'limit' => $limit,
		'offset_key' => $offset_key,
	));
}

if ($position == 'before' || $position == 'both') {
	echo $nav;
}

?>
<table class="elgg-gallery">
<?php

$col = 0;
foreach ($items as $item) {
	if ($col == 0) {
		echo '<tr>';
	}
	$col++;

	echo '<td>';
	echo elgg_view_list_item($item, $full_view, $vars);
	echo "</td>";

	if ($col == $num_columns) {
		echo '</tr>';
		$col = 0;
	}
}

if ($col > 0) {
	echo '</tr>';
}

?>

</table>

<?php
if ($position == 'after' || $position == 'both') {
	echo $nav;
}

elgg_pop_context();