]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Updated the the default search entity view to check for users and groups and properly...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 2 Mar 2010 15:30:06 +0000 (15:30 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 2 Mar 2010 15:30:06 +0000 (15:30 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3983 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/search/search_hooks.php
mod/search/views/default/search/entity.php

index b61f12339cccb45c8c5fe3b4b770d368ab70987a..cc70f43ea8fece03cf3eac1197d220c5f4bde31e 100644 (file)
@@ -106,6 +106,8 @@ function search_groups_hook($hook, $type, $value, $params) {
 /**
  * Return default results for searches on users.
  *
+ * @todo add profile field MD searching
+ *
  * @param unknown_type $hook
  * @param unknown_type $type
  * @param unknown_type $value
index 06dd54f39811c65e574035343af4f5cefc6378e8..92f6aa41d17052e8fb5e8313ec1e7c1e0c379a82 100644 (file)
 
 $entity = $vars['entity'];
 
-if ($owner = $entity->getOwnerEntity()) {
-       $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small'));
-} elseif ($entity instanceof ElggUser) {
+// 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' => 'small'));
+} elseif ($owner = $entity->getOwnerEntity()) {
+       $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small'));
 } else {
-       $icon = '';
+       // 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' => 'small',
+       ));
 }
 
 $title = $entity->getVolatileData('search_matched_title');