aboutsummaryrefslogtreecommitdiff
path: root/mod/search/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-11 22:58:55 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-11 22:58:55 +0000
commit23594f5a78f4557b183d5cc2a045b684cf32cc74 (patch)
treed354462c702524775a48439dc66c7036e9ec2d7d /mod/search/start.php
parenta69015e09a9627c63be577d10c99143190648b7b (diff)
downloadelgg-23594f5a78f4557b183d5cc2a045b684cf32cc74.tar.gz
elgg-23594f5a78f4557b183d5cc2a045b684cf32cc74.tar.bz2
Pulling out entity views in search.
Adding dev documentation. git-svn-id: http://code.elgg.org/elgg/trunk@3795 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/start.php')
-rw-r--r--mod/search/start.php29
1 files changed, 11 insertions, 18 deletions
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;
}
}