aboutsummaryrefslogtreecommitdiff
path: root/views/default/content/header.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-04 04:43:26 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-04 04:43:26 +0000
commit4e80e365f054dea55bd481cbebd7af5fed7bb288 (patch)
treefa8ce71532292f0d37cca4651607125c4e453654 /views/default/content/header.php
parent719146b6449c1241f70caed2ddb520ce8fbd6da3 (diff)
downloadelgg-4e80e365f054dea55bd481cbebd7af5fed7bb288.tar.gz
elgg-4e80e365f054dea55bd481cbebd7af5fed7bb288.tar.bz2
a better main content view structure
git-svn-id: http://code.elgg.org/elgg/trunk@7525 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/content/header.php')
-rw-r--r--views/default/content/header.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/views/default/content/header.php b/views/default/content/header.php
new file mode 100644
index 000000000..b28dc17c0
--- /dev/null
+++ b/views/default/content/header.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Main content header
+ *
+ * This includes a title and a new content button by default
+ *
+ * @uses $vars['header_override'] HTML for overriding the default header (override)
+ * @uses $vars['title'] Title text (override)
+ * @uses $vars['context'] Page context (override)
+ * @uses $vars['buttons'] Content header buttons (override)
+ */
+
+if (isset($vars['header_override'])) {
+ echo $vars['header_override'];
+ return true;
+}
+
+$context = elgg_get_array_value('context', $vars, elgg_get_context());
+if ($context) {
+ $title = elgg_get_array_value('title', $vars, '');
+ if (!$title) {
+ $title = elgg_echo($context);
+ }
+
+ if (isset($vars['buttons'])) {
+ $buttons = $vars['buttons'];
+ } else {
+ if (isloggedin() && $context) {
+ $username = get_loggedin_user()->username;
+ $new_link = elgg_get_array_value('new_link', $vars, "pg/$context/$username/new");
+ $params = array(
+ 'href' => $new_link = elgg_normalize_url($new_link),
+ 'text' => elgg_echo("$context:new"),
+ 'class' => 'action-button right',
+ );
+ $buttons = elgg_view('output/url', $params);
+ }
+ }
+ echo <<<HTML
+<div id="elgg-main-header" class="elgg-header clearfix">
+ <h2 class="elgg-module-heading">$title</h2>$buttons
+</div>
+HTML;
+}