]> git.mjollnir.org Git - moodle.git/commitdiff
Improved classes for new tabs MDL-7782
authormoodler <moodler>
Thu, 25 Jan 2007 04:43:26 +0000 (04:43 +0000)
committermoodler <moodler>
Thu, 25 Jan 2007 04:43:26 +0000 (04:43 +0000)
Improved inclusion of meta.php avoids notices for non-existent files

lib/weblib.php

index b964b81cf8d254d381481dcf7b7dba3086ab64f3..db1285f81ec48d6258aa423ba224786e4bf63774 100644 (file)
@@ -1994,17 +1994,21 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
     }
 
     if ($THEME->parent && (!isset($THEME->parentmetainclude) || $THEME->parentmetainclude)) {
-        ob_start();
-        include_once($CFG->dirroot.'/theme/'.$THEME->parent.'/meta.php');
-        $metapage .= ob_get_contents();
-        ob_end_clean();
+        if (file_exists($CFG->dirroot.'/theme/'.$THEME->parent.'/meta.php')) {
+            ob_start();
+            include_once($CFG->dirroot.'/theme/'.$THEME->parent.'/meta.php');
+            $metapage .= ob_get_contents();
+            ob_end_clean();
+        }
     }
 
     if (!isset($THEME->metainclude) || $THEME->metainclude) {
-        ob_start();
-        include_once($CFG->dirroot.'/theme/'.current_theme().'/meta.php');
-        $metapage .= ob_get_contents();
-        ob_end_clean();
+        if (file_exists($CFG->dirroot.'/theme/'.current_theme().'/meta.php')) {
+            ob_start();
+            include_once($CFG->dirroot.'/theme/'.current_theme().'/meta.php');
+            $metapage .= ob_get_contents();
+            ob_end_clean();
+        }
     }
 
     $meta = $meta."\n".$metapage;
@@ -5422,25 +5426,39 @@ function convert_tree_to_html($tree, $row=0) {
 
     $str = "\n".'<ul class="tabrow'.$row.'">'."\n";
 
+    $first = true;
+    $count = count($tree);
+
     foreach ($tree as $tab) {
-        $str .= '<li>';
+        $count--;   // countdown to zero
+
+        if ($first) {
+            $str .= '<li class="first">';
+            $first = false;
+        } else if ($count == 0) {
+            $str .= '<li class="last">';
+        } else {   
+            $str .= '<li>';
+        }
 
         if ($tab->selected) { 
-            $linkclass = ' class="selected"';
+            $linkclass = ' class="here selected"';
         } else if ($tab->active) { 
-            $linkclass = ' class="active"';
+            $linkclass = ' class="here active"';
         } else {
             $linkclass = '';
         }
 
         if ($tab->inactive || $tab->active || ($tab->selected && !$tab->linkedwhenselected)) {
-            $str .= '<a href="#" title="'.$tab->title.'"'.$linkclass.'>'.$tab->text.'</a>';
+            $str .= '<a href="#" title="'.$tab->title.'"'.$linkclass.'><span>'.$tab->text.'</span></a>';
         } else {
-            $str .= '<a href="'.$tab->link.'" title="'.$tab->title.'"'.$linkclass.'>'.$tab->text.'</a>';
+            $str .= '<a href="'.$tab->link.'" title="'.$tab->title.'"'.$linkclass.'><span>'.$tab->text.'</span></a>';
         }
 
         if (!empty($tab->subtree)) { 
             $str .= convert_tree_to_html($tab->subtree, $row+1);
+        } else if ($tab->selected) {
+            $str .= '<ul class="tabrow'.($row+1).' empty"> <li/> </ul>'."\n";
         }
 
         $str .= '</li>'."\n";