blob: 23a6a44e8497b676c46221c21f63089e478d7d76 (
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
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
/**
* Elgg search listing
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*/
?>
<div class="search_listing">
<?php
$entities = $vars['entities'];
$count = $vars['count'] - count($vars['entities']);
if (!is_array($vars['entities']) || !count($vars['entities'])) {
return FALSE;
}
$title_str = elgg_echo("item:{$vars['params']['type']}:{$vars['params']['subtype']}");
$body = elgg_view_title($title_str);
$query = htmlspecialchars(http_build_query(
array(
'q' => $vars['params']['query'],
'type' => $vars['params']['type'],
'limit' => get_input('limit', 10),
'offset' => get_input('offset', 0),
'subtype' => $vars['params']['subtype']
)
));
$url = "{$vars['url']}pg/search?$query";
$more = "<a href=\"$url\">+$count more $title_str</a>";
echo elgg_view('page_elements/contentwrapper', array('body' => $body));
foreach ($entities as $entity) {
if ($owner = $entity->getOwnerEntity()) {
$owner_icon = $owner->getIcon('tiny');
$icon = "<img src=\"$owner_icon\" />";
} else {
$icon = '';
}
$title = $entity->getVolatileData('search_matched_title');
$description = $entity->getVolatileData('search_matched_description');
$url = $entity->getURL();
$title = "<a href=\"$url\">$title</a>";
$tc = $entity->time_created;
$tu = $entity->time_updated;
$time = friendly_time(($tu > $tc) ? $tu : $tc);
echo <<<___END
<span class="searchListing">
<h3 class="searchTitle">$title</h3>
<span class="searchDetails">
<span class="searchDescription">$description</span><br />
$icon $time - $more</a>
</span>
</span>
___END;
}
?>
</div>
|