blob: 2b08384d5ddb342f53cc413a6b0ba80d176f059c (
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
|
<?php
/**
* Elgg search entity
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
$entity = $vars['entity'];
// display the entity's owner by default if available.
// @todo allow an option to switch to displaying the entity's icon instead.
$type = $entity->getType();
if ($type == 'user' || $type == 'group') {
$icon = elgg_view('profile/icon', array('entity' => $entity, 'size' => 'tiny'));
} elseif ($owner = $entity->getOwnerEntity()) {
$icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny'));
} else {
// display a generic icon if no owner, though there will probably be
// other problems if the owner can't be found.
$icon = elgg_view(
'graphics/icon', array(
'entity' => $entity,
'size' => 'tiny',
));
}
$title = $entity->getVolatileData('search_matched_title');
$description = $entity->getVolatileData('search_matched_description');
$extra_info = $entity->getVolatileData('search_matched_extra');
$url = $entity->getURL();
if (!$title) {
$title = elgg_echo('untitled');
}
$title = "<a href=\"$url\">$title</a>";
$tc = $entity->time_created;
$tu = $entity->time_updated;
$time = friendly_time(($tu > $tc) ? $tu : $tc);
echo <<<___END
<div class="search_listing clearfloat">
<div class="search_listing_icon">$icon</div>
<div class="search_listing_info">
<p class="entity_title">$title</p>$description
<p class="entity_subtext">$time $extra_info</p>
</div>
</div>
___END;
// php bug. must have close tag after heredocs
?>
|