LAYOUT: added a unified table layout for statistics, etc
authorArun Persaud <arun@nubati.net>
Mon, 26 May 2008 18:08:51 +0000 (11:08 -0700)
committerArun Persaud <arun@nubati.net>
Mon, 26 May 2008 18:08:51 +0000 (11:08 -0700)
a table that can be styled via CSS is created from an array.

Signed-off-by: Arun Persaud <arun@nubati.net>
css/standard004.css [moved from css/standard003.css with 94% similarity]
include/db.php
include/output.php

similarity index 94%
rename from css/standard003.css
rename to css/standard004.css
index 7ad7cd17dfd6843a92f2fb6a6fd19e380a9bccb6..e3692afe33663ea1283cdb210e48043b475fa556 100644 (file)
@@ -458,4 +458,21 @@ table.score {
 
 .bigger {
   font-size:larger;
-}
\ No newline at end of file
+}
+
+table { margin: 0.5em 1em; 
+  border: solid 0.2em #aeaeae;
+  -moz-border-radius: 0.5em ;
+}
+tr.odd  { background-color:#aeaeae; }
+tr.even { background-color:#eaeaea; }
+td,th { 
+  margin-left:  0.2em;
+  margin-right: 0.2em;
+  padding-left:  0.2em;
+  padding-right: 0.2em;
+  border-right: solid 0.1em black;
+}
+tr td:last-child, tr th:last-child { border-right: solid 0 black; }
+
+th { border-bottom: solid 0.2em black }
\ No newline at end of file
index c8750b49d88264a966863103a2b71e0142636d8d..9b691ecb3f8e7c953348f2e2f63e63b55b3513ef 100644 (file)
@@ -85,6 +85,17 @@ function DB_query_array($query)
   return $return;
 }
 
+function DB_query_array_all($query)
+{
+  $result = array();
+  
+  $queryresult  = DB_query($query);
+  while($row = DB_fetch_array($queryresult))
+    $result[] = $row;
+
+  return $result;
+}
+
 function DB_get_passwd_by_name($name)
 {
   $r = DB_query_array("SELECT password FROM User WHERE fullname=".DB_quote_smart($name)."");
index 28489a08a50fabd1829b422d81dd1f1a29c03a2d..3eb813013d5e7d9f33e290235a65f30a89a3a438 100644 (file)
@@ -96,6 +96,48 @@ function output_form_for_new_game($names)
 <?php
 }
 
+function output_table($data,$class="")
+{
+  if($class!="")
+    $HTML  = "\n<table class=\"$class\">\n";
+  else
+    $HTML  = "\n<table>\n";
+  $i=0;
+  
+  foreach($data as $record)
+    {
+      if(!$i)
+       $HTML .= "  <thead>\n  <tr>\n";
+      else
+       {
+         if($i==1) $HTML .= "  <tbody>\n";
+         if($i % 2)
+           $HTML .= "  <tr class=\"odd\">   ";
+         else
+           $HTML .= "  <tr class=\"even\">  ";
+       }
+      foreach($record as $point)
+       {
+         if($i)
+           $HTML .= "    <td>$point</td> ";
+         else
+           $HTML .= "    <th>$point</th> ";
+       }
+
+      if(!$i)
+       $HTML .= "  </tr>\n  </thead>\n";
+      else
+       {
+         $HTML .= "  </tr>\n";
+       }
+      $i++;
+    }
+  $HTML .= "  </tbody>\n</table>\n";
+
+  return $HTML;
+}
+
 function display_card($card,$dir="english")
 {
   /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
@@ -228,7 +270,7 @@ function output_header()
      <title>e-Doko</title>
      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
      <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
-     <link rel="stylesheet" type="text/css" href="css/standard003.css" />
+     <link rel="stylesheet" type="text/css" href="css/standard004.css" />
      <script type="text/javascript">
        var current=0;
        function hl(num) {