From fb48ea92032d56347d75baf77adc4a410bd38b31 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 1 Aug 2008 10:49:42 +0000 Subject: Introducing the consistent owner block git-svn-id: https://code.elgg.org/elgg/trunk@1644 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 3 +- entities/index.php | 8 ++++- .../canvas/layouts/two_column_left_sidebar.php | 8 +++-- views/default/page_elements/owner_block.php | 40 ++++++++++++++++++++++ 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 views/default/page_elements/owner_block.php diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index abfa28b35..d591ca00b 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -559,9 +559,10 @@ * Returns a view for the page title * * @param string $title The page title + * @param string $submenu Should a submenu be displayed? (default false, use not recommended) * @return string The HTML (etc) */ - function elgg_view_title($title, $submenu = true) { + function elgg_view_title($title, $submenu = false) { $title = elgg_view('page_elements/title', array('title' => $title, 'submenu' => $submenu)); diff --git a/entities/index.php b/entities/index.php index 96da8b790..3e573b338 100644 --- a/entities/index.php +++ b/entities/index.php @@ -27,10 +27,16 @@ // Get the entity, if possible if ($entity = get_entity($guid)) { + if ($entity->container_guid) { + set_page_owner($entity->container_guid); + } else { + set_page_owner($entity->owner_guid); + } + // Set the body to be the full view of the entity, and the title to be its title $area2 = elgg_view_entity($entity,true); if ($shell) - $body = elgg_view_layout('two_column_left_sidebar',$area1, $area2); + $body = elgg_view_layout('two_column_left_sidebar', '', $area1 . $area2); // Otherwise? } else { diff --git a/views/default/canvas/layouts/two_column_left_sidebar.php b/views/default/canvas/layouts/two_column_left_sidebar.php index 17740cd36..9894d51ad 100644 --- a/views/default/canvas/layouts/two_column_left_sidebar.php +++ b/views/default/canvas/layouts/two_column_left_sidebar.php @@ -15,9 +15,11 @@
-
- -
+ $vars['area1'])); + + ?> diff --git a/views/default/page_elements/owner_block.php b/views/default/page_elements/owner_block.php new file mode 100644 index 000000000..6bc0b86a8 --- /dev/null +++ b/views/default/page_elements/owner_block.php @@ -0,0 +1,40 @@ +"; + // Is there a page owner? + if ($owner = page_owner_entity()) { + $icon = elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny')); + if ($owner instanceof ElggUser || $owner instanceof ElggGroup) { + $info = $owner->name; + } + $display = "
" . $icon . "
"; + $display .= "
" . $info . "
"; + } + echo $display; + + // Have we been asked to inject any content? If so, display it + if (isset($vars['content'])) + echo $vars['content']; + + // Initialise the submenu + $submenu = get_submenu(); // elgg_view('canvas_header/submenu'); + if (!empty($submenu)) $submenu = ""; + if (!empty($submenu)) + echo "
" . $submenu . "
"; // plugins can extend this to add menu options + + echo "
"; + +?> \ No newline at end of file -- cgit v1.2.3