From 5041c6c48153453ed597206d08eeff37cf20e676 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 14:46:48 -0300 Subject: Squashed 'mod/cool_theme/' content from commit a26f7df git-subtree-dir: mod/cool_theme git-subtree-split: a26f7df43a266f7d1ff04847da330d15f6041e9b --- views/default/search/entity.php | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 views/default/search/entity.php (limited to 'views/default/search/entity.php') diff --git a/views/default/search/entity.php b/views/default/search/entity.php new file mode 100644 index 000000000..287ce4512 --- /dev/null +++ b/views/default/search/entity.php @@ -0,0 +1,57 @@ +getURL()) + * - search_time (defaults to entity->time_updated or entity->time_created) + * + * @uses $vars['entity'] Entity returned in a search + */ + +$entity = $vars['entity']; + +$icon = $entity->getVolatileData('search_icon'); +if (!$icon) { + // 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_entity_icon($entity, 'small'); + } elseif ($owner = $entity->getOwnerEntity()) { + $icon = elgg_view_entity_icon($owner, 'small'); + } 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_entity($entity, 'small'); + } +} + +$title = $entity->getVolatileData('search_matched_title'); +$description = $entity->getVolatileData('search_matched_description'); +$extra_info = $entity->getVolatileData('search_matched_extra'); +$url = $entity->getVolatileData('search_url'); + +if (!$url) { + $url = $entity->getURL(); +} + +$title = "$title"; +$time = $entity->getVolatileData('search_time'); +if (!$time) { + $tc = $entity->time_created; + $tu = $entity->time_updated; + $time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc); +} + +$body = "

$title

$description"; +if ($extra_info) { + $body .= "

$extra_info

"; +} +$body .= "

$time

"; + +echo elgg_view_image_block($icon, $body); -- cgit v1.2.3