BUGFIX: error in javascript, sickness didn't get cleared
[e-DoKo.git] / include / output.php
index 3eb813013d5e7d9f33e290235a65f30a89a3a438..0c75173e0c0091ed8e2ec3498069c1e8e8dba677 100644 (file)
@@ -42,69 +42,69 @@ function output_form_for_new_game($names)
       srand((float) microtime() * 10000000);
       $randkey = array_rand($names);
       $rand = $names[$randkey];
-      echo  "<div class=\"table".$i."\">\n";
+      echo  "     <div class=\"table".$i."\">\n";
       $i++;
-      echo "    <select name=\"$player\" size=\"1\" />  \n";
+      echo "       <select name=\"$player\" size=\"1\">  \n";
       foreach($names as $name)
        {
          if($name==$rand)
            {
-             echo "     <option selected=\"selected\">$name</option>\n";
+             echo "         <option selected=\"selected\">$name</option>\n";
            }
          else
-           echo "     <option>$name</option>\n";
+           echo "         <option>$name</option>\n";
        }
-      echo "  </select>\n</div>\n";
+      echo "       </select>\n     </div>\n";
     }
 ?>
     </div>
 
    <h2 class="rules"> Rules </h2>
       <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
-      <p> Ten of hearts:
-         <ul>
-         <li> <input type="radio" name="dullen" value="none" /> just normal non-trump  </li>
-         <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
-         <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
-         </ul>
-      </p>
-      <p> Schweinchen (both foxes), only in normal games or silent solos:
-        <ul>
+      <p> Ten of hearts: </p>
+      <ul>
+        <li> <input type="radio" name="dullen" value="none" /> just normal non-trump  </li>
+        <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
+        <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
+      </ul>
+      <p> Schweinchen (both foxes), only in normal games or silent solos: </p>
+      <ul>
         <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
         <li> <input type="radio" name="schweinchen" value="both" />
               both become highest trump (automatic call at beginning of the game)
         </li>
         <li> <input type="radio" name="schweinchen" value="second" />
-              first one normal, second one becomes highest (call during the game) </li>
+             first one normal, second one becomes highest (call during the game) </li>
         <li> <input type="radio" name="schweinchen" value="secondaftercall"  disabled="disabled" />
-      second one become highest only in case re/contra was announced (not working yet)
+             second one become highest only in case re/contra was announced (not working yet)
         </li>
-        </ul>
-      </p>
-      <p> Call Re/Contra, etc.:
-        <ul>
-           <li><input type="radio" name="callrule" value="1st-own-card" checked="checked" />
-                Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
-           <li><input type="radio" name="callrule" value="5th-card" />
-                Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
-           <li><input type="radio" name="callrule" value="9-cards"  />
-                Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
-        </ul>
-      </p>
+      </ul>
+      <p> Call Re/Contra, etc.: </p>
+      <ul>
+         <li><input type="radio" name="callrule" value="1st-own-card" checked="checked" />
+              Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
+         <li><input type="radio" name="callrule" value="5th-card" />
+              Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
+         <li><input type="radio" name="callrule" value="9-cards"  />
+              Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
+      </ul>
    <input type="submit" value="start game" />
  </form>
 <?php
 }
 
-function output_table($data,$class="")
+function output_table($data,$caption="",$class="")
 {
   if($class!="")
     $HTML  = "\n<table class=\"$class\">\n";
   else
     $HTML  = "\n<table>\n";
+
   $i=0;
-  
+
+  if($caption!="")
+    $HTML .= "  <caption> $caption </caption>\n";
+
   foreach($data as $record)
     {
       if(!$i)
@@ -143,7 +143,7 @@ function display_card($card,$dir="english")
   /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
    * convert even cards to the matching odd value */
 
-  if( $card/2 - (int)($card/2) == 0.5)
+  if( $card/2 - (int)($card/2) == 0.5 || $card == 0)
     echo "<img src=\"cards/".$dir."/".$card.".png\"  alt=\"".DB_get_card_name($card)."\" />\n";
   else
     echo "<img src=\"cards/".$dir."/".($card-1).".png\"  alt=\"".DB_get_card_name($card-1)."\" />\n";
@@ -270,13 +270,13 @@ 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/standard004.css" />
+     <link rel="stylesheet" type="text/css" href="css/standard010.css" />
      <script type="text/javascript">
        var current=0;
        function hl(num) {
          if(document.getElementById){
           var i;
-          for(i=1;i<14;i++){
+          for(i=0;i<14;i++){
             if(document.getElementById("trick"+i))
               document.getElementById("trick"+i).style.display = 'none';
           }
@@ -329,7 +329,7 @@ function output_footer()
     "  Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
     "  - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
     "  a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
- echo "  <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
+ echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
     "  via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
     "  <a href=\"http://www.dreamhost.com/green.cgi\">\n".
     "  <img  border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
@@ -371,8 +371,14 @@ function output_status()
        $unixtime = strtotime($time);
        date_default_timezone_set($zone);
 
-       echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>\n";
-     };
+       echo "<div class=\"lastlogin\"><span>last login: ".date("r",$unixtime)."</span></div>\n";
+     }
+   else
+     {
+       echo "\n<div class=\"status\">\n";
+       echo "<a href=\"".$INDEX."\">login</a>\n";
+       echo "</div>\n";
+     }
   return;
 }
 
@@ -397,8 +403,6 @@ function output_select_timezone($name,$timezone="")
   return;
 }
 
-
-
 function output_password_recovery($email,$password)
 {
 ?>
@@ -430,4 +434,18 @@ function output_password_recovery($email,$password)
 
 <?php
 }
+
+function output_user_notes($userid,$gameid,$userstatus)
+{
+  echo "<div class=\"notes\"> Personal notes: <br />\n";
+  $notes = DB_get_notes_by_userid_and_gameid($userid,$gameid);
+  foreach($notes as $note)
+    echo "$note <hr />\n";
+  if($userstatus!='gameover')
+    echo "<input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
+  echo "</div> \n";
+
+  return;
+}
+    
 ?>
\ No newline at end of file