diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 00:55:39 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-08 00:55:39 +0000 |
commit | ca5c2911327cdbffb5bee1d44d1f673025fcdbce (patch) | |
tree | 364f26a2ed327013dbfd1e018ba93adab26c4182 /views/default/layout | |
parent | ec1e46e01818b8226d651dd589f373d75f9f8411 (diff) | |
download | elgg-ca5c2911327cdbffb5bee1d44d1f673025fcdbce.tar.gz elgg-ca5c2911327cdbffb5bee1d44d1f673025fcdbce.tar.bz2 |
moved a few elements to layout from page
git-svn-id: http://code.elgg.org/elgg/trunk@7556 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/layout')
-rw-r--r-- | views/default/layout/elements/owner_block.php | 77 | ||||
-rw-r--r-- | views/default/layout/elements/sidebar.php | 27 | ||||
-rw-r--r-- | views/default/layout/elements/title.php | 22 | ||||
-rw-r--r-- | views/default/layout/shells/administration.php | 2 | ||||
-rw-r--r-- | views/default/layout/shells/one_column_with_sidebar.php | 2 | ||||
-rw-r--r-- | views/default/layout/shells/one_sidebar.php | 2 | ||||
-rw-r--r-- | views/default/layout/shells/two_sidebar.php | 4 |
7 files changed, 131 insertions, 5 deletions
diff --git a/views/default/layout/elements/owner_block.php b/views/default/layout/elements/owner_block.php new file mode 100644 index 000000000..66fc180dd --- /dev/null +++ b/views/default/layout/elements/owner_block.php @@ -0,0 +1,77 @@ +<?php +/** + * Elgg owner block + * Displays page ownership information + * + * @package Elgg + * @subpackage Core + * + */ + +$contents = ""; + +// Are there feeds to display? +global $autofeed; +if (isset($autofeed) && $autofeed == true) { + $url = full_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + $url = elgg_format_url($url); + $label = elgg_echo('feed:rss'); + $contents .= <<<END + <div class="rss-link clearfix"><a href="{$url}" rel="nofollow" title="{$label}">{$label}</a></div> +END; +} + +if(is_plugin_enabled('profile')) { + // Is there a page owner? + $owner = elgg_get_page_owner(); + if ($owner instanceof ElggGroup || + ($owner instanceof ElggUser && $owner->getGUID() != get_loggedin_userid()) + ) { + $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny')); + $owner_url = $owner->getURL(); + $display = "<div class='owner_block_icon'>$icon</div>"; + $display .= '<div class="owner_block_contents clearfix">'; + $display .= "<h3><a href=\"$owner_url\">{$owner->name}</a></h3>"; + + if ($owner->briefdescription) { + $display .= "<p class=\"profile_info briefdescription\">{$owner->briefdescription}</p>"; + } + + $location = elgg_view('output/tags', array('value' => $owner->location)); + $display .= "<p class=\"profile_info location\">$location</p>"; + + $display .= '</div>'; + + // Trigger owner block menu + $params = array('owner' => $owner); + $links = elgg_trigger_plugin_hook('profile_menu', 'profile', $params, array()); + if (is_array($links) && !empty($links)) { + // sort the links by name + usort($links, create_function( + '$a, $b', + 'return strnatcasecmp($a[\'text\'], $b[\'text\']);' + )); + + $display .= '<div class="owners_content_links"><ul>'; + foreach ($links as $link) { + $display .= "<li><a href=\"{$link['href']}\">{$link['text']}</a></li>"; + } + $display .= '</ul></div>'; + } + + // Allow plugins to extend the owner block contents + $display .= elgg_view('owner_block/profile_extend'); + + $contents .= "<div id='owner_block' class='clearfix'>$display</div>"; + } +} + +$contents .= elgg_view('owner_block/extend'); + + +echo $contents; diff --git a/views/default/layout/elements/sidebar.php b/views/default/layout/elements/sidebar.php new file mode 100644 index 000000000..d1323f2cd --- /dev/null +++ b/views/default/layout/elements/sidebar.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg sidebar contents + * + * @uses $vars['sidebar'] Optional content that is displayed at the bottom of sidebar + */ + +echo elgg_view('layout/elements/owner_block'); + +echo elgg_view('navigation/sidebar_menu'); + +// optional 'sidebar' parameter +if (isset($vars['sidebar'])) { + echo $vars['sidebar']; +} + +// @todo deprecated so remove in Elgg 2.0 +// optional second parameter of elgg_view_layout +if (isset($vars['area2'])) { + echo $vars['area2']; +} + +// @todo deprecated so remove in Elgg 2.0 +// optional third parameter of elgg_view_layout +if (isset($vars['area3'])) { + echo $vars['area3']; +}
\ No newline at end of file diff --git a/views/default/layout/elements/title.php b/views/default/layout/elements/title.php new file mode 100644 index 000000000..c5eeb9e0e --- /dev/null +++ b/views/default/layout/elements/title.php @@ -0,0 +1,22 @@ +<?php +/** + * Elgg title element + * @uses $vars['title'] The page title + */ + +$page_owner = elgg_get_page_owner_guid(); +$page_owner_entity = get_entity($page_owner); + +$display = "<h2>" . $vars['title'] . "</h2>"; + +$submenu = elgg_get_submenu(); +if (!empty($submenu)) { + $submenu = "<ul class='submenu extended'>" . $submenu . "</ul>"; +} + +if (!empty($submenu) && $vars['submenu'] == true) { + // plugins can extend this to add menu options + $display .= $submenu; +} + +echo $display;
\ No newline at end of file diff --git a/views/default/layout/shells/administration.php b/views/default/layout/shells/administration.php index f7ed84935..f9f5e3caa 100644 --- a/views/default/layout/shells/administration.php +++ b/views/default/layout/shells/administration.php @@ -29,7 +29,7 @@ </div> <div id="elgg-sidebar" class="clearfix"> <?php - echo elgg_view('page_elements/sidebar', $vars); + echo elgg_view('layout/elements/sidebar', $vars); ?> </div> </div> diff --git a/views/default/layout/shells/one_column_with_sidebar.php b/views/default/layout/shells/one_column_with_sidebar.php index e408c6c1c..6698b7372 100644 --- a/views/default/layout/shells/one_column_with_sidebar.php +++ b/views/default/layout/shells/one_column_with_sidebar.php @@ -13,7 +13,7 @@ <div class="elgg-layout-sidebar elgg-center elgg-width-classic clearfix"> <div class="elgg-sidebar elgg-aside"> <?php - echo elgg_view('page_elements/sidebar', $vars); + echo elgg_view('layout/elements/sidebar', $vars); ?> </div> diff --git a/views/default/layout/shells/one_sidebar.php b/views/default/layout/shells/one_sidebar.php index d0bb3879f..2e78b0de6 100644 --- a/views/default/layout/shells/one_sidebar.php +++ b/views/default/layout/shells/one_sidebar.php @@ -13,7 +13,7 @@ <div class="elgg-layout-sidebar elgg-center elgg-width-classic clearfix"> <div class="elgg-sidebar elgg-aside"> <?php - echo elgg_view('page_elements/sidebar', $vars); + echo elgg_view('layout/elements/sidebar', $vars); ?> </div> diff --git a/views/default/layout/shells/two_sidebar.php b/views/default/layout/shells/two_sidebar.php index 26fb64920..d0a6825c9 100644 --- a/views/default/layout/shells/two_sidebar.php +++ b/views/default/layout/shells/two_sidebar.php @@ -14,7 +14,7 @@ <div class="elgg-layout-two-sidebar elgg-center elgg-width-classic clearfix"> <div class="elgg-sidebar elgg-aside"> <?php - echo elgg_view('page_elements/sidebar', $vars); + echo elgg_view('layout/elements/sidebar', $vars); ?> </div> <div class="elgg-sidebar-alt elgg-aside"> @@ -24,7 +24,7 @@ $params = array( 'sidebar' => elgg_view('layout_elements/module', array('title' => 'Testing', 'body' => 'Hello, world!')) ); - echo elgg_view('page_elements/sidebar', $params); + echo elgg_view('layout/elements/sidebar', $params); ?> </div> |