aboutsummaryrefslogtreecommitdiff
path: root/views/default/annotation/likes.php
blob: 748d0b60179b42699afbb8f373b64caf05caee6c (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
<?php
/**
 * Elgg show the users who liked the object
 *
 * @uses $vars['annotation']
 */

if (!isset($vars['annotation'])) {
	return true;
}

$like = $vars['annotation'];

$user = $like->getOwnerEntity();
if (!$user) {
	return true;
}

$user_icon = elgg_view("profile/icon", array('entity' => $user, 'size' => 'tiny'));
$user_link = elgg_view('output/url', array(
	'href' => $user->getURL(),
	'text' => $user->name,
));

$likes_string = elgg_echo('likes:this');

$friendlytime = elgg_view_friendly_time($like->time_created);

if ($like->canEdit()) {
	$delete_button = elgg_view("output/confirmlink",array(
						'href' => "action/likes/delete?annotation_id={$like->id}",
						'text' => elgg_echo('delete'),
						'confirm' => elgg_echo('deleteconfirm')
					));
	$delete_button = "<span class=\"delete-button\">$delete_button</span>";
}

$body = <<<HTML
<p class="mbn">
	$delete_button
	$user_link $likes_string
	<span class="elgg-subtext">
		$friendlytime
	</span>
</p>
HTML;

echo elgg_view_image_block($user_icon, $body);