aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-27 22:26:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-27 22:26:36 +0000
commitad896c53deac3f1fd405ba582d41c164470cbf4e (patch)
treee620dd93cfb64849c906934c94ed78eeff149fad
parentde7ca710d04cf6d1f53e03f1af110745e48a186a (diff)
downloadelgg-ad896c53deac3f1fd405ba582d41c164470cbf4e.tar.gz
elgg-ad896c53deac3f1fd405ba582d41c164470cbf4e.tar.bz2
Added navigation/tabs view for tabbed navigation.
git-svn-id: http://code.elgg.org/elgg/trunk@5907 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--views/default/navigation/tabs.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php
new file mode 100644
index 000000000..8a51c7f3d
--- /dev/null
+++ b/views/default/navigation/tabs.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Tab navigation
+ *
+ * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal (vertical TBI)
+ * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array(
+ * 'title' => string, // Title of link
+ * 'url' => string, // URL for the link
+ * 'class' => string // Class of the li element.
+ * 'selected' => bool // if this link is currently selected
+ * )
+ **/
+
+$type = (isset($vars['type'])) ? $vars['type'] : 'horizontal';
+if ($type == 'horizontal') {
+ $type_class = "elgg_horizontal_tabbed_nav margin_top";
+} else {
+ $type_class = "elgg_vertical_tabbed_nav";
+}
+
+if (isset($vars['tabs'])) {
+ ?>
+ <div class="<?php echo $type_class; ?>">
+ <ul>
+ <?php
+ foreach ($vars['tabs'] as $info) {
+ $class = (isset($info['class'])) ? $info['class'] : '';
+
+ if (isset($info['selected']) && $info['selected'] == TRUE) {
+ $class .= ' selected';
+ }
+
+ $class_str = ($class) ? "class=\"$class\"" : '';
+ $title = htmlentities($info['title'], ENT_QUOTES, 'UTF-8');
+ $url = htmlentities($info['url'], ENT_QUOTES, 'UTF-8');
+
+ echo "<li $class_str $js><a href=\"$url\" title=\"$title\"><span>$title</span></a></li>";
+ }
+ ?>
+ </ul>
+ </div>
+ <?php
+} \ No newline at end of file