From 8423cda014c6aee9fb3a3f7ebe78bc0465e7355f Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 22 Jan 2011 20:33:28 +0000 Subject: finished the first pass on the pages plugin for using the new HTML/CSS git-svn-id: http://code.elgg.org/elgg/trunk@7904 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/pages/lib/pages.php | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'mod/pages/lib/pages.php') diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php index e3ed3c822..72aad2aed 100644 --- a/mod/pages/lib/pages.php +++ b/mod/pages/lib/pages.php @@ -41,6 +41,26 @@ function pages_prepare_form_vars($page = null, $parent_guid = 0) { return $values; } +/** + * Recurses the page tree and adds the breadcrumbs for all ancestors + * + * @param ElggObject $page Page entity + */ +function pages_prepare_parent_breadcrumbs($page) { + if ($page && $page->parent_guid) { + $parents = array(); + $parent = get_entity($page->parent_guid); + while ($parent) { + array_push($parents, $parent); + $parent = get_entity($parent->parent_guid); + } + while ($parents) { + $parent = array_pop($parents); + elgg_push_breadcrumb($parent->title, $parent->getURL()); + } + } +} + /** * Register the navigation menu * @@ -54,7 +74,7 @@ function pages_register_navigation_tree($container) { $top_pages = elgg_get_entities(array( 'type' => 'object', 'subtype' => 'page_top', - 'container_guid' => $container->getGUID, + 'container_guid' => $container->getGUID(), )); foreach ($top_pages as $page) { @@ -87,20 +107,3 @@ function pages_register_navigation_tree($container) { } } } - -/** - * Return the correct sidebar for a given entity - * - * @param ElggObject $entity - */ -function pages_get_entity_sidebar(ElggObject $entity, $fulltree = 0) { - $body = ""; - - $children = elgg_get_entities_from_metadata(array('metadata_names' => 'parent_guid', 'metadata_values' => $entity->guid, 'limit' => 9999)); - $body .= elgg_view('pages/sidebar/sidebarthis', array('entity' => $entity, - 'children' => $children, - 'fulltree' => $fulltree)); - //$body = elgg_view('pages/sidebar/wrapper', array('body' => $body)); - - return $body; -} -- cgit v1.2.3