aboutsummaryrefslogtreecommitdiff
path: root/views/default/photos/tagging/tag.php
blob: 93ea1621898121ea4a8c1d9f052559a5057dfd4a (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
<?php
/**
 * Photo tag view
 *
 * @uses $vars['tag'] Tag object
 *
 * @author Cash Costello
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
 */

$coords = json_decode('{' . $vars['tag']->coords . '}');

$attributes = elgg_format_attributes(array(
	'class' => 'tidypics-tag',
	'data-x1' => $coords->x1,
	'data-y1' => $coords->y1,
	'data-width' => $coords->width,
	'data-height' => $coords->height,
));

if ($vars['tag']->type == 'user') {
	$user = get_entity($vars['tag']->value);
	$label = elgg_view('output/url', array(
		'text' => $user->name,
		'href' => $user->getURL(),
	));
} else {
	$label = $vars['tag']->value;
}

echo <<<HTML
<div class="tidypics-tag-wrapper">
	<div $attributes></div>
	<div class="elgg-module-popup tidypics-tag-label">$label</div>
</div>
HTML;