From 73a5af81b7be538ce318d708d19154dfc5c62b23 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 14 Jan 2011 02:37:45 +0000 Subject: using new menu system and page layouts in search git-svn-id: http://code.elgg.org/elgg/trunk@7883 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/search/index.php | 21 ++++++++++++--------- mod/search/views/default/search/layout.php | 2 +- mod/search/views/default/search/no_results.php | 6 ++++++ 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 mod/search/views/default/search/no_results.php (limited to 'mod') diff --git a/mod/search/index.php b/mod/search/index.php index 82182dd75..8662283e4 100644 --- a/mod/search/index.php +++ b/mod/search/index.php @@ -66,7 +66,7 @@ $params = array( $types = get_registered_entity_types(); $custom_types = elgg_trigger_plugin_hook('search_types', 'get_types', $params, array()); -// add submenu items for all and native types +// add sidebar items for all and native types // @todo should these maintain any existing type / subtype filters or reset? $data = htmlspecialchars(http_build_query(array( 'q' => $query, @@ -77,7 +77,8 @@ $data = htmlspecialchars(http_build_query(array( //'friends' => $friends ))); $url = elgg_get_site_url()."pg/search/?$data"; -add_submenu_item(elgg_echo('all'), $url); +$menu_item = new ElggMenuItem('all', elgg_echo('all'), $url); +elgg_register_menu_item('page', $menu_item); foreach ($types as $type => $subtypes) { // @todo when using index table, can include result counts on each of these. @@ -95,8 +96,8 @@ foreach ($types as $type => $subtypes) { ))); $url = elgg_get_site_url()."pg/search/?$data"; - - add_submenu_item(elgg_echo($label), $url); + $menu_item = new ElggMenuItem($label, elgg_echo($label), $url); + elgg_register_menu_item('page', $menu_item); } } else { $label = "item:$type"; @@ -111,11 +112,12 @@ foreach ($types as $type => $subtypes) { $url = elgg_get_site_url()."pg/search/?$data"; - add_submenu_item(elgg_echo($label), $url); + $menu_item = new ElggMenuItem($label, elgg_echo($label), $url); + elgg_register_menu_item('page', $menu_item); } } -// add submenu for custom searches +// add sidebar for custom searches foreach ($custom_types as $type) { $label = "search_types:$type"; @@ -130,7 +132,8 @@ foreach ($custom_types as $type) { $url = elgg_get_site_url()."pg/search/?$data"; - add_submenu_item(elgg_echo($label), $url); + $menu_item = new ElggMenuItem($label, elgg_echo($label), $url); + elgg_register_menu_item('page', $menu_item); } @@ -138,7 +141,7 @@ foreach ($custom_types as $type) { if (!$query) { $body = elgg_view_title(elgg_echo('search:search_error')); $body .= elgg_echo('search:no_query'); - $layout = elgg_view_layout('one_column_with_sidebar', array('content' => $body)); + $layout = elgg_view_layout('one_sidebar', array('content' => $body)); echo elgg_view_page($title, $layout); return; @@ -246,7 +249,7 @@ $highlighted_query = search_highlight_words($searched_words, $query); $body = elgg_view_title(elgg_echo('search:results', array("\"$highlighted_query\""))); if (!$results_html) { - $body .= elgg_view('page/elements/contentwrapper', array('body' => elgg_echo('search:no_results'))); + $body .= elgg_view('search/no_results'); } else { $body .= $results_html; } diff --git a/mod/search/views/default/search/layout.php b/mod/search/views/default/search/layout.php index 82f191e8c..6882f252d 100644 --- a/mod/search/views/default/search/layout.php +++ b/mod/search/views/default/search/layout.php @@ -6,4 +6,4 @@ * @subpackage Core */ -echo elgg_view_layout('one_column_with_sidebar', array('content' => $vars['body'])); \ No newline at end of file +echo elgg_view_layout('one_sidebar', array('content' => $vars['body'])); \ No newline at end of file diff --git a/mod/search/views/default/search/no_results.php b/mod/search/views/default/search/no_results.php new file mode 100644 index 000000000..74b5b2cfa --- /dev/null +++ b/mod/search/views/default/search/no_results.php @@ -0,0 +1,6 @@ +