aboutsummaryrefslogtreecommitdiff
path: root/views/default/graphics/icon.php
blob: 6b92a510db3c6db19d1def04ffcc876b274be918 (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
<?php
/**
 * Generic icon view.
 *
 * @package Elgg
 * @subpackage Core
 * @author Curverider Ltd
 * @link http://elgg.org/
 *
 * @uses $vars['entity'] The entity the icon represents - uses getIcon() method
 * @uses $vars['js'] Any JavaScript to add to img tag
 * @uses $vars['size'] topbar, tiny, small, medium (default), large, master
 * @uses $vars['link'] Optional link for the image
 * @uses $vars['align'] Align attribute of the img tag
 */

$entity = $vars['entity'];

$sizes = array('small','medium','large','tiny','master','topbar');
// Get size
if (!in_array($vars['size'], $sizes)) {
	$vars['size'] = "medium";
}

// Get any align and js
if (!empty($vars['align'])) {
	$align = " align=\"{$vars['align']}\" ";
} else {
	$align = "";
}


?>
<div class="icon">
<?php
if ($vars['link']) {
	?><a href="<?php echo $vars['link'] ?>"><?php
}
?>
<img src="<?php echo $entity->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> <?php echo $vars['js']; ?> />
<?php
if ($vars['link']) {
	?></a><?php
}
?>
</div>