$this->title = $title ? $title : $text;
$this->linkedwhenselected = $linkedwhenselected;
}
-
-
- /// a method to look after the messy business of setting up a tab cell
- /// with all the appropriate classes and things
- function createtab ($selected=false, $inactive=false, $activetwo=false, $last=false) {
- $str = '';
- $astr = '';
- $cstr = '';
-
- /// The text and anchor for this tab
- if ($inactive || $activetwo || ($selected && !$this->linkedwhenselected)) {
- $astr .= $this->text;
- } else {
- $astr .= '<a href="'.$this->link.'" title="'.$this->title.'">'.$this->text.'</a>';
- }
-
- /// There's an IE bug with background images in <a> tags
- /// so we put a div around so that we can add a background image
- $astr = '<div class="tablink">'.$astr.'</div>';
-
- /// Set the class for inactive cells
- if ($inactive) {
- $cstr .= ' inactive';
-
- /// Set the class for active cells in the second row
- if ($activetwo) {
- $cstr .= ' activetwo';
- }
-
- /// Set the class for the selected cell
- } else if ($selected) {
- $cstr .= ' selected';
-
- /// Set the standard class for a cell
- } else {
- $cstr .= ' active';
- }
-
-
- /// Are we on the last tab in this row?
- if ($last) {
- $astr = '<div class="last">'.$astr.'</div>';
- }
-
- /// Lets set up the tab cell
- $str .= '<td';
- if (!empty($cstr)) {
- $str .= ' class="'.ltrim($cstr).'"';
- }
- $str .= '>';
- $str .= $astr;
- $str .= '</td>';
-
- return $str;
- }
-
}
$activetwo = array();
}
-/// A table to encapsulate the tabs
- $str = '<table class="tabs" cellspacing="0">';
- $str .= '<tr><td class="left side"></td><td>';
+/// Convert the tab rows into a tree that's easier to process
+ if (!$tree = convert_tabrows_to_tree($tabrows, $selected, $inactive, $activetwo)) {
+ return false;
+ }
- $rowcount = count($tabrows);
-/// Cycle through the tab rows
- foreach ($tabrows as $row) {
+/// Print out the current tree of tabs (this function is recursive)
+
+ $output = convert_tree_to_html($tree);
- $rowcount--;
+ $output = "\n\n".'<div class="tabtree">'.$output.'</div><div class="clearer"> </div>'."\n\n";
- $str .= '<table class="tabrow r'.$rowcount.'" cellspacing="0">';
- $str .= '<tr>';
+/// We're done!
- $numberoftabs = count($row);
- $currenttab = 0;
- $cstr = '';
- $astr = '';
+ if ($return) {
+ return $output;
+ }
+ echo $output;
+}
- /// Cycle through the tabs
- foreach ($row as $tab) {
- $currenttab++;
+function convert_tree_to_html($tree, $row=0) {
+
+ $str = "\n".'<ul class="tabrow'.$row.'">'."\n";
+
+ foreach ($tree as $tab) {
+ $str .= '<li>';
+
+ if ($tab->active || $tab->selected) {
+ $linkclass = ' class="selected"';
+ } else {
+ $linkclass = '';
+ }
- $str .= $tab->createtab( ($selected == $tab->id), (in_array($tab->id, $inactive)), (in_array($tab->id, $activetwo)), ($currenttab == $numberoftabs) );
+ if ($tab->inactive || $tab->active || ($tab->selected && !$tab->linkedwhenselected)) {
+ $astr = '<a href="#" title="'.$tab->title.'"'.$linkclass.'>'.$tab->text.'</a>';
+ } else {
+ $astr = '<a href="'.$tab->link.'" title="'.$tab->title.'"'.$linkclass.'>'.$tab->text.'</a>';
}
- $str .= '</tr>';
- $str .= '</table>';
+ $str .= '<div class="tablink">'.$astr.'</div>';
+
+ if (!empty($tab->subtree)) {
+ $str .= convert_tree_to_html($tab->subtree, $row+1);
+ }
+
+ $str .= '</li>'."\n";
}
- $str .= '</td><td class="right side"></td></tr>';
- $str .= '</table>';
+ $str .= '</ul>'."\n";
- if ($return) {
- return $str;
+ return $str;
+}
+
+
+function convert_tabrows_to_tree($tabrows, $selected, $inactive, $activetwo) {
+
+/// Work backwards through the rows (bottom to top) collecting the tree as we go.
+
+ $tabrows = array_reverse($tabrows);
+
+ $subtree = array();
+
+ foreach ($tabrows as $row) {
+ $tree = array();
+
+ foreach ($row as $tab) {
+ $tab->inactive = in_array($tab->id, $inactive);
+ $tab->active = in_array($tab->id, $activetwo);
+ $tab->selected = $tab->id == $selected;
+
+ if ($tab->active || $tab->selected) {
+ if ($subtree) {
+ $tab->subtree = $subtree;
+ }
+ }
+ $tree[] = $tab;
+ }
+ $subtree = $tree;
}
- echo $str;
+
+ return $tree;
}
}
form.popupform {
- display: inline;
+ display: inline;
}
.arrow_button {
vertical-align: top;
}
-img.icon {
+img.icon {
vertical-align:middle;
margin-right:4px;
- width:16px;
- height:16px;
+ width:16px;
+ height:16px;
border:0px;
}
-
-img.iconsmall {
+
+img.iconsmall {
vertical-align:middle;
margin-right:1px;
width:11px;
- height:11px;
+ height:11px;
border:0px;
}
-img.iconhelp {
+img.iconhelp {
vertical-align:middle;
margin-right:4px;
width:17px;
- height:17px;
+ height:17px;
border:0px;
}
-img.iconkbhelp {
+img.iconkbhelp {
width:49px;
- height:17px;
+ height:17px;
border:0px;
}
}
#calendar .maincalendar {
- height: 100%;
+ height: 100%;
}
#calendar .maincalendar .heightcontainer {
- height: 100%;
- position: relative;
+ height: 100%;
+ position: relative;
}
#calendar .maincalendar .bottom {
- width: 100%;
- position: absolute;
- bottom: 0;
- text-align: center;
+ width: 100%;
+ position: absolute;
+ bottom: 0;
+ text-align: center;
}
#calendar .sidecalendar {
***/
.message-discussion-noframes #userinfo .userpicture {
- float:left;
+ float:left;
}
.message-discussion-noframes #userinfo .name h1 {
}
.message-discussion-noframes #send h1 {
- margin:0px;
+ margin:0px;
}
.message-discussion-noframes #messages {
*** Tabs
***/
-.tabs {
- width: auto;
- margin-bottom: 15px;
- border-collapse: collapse;
+.tabtree {
}
-.tabs td {
- padding: 0px;
+.tabrow0 {
+ position:relative;
+ float:left;
+ width:100%;
+ padding:0 0 1.75em 1em;
+ margin:0;
+ list-style:none;
+ line-height:1em;
}
-.tabs .side {
- width: 50%;
- border-style: solid;
- border-width: 0px 0px 1px 0px;
+.tabrow0 li {
+ float:left;
+ margin:0;
+ padding:0;
}
-.tabrow {
- border-collapse:collapse;
- width:100%;
- margin: 1px 0px 0px 0px;
+.tabrow0 a {
+ display:block;
+ color:#006;
+ text-decoration:none;
+ /* font-weight:bold; */
+ background:#ddd;
+ margin:0;
+ padding:0.25em 1em;
+ border-left:1px solid #fff;
+ border-top:1px solid #fff;
+ border-right:1px solid #aaa;
}
-.tabrow td {
- padding:0 0 0px 14px;
- border-style: solid;
- border-width: 0px 0px 1px 0px;
+.tabrow0 a:hover,
+.tabrow0 a:active,
+.tabrow0 a.selected:link,
+.tabrow0 a.selected:visited {
+ background:#bbb;
}
-.tabrow th {
- display:none;
+.tabrow0 a.selected:link,
+.tabrow0 a.selected:visited {
+ position:relative;
+ z-index:102;
}
-.tabrow td .tablink {
- display:block;
- padding:10px 14px 4px 0px;
- text-align:center;
- white-space:nowrap;
- text-decoration:none;
+
+/*subnav*/
+.tabrow0 ul {
+ position:absolute;
+ left:0;
+ top:1.5em;
+ float:left;
+ background:#bbb;
+ width:100%;
+ margin:0;
+ padding:0.25em 0.25em 0.25em 1em;
+ list-style:none;
+ border-top:1px solid #fff;
}
-.tabrow .last {
+
+.tabrow0 ul li {
+ float:left;
display:block;
- padding:0px 1px 0px 0px;
+ margin-top:1px;
}
-.tabrow td.selected {
- border-width: 0px;
+.tabrow0 ul a {
+ background:#bbb;
+ display:inline;
+ margin:0;
+ padding:0 1em;
+ border:0
}
body#mod-quiz-report .controls {
text-align: center;
}
-body#question-preview .quemodname, body#question-preview .controls {
+body#question-preview .quemodname, body#question-preview .controls {
text-align: center;
}
.workshopuploadform,
.workshopkey {
text-align:center;
-}
\ No newline at end of file
+}