aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-22 19:23:10 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-22 19:23:10 +0000
commit3fb6a43748aa2ad47a34b6170771f56bbb466d0e (patch)
treeea8d65ca5ded2ebf8256600fa8e0985ae524bc95 /views
parent96630c2f66d99e954ccc3d158e67b3a1e1fd539d (diff)
downloadelgg-3fb6a43748aa2ad47a34b6170771f56bbb466d0e.tar.gz
elgg-3fb6a43748aa2ad47a34b6170771f56bbb466d0e.tar.bz2
Allowing plugin authors to override the default tabs (filters) displayed on the content header.
git-svn-id: http://code.elgg.org/elgg/trunk@6542 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views')
-rw-r--r--views/default/page_elements/content_header.php85
1 files changed, 34 insertions, 51 deletions
diff --git a/views/default/page_elements/content_header.php b/views/default/page_elements/content_header.php
index 825d6a1ed..79e1ce279 100644
--- a/views/default/page_elements/content_header.php
+++ b/views/default/page_elements/content_header.php
@@ -25,58 +25,48 @@ $filter_context = $vars['context'];
// get the object type
$type = $vars['type'];
-// tons of empty strings.
-$mine_selected = $all_selected = $friend_selected =
-$new_button = $action_buttons = $filter_content = '';
+// create an empty string to start with
+$new_button = '';
-$all_title = elgg_echo('all');
-$mine_title = elgg_echo('mine');
-$friend_title = elgg_echo('friends');
+// generate a list of default tabs
+$default_tabs = array(
+ 'all' => array(
+ 'title' => elgg_echo('all'),
+ 'url' => (isset($vars['all_link'])) ? $vars['all_link'] : "{$vars['url']}mod/$type/all.php",
+ 'selected' => ($filter_context == 'everyone'),
+ ),
+ 'mine' => array(
+ 'title' => elgg_echo('mine'),
+ 'url' => (isset($vars['mine_link'])) ? $vars['mine_link'] : "{$vars['url']}pg/$type/$username",
+ 'selected' => ($filter_context == 'mine'),
+ ),
+ 'friend' => array(
+ 'title' => elgg_echo('friends'),
+ 'url' => (isset($vars['friend_link'])) ? $vars['friend_link'] : "{$vars['url']}pg/$type/$username/friends",
+ 'selected' => ($filter_context == 'friends'),
+ ),
+);
-if (!($page_owner instanceof ElggGroup)){
- if($filter_context == 'everyone') {
- $all_selected = "class = 'selected'";
- }
- if($filter_context == 'mine') {
- $mine_selected = "class = 'selected'";
- }
- if($filter_context == 'friends') {
- $friend_selected = "class = 'selected'";
- }
-}
-
-// allow plugins to override default page handlers
-// @todo switch this over to proper page handling style
-$all_link = (isset($vars['all_link'])) ? $vars['all_link'] : "{$vars['url']}mod/$type/all.php";
-$mine_link = (isset($vars['mine_link'])) ? $vars['mine_link'] : "{$vars['url']}pg/$type/$username";
-$friend_link = (isset($vars['friend_link'])) ? $vars['friend_link'] : "{$vars['url']}pg/$type/$username/friends";
-$new_link = (isset($vars['new_link'])) ? $vars['new_link'] : "{$CONFIG->wwwroot}pg/$type/$username/new";
+// determine if using default or overwritten tabs
+$tabs = (isset($vars['tabs'])) ? $vars['tabs'] : $default_tabs;
+$tab_list = elgg_view('navigation/tabs', array('tabs' => $tabs));
$title = elgg_echo($type);
$title = '<div class="content_header_title">' . elgg_view_title($title) . '</div>';
-$tabs = <<<EOT
- <div class="elgg_horizontal_tabbed_nav margin_top">
- <ul>
- <li $all_selected><a href="$all_link">$all_title</a></li>
- <li $mine_selected><a href="$mine_link">$mine_title</a></li>
- <li $friend_selected><a href="$friend_link">$friend_title</a></li>
- </ul>
- </div>
-EOT;
-
-// must be logged in to see the filter menu and any action buttons
+// must be logged in to see any action buttons
if (isloggedin()) {
// only show the new button when not on the add form.
// hide the tabs when on the add form.
- // @todo remove the hard coded reference to the videolist plugin
if ($filter_context == 'action') {
- $tabs = '';
+ $tab_list = '';
} else {
+ // @todo remove the hard coded reference to the videolist plugin
if(get_context() == "videolist"){
$video_link = $CONFIG->wwwroot . "pg/videolist/browse/$username/";
- $new_button .= "<a href=\"{$video_link}\" class='action_button'>" . elgg_echo('videolist:browsemenu') . '</a>';
+ $new_button = "<a href=\"{$video_link}\" class='action_button'>" . elgg_echo('videolist:browsemenu') . '</a>';
}else{
+ $new_link = (isset($vars['new_link'])) ? $vars['new_link'] : "{$CONFIG->wwwroot}pg/$type/$username/new";
$new_button = "<a href=\"{$new_link}\" class='action_button'>" . elgg_echo($type . ':new') . '</a>';
}
$new_button = "<div class='content_header_options'>$new_button</div>";
@@ -85,21 +75,14 @@ if (isloggedin()) {
// also hide the tabs if in a group context (ie, listing groups) or
// when viewing tools belonging to a group
if (get_context() == 'groups' || $page_owner instanceof ElggGroup) {
- $tabs = '';
+ $tab_list = '';
}
-} else {
- // only show logged out users the all tab
- $page_filter = <<<EOT
- <div class="elgg_horizontal_tabbed_nav margin_top">
- <ul>
- <li $all_selected><a href="$all_link">$all_title</a></li>
- </ul>
- </div>
-EOT;
}
-?>
+
+echo <<<HTML
<div id="content_header" class="clearfloat">
- <?php echo $title . $new_button; ?>
+ $title $new_button
</div>
-<?php echo $tabs; ?>
+HTML;
+echo $tab_list;