From 23594f5a78f4557b183d5cc2a045b684cf32cc74 Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 11 Jan 2010 22:58:55 +0000 Subject: Pulling out entity views in search. Adding dev documentation. git-svn-id: http://code.elgg.org/elgg/trunk@3795 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/search/start.php | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'mod/search/start.php') diff --git a/mod/search/start.php b/mod/search/start.php index 92d5c65b6..c54072b91 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -316,48 +316,41 @@ function search_remove_ignored_words($query, $format = 'array') { /** - * Passes entities, count, and original params to the view functions for + * Passes results, and original params to the view functions for * search type. * - * @param array $entities - * @param int $count + * @param array $results * @param array $params + * @param string $view_type = listing || entity * @return string */ -function search_get_listing_html($entities, $count, $params) { - if (!is_array($entities) || !$count) { +function search_get_search_view($params, $view_type) { + if ($view_type != 'listing' && $view_type != 'entity') { return FALSE; } - $view_order = array(); - // check if there's a special search view for this type:subtype + // check if there's a special search listing view for this type:subtype if (isset($params['type']) && $params['type'] && isset($params['subtype']) && $params['subtype']) { - $view_order[] = "search/{$params['type']}/{$params['subtype']}/listing"; + $view_order[] = "search/{$params['type']}/{$params['subtype']}/$view_type"; } // also check for the default type if (isset($params['type']) && $params['type']) { - $view_order[] = "search/{$params['type']}/listing"; + $view_order[] = "search/{$params['type']}/$view_type"; } // check search types if (isset($params['search_type']) && $params['search_type']) { - $view_order[] = "search/{$params['search_type']}/listing"; + $view_order[] = "search/{$params['search_type']}/$view_type"; } // finally default to a search listing default - $view_order[] = "search/listing"; - - $vars = array( - 'entities' => $entities, - 'count' => $count, - 'params' => $params - ); + $view_order[] = "search/$view_type"; foreach ($view_order as $view) { if (elgg_view_exists($view)) { - return elgg_view($view, $vars); + return $view; } } -- cgit v1.2.3