From 1db7dba6a8a12b9066fb01f56054c0c637242076 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 7 Feb 2011 02:43:24 +0000 Subject: Fixes 2354 Using list instead of listing for search now git-svn-id: http://code.elgg.org/elgg/trunk@8058 36083f99-b078-4883-b0ff-0f9b5a30f544 --- languages/en.php | 2 +- mod/search/index.php | 6 +- mod/search/start.php | 8 +- mod/search/views/default/search/list.php | 116 ++++++++++++++++++++++++++++ mod/search/views/default/search/listing.php | 116 ---------------------------- 5 files changed, 124 insertions(+), 124 deletions(-) create mode 100644 mod/search/views/default/search/list.php delete mode 100644 mod/search/views/default/search/listing.php diff --git a/languages/en.php b/languages/en.php index db0811b60..2dd61751e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -430,7 +430,7 @@ $english = array( 'next' => "Next", 'previous' => "Previous", - 'viewtype:change' => "Change listing type", + 'viewtype:change' => "Change list type", 'viewtype:list' => "List view", 'viewtype:gallery' => "Gallery", diff --git a/mod/search/index.php b/mod/search/index.php index db2aa5cc2..c51b0fe0d 100644 --- a/mod/search/index.php +++ b/mod/search/index.php @@ -187,7 +187,7 @@ if ($search_type == 'all' || $search_type == 'entities') { } if (is_array($results['entities']) && $results['count']) { - if ($view = search_get_search_view($current_params, 'listing')) { + if ($view = search_get_search_view($current_params, 'list')) { $results_html .= elgg_view($view, array( 'results' => $results, 'params' => $current_params, @@ -208,7 +208,7 @@ if ($search_type == 'all' || $search_type == 'entities') { } if (is_array($results['entities']) && $results['count']) { - if ($view = search_get_search_view($current_params, 'listing')) { + if ($view = search_get_search_view($current_params, 'list')) { $results_html .= elgg_view($view, array( 'results' => $results, 'params' => $current_params, @@ -239,7 +239,7 @@ if ($search_type != 'entities' || $search_type == 'all') { } if (is_array($results['entities']) && $results['count']) { - if ($view = search_get_search_view($current_params, 'listing')) { + if ($view = search_get_search_view($current_params, 'list')) { $results_html .= elgg_view($view, array( 'results' => $results, 'params' => $current_params, diff --git a/mod/search/start.php b/mod/search/start.php index 71473632c..4f57a64c5 100644 --- a/mod/search/start.php +++ b/mod/search/start.php @@ -326,12 +326,12 @@ function search_remove_ignored_words($query, $format = 'array') { * * @param array $results * @param array $params - * @param string $view_type = listing, entity or layout + * @param string $view_type = list, entity or layout * @return string */ function search_get_search_view($params, $view_type) { switch ($view_type) { - case 'listing': + case 'list': case 'entity': case 'layout': break; @@ -342,7 +342,7 @@ function search_get_search_view($params, $view_type) { $view_order = array(); - // check if there's a special search listing view for this type:subtype + // check if there's a special search list view for this type:subtype if (isset($params['type']) && $params['type'] && isset($params['subtype']) && $params['subtype']) { $view_order[] = "search/{$params['type']}/{$params['subtype']}/$view_type"; } @@ -357,7 +357,7 @@ function search_get_search_view($params, $view_type) { $view_order[] = "search/{$params['search_type']}/$view_type"; } - // finally default to a search listing default + // finally default to a search list default $view_order[] = "search/$view_type"; foreach ($view_order as $view) { diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php new file mode 100644 index 000000000..27916a363 --- /dev/null +++ b/mod/search/views/default/search/list.php @@ -0,0 +1,116 @@ + $vars['params']['query'], + 'entity_type' => $vars['params']['type'], + 'entity_subtype' => $vars['params']['subtype'], + 'limit' => get_input('limit', 10), + 'offset' => get_input('offset', 0), + 'search_type' => $vars['params']['search_type'], + //@todo include vars for sorting, order, and friend-only. + ) +); + +$url = elgg_get_site_url() . "pg/search?$query"; + +// get pagination +if (array_key_exists('pagination', $vars) && $vars['pagination']) { + $nav .= elgg_view('navigation/pagination',array( + 'baseurl' => $url, + 'offset' => $vars['params']['offset'], + 'count' => $vars['results']['count'], + 'limit' => $vars['params']['limit'], + )); +} else { + $nav = ''; +} + +// figure out what we're dealing with. +$type_str = NULL; + +if (array_key_exists('type', $vars['params']) && array_key_exists('subtype', $vars['params'])) { + $type_str_tmp = "item:{$vars['params']['type']}:{$vars['params']['subtype']}"; + $type_str_echoed = elgg_echo($type_str_tmp); + if ($type_str_echoed != $type_str_tmp) { + $type_str = $type_str_echoed; + } +} + +if (!$type_str && array_key_exists('type', $vars['params'])) { + $type_str = elgg_echo("item:{$vars['params']['type']}"); +} + +if (!$type_str) { + $type_str = elgg_echo('search:unknown_entity'); +} + +// allow overrides for titles +$search_type_str = elgg_echo("search_types:{$vars['params']['search_type']}"); +if (array_key_exists('search_type', $vars['params']) + && $search_type_str != "search_types:{$vars['params']['search_type']}") { + + $type_str = $search_type_str; +} + +// get pagination +if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { + $nav .= elgg_view('navigation/pagination',array( + 'baseurl' => $url, + 'offset' => $vars['params']['offset'], + 'count' => $vars['results']['count'], + 'limit' => $vars['params']['limit'], + )); +} else { + $nav = ''; +} + +// get any more links. +$more_check = $vars['results']['count'] - ($vars['params']['offset'] + $vars['params']['limit']); +$more = ($more_check > 0) ? $more_check : 0; + +if ($more) { + $title_key = ($more == 1) ? 'comment' : 'comments'; + $more_str = elgg_echo('search:more', array($count, $type_str)); + $more_link = "
$more_str
"; +} else { + $more_link = ''; +} + +$body = "
" . elgg_view_title($type_str) . "
"; + +foreach ($entities as $entity) { + if ($view = search_get_search_view($vars['params'], 'entity')) { + $body .= elgg_view($view, array( + 'entity' => $entity, + 'params' => $vars['params'], + 'results' => $vars['results'] + )); + } +} +echo $body; +echo $more_link; +echo $nav; diff --git a/mod/search/views/default/search/listing.php b/mod/search/views/default/search/listing.php deleted file mode 100644 index 27916a363..000000000 --- a/mod/search/views/default/search/listing.php +++ /dev/null @@ -1,116 +0,0 @@ - $vars['params']['query'], - 'entity_type' => $vars['params']['type'], - 'entity_subtype' => $vars['params']['subtype'], - 'limit' => get_input('limit', 10), - 'offset' => get_input('offset', 0), - 'search_type' => $vars['params']['search_type'], - //@todo include vars for sorting, order, and friend-only. - ) -); - -$url = elgg_get_site_url() . "pg/search?$query"; - -// get pagination -if (array_key_exists('pagination', $vars) && $vars['pagination']) { - $nav .= elgg_view('navigation/pagination',array( - 'baseurl' => $url, - 'offset' => $vars['params']['offset'], - 'count' => $vars['results']['count'], - 'limit' => $vars['params']['limit'], - )); -} else { - $nav = ''; -} - -// figure out what we're dealing with. -$type_str = NULL; - -if (array_key_exists('type', $vars['params']) && array_key_exists('subtype', $vars['params'])) { - $type_str_tmp = "item:{$vars['params']['type']}:{$vars['params']['subtype']}"; - $type_str_echoed = elgg_echo($type_str_tmp); - if ($type_str_echoed != $type_str_tmp) { - $type_str = $type_str_echoed; - } -} - -if (!$type_str && array_key_exists('type', $vars['params'])) { - $type_str = elgg_echo("item:{$vars['params']['type']}"); -} - -if (!$type_str) { - $type_str = elgg_echo('search:unknown_entity'); -} - -// allow overrides for titles -$search_type_str = elgg_echo("search_types:{$vars['params']['search_type']}"); -if (array_key_exists('search_type', $vars['params']) - && $search_type_str != "search_types:{$vars['params']['search_type']}") { - - $type_str = $search_type_str; -} - -// get pagination -if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { - $nav .= elgg_view('navigation/pagination',array( - 'baseurl' => $url, - 'offset' => $vars['params']['offset'], - 'count' => $vars['results']['count'], - 'limit' => $vars['params']['limit'], - )); -} else { - $nav = ''; -} - -// get any more links. -$more_check = $vars['results']['count'] - ($vars['params']['offset'] + $vars['params']['limit']); -$more = ($more_check > 0) ? $more_check : 0; - -if ($more) { - $title_key = ($more == 1) ? 'comment' : 'comments'; - $more_str = elgg_echo('search:more', array($count, $type_str)); - $more_link = "
$more_str
"; -} else { - $more_link = ''; -} - -$body = "
" . elgg_view_title($type_str) . "
"; - -foreach ($entities as $entity) { - if ($view = search_get_search_view($vars['params'], 'entity')) { - $body .= elgg_view($view, array( - 'entity' => $entity, - 'params' => $vars['params'], - 'results' => $vars['results'] - )); - } -} -echo $body; -echo $more_link; -echo $nav; -- cgit v1.2.3