]> git.mjollnir.org Git - moodle.git/commitdiff
Small fix to avoid warnings on empty tables
authormoodler <moodler>
Tue, 23 Sep 2003 12:18:27 +0000 (12:18 +0000)
committermoodler <moodler>
Tue, 23 Sep 2003 12:18:27 +0000 (12:18 +0000)
lib/weblib.php

index f0258fb508c2c7a12ea8f8a706c89968f8f17f94..3cfb52b5285bb6e84864c83be780a4f4455ad087 100644 (file)
@@ -1091,21 +1091,23 @@ function print_table($table) {
         echo "</tr>\n";
     }
 
-    foreach ($table->data as $row) {
-        echo "<tr valign=\"top\">";
-        foreach ($row as $key => $item) {
-            if (!isset($size[$key])) {
-                $size[$key] = "";
-            } 
-            if (!isset($align[$key])) {
-                $align[$key] = "";
-            } 
-            if (!isset($wrap[$key])) {
-                $wrap[$key] = "";
-            } 
-            echo "<td ".$align[$key].$size[$key].$wrap[$key]." class=\"generaltablecell\">$item</td>";
+    if (!empty($table->data)) {
+        foreach ($table->data as $row) {
+            echo "<tr valign=\"top\">";
+            foreach ($row as $key => $item) {
+                if (!isset($size[$key])) {
+                    $size[$key] = "";
+                } 
+                if (!isset($align[$key])) {
+                    $align[$key] = "";
+                } 
+                if (!isset($wrap[$key])) {
+                    $wrap[$key] = "";
+                } 
+                echo "<td ".$align[$key].$size[$key].$wrap[$key]." class=\"generaltablecell\">$item</td>";
+            }
+            echo "</tr>\n";
         }
-        echo "</tr>\n";
     }
     echo "</table>\n";
     print_simple_box_end();