aboutsummaryrefslogtreecommitdiff
path: root/views/default/river/object/tidypics_batch/create.php
blob: 1dfce69253b4f9b32c879c14554d1a74eb3381e7 (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
<?php
/**
 * Batch river view
 */

$batch = $vars['item']->getObjectEntity();

// Get images related to this batch
$images = elgg_get_entities_from_relationship(array(
	'relationship' => 'belongs_to_batch',
	'relationship_guid' => $batch->getGUID(),
	'inverse_relationship' => true,
	'type' => 'object',
	'subtype' => 'image',
	'offset' => 0,
));

$album = $batch->getContainerEntity();
$album_link = elgg_view('output/url', array(
	'href' => $album->getURL(),
	'text' => $album->getTitle(),
	'is_trusted' => true,
));

$subject = $vars['item']->getSubjectEntity();
$subject_link = elgg_view('output/url', array(
	'href' => $subject->getURL(),
	'text' => $subject->name,
	'class' => 'elgg-river-subject',
	'is_trusted' => true,
));

if (count($images)) {
	$attachments = '<ul class="tidypics-river-list">';
	foreach($images as $image) {
		$attachments .= '<li class="tidypics-photo-item">';
		$attachments .= elgg_view('output/img', array(
			'src' => $image->getSrcUrl('thumb'),
			'class' => 'elgg-photo',
		));
		$attachments .= '</li>';
	}
	$attachments .= '</ul>';
}

echo elgg_view('river/elements/layout', array(
	'item' => $vars['item'],
	'attachments' => $attachments,
	'summary' => elgg_echo('image:river:created:multiple', array($subject_link, count($images), $album_link)),
));