marked more strings for translation
[e-DoKo.git] / include / output.php
index 018372b37c7542b75dafd8fa1f33f47a893c82b3..7f35dd28b42f4c914387814a24abe975ff3ef608 100644 (file)
@@ -123,10 +123,19 @@ function output_form_for_new_game($names)
      <p>
        <select name="callrule">
         <option value="1st-own-card" selected="selected">  Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</option>
-        <option value="5th-card">  Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
+        <option value="5th-card"> Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
         <option value="9-cards" > Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</option>
        </select>
      </p>
+     <h4>Low trump</h4>
+     <p>
+       Player can't trump a fox, that is none of his trump is higher than a fox.
+       <select name="lowtrump">
+        <option value="poverty">The trump will be treated as poverty and offered to another player.</option>
+        <option value="cancel">  The game will be canceled unless there is a solo.</option>
+        <option value="none">   Bad luck, the player needs to play a normal game.</option>
+       </select>
+     </p>
      <h3>Scoring-related</h3>
      <h4>(not yet implemented)</h4>
      <p><input type="submit" value="start game"></p>
@@ -205,10 +214,11 @@ function display_link_card($card,$dir="english",$type="card")
 
 function output_check_for_sickness($me,$mycards)
 {
+  global $RULES;
  ?>
   <div class="sickness"> Thanks for joining the game...<br />
 
-    do you want to play solo?
+    Do you want to play solo?
     <select name="solo" size="1">
       <option selected="selected">No</option>
       <option>trumpless</option>
@@ -245,7 +255,7 @@ function output_check_for_sickness($me,$mycards)
       echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
     };
 
-   echo "Do you have too many nines?";
+  echo "Do you have too many nines?";
   if(count_nines($mycards)>4)
      {
        echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
@@ -256,6 +266,26 @@ function output_check_for_sickness($me,$mycards)
        echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
      };
 
+  if($RULES['lowtrump']=='cancel' || $RULES['lowtrump']=='poverty')
+    {
+      if($RULES['lowtrump']=='cancel')
+       echo "Do you have low trump (cancel game)?";
+      else
+       echo "Do you have low trump (poverty)?";
+
+      if(check_low_trump($mycards))
+       {
+         echo " yes<input type=\"radio\" name=\"lowtrump\" value=\"yes\" checked=\"checked\" />";
+         echo " no <input type=\"radio\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+       }
+      else
+       {
+         echo " no <input type=\"hidden\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+       };
+    }
+  else
+    echo "<input type=\"hidden\" name=\"lowtrump\" value=\"no\" />";
+
    echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
    echo "<input type=\"submit\" value=\"count me in\" />\n";
 
@@ -364,7 +394,9 @@ function output_header()
   </head>
 <body onload="high_last();">
 <div class="header">
-<h1> Welcome to E-Doko </h1>
+<?php
+  echo '<h1> '._('Welcome to E-Doko').' </h1>';
+?>
 </div>
 <?php
 
@@ -401,12 +433,12 @@ function output_status()
 {
   global $defaulttimezone, $INDEX, $WIKI, $RSS;
 
-  if(isset($_SESSION["name"]))
+  if(isset($_SESSION['name']))
     {
-      $name = $_SESSION["name"];
+      $name = $_SESSION['name'];
 
       /* last logon time */
-      $myid  = DB_get_userid("name",$name);
+      $myid  = DB_get_userid('name',$name);
       $zone  = DB_get_user_timezone($myid);
 
       $time     = DB_get_user_timestamp($myid);
@@ -420,21 +452,21 @@ function output_status()
       /* logout info */
       echo "\n<div class=\"status\">\n";
       echo $name,"\n";
-      echo " | <a href=\"".$INDEX."\"> mypage </a>\n";
-      echo " | <a href=\"".$INDEX."?action=prefs\">settings</a>\n";
-      echo " | <a href=\"".$INDEX."?action=new\">new game</a>\n";
-      echo " | <a href=\"".$INDEX."?action=stats\">statistics</a>\n";
-      echo " | <a href=\"".$WIKI."\">wiki</a>\n";
-      echo " | <a href=\"".$RSS."?uid=".$myid."&amp;token=".$token."\">rss</a>\n";
-      echo " |&nbsp;&nbsp;&nbsp; <a href=\"".$INDEX."?action=logout\">logout</a>\n";
+      echo " | <a href=\"".$INDEX."\">"._('mypage')."</a>\n";
+      echo " | <a href=\"".$INDEX."?action=prefs\">"._('settings')."</a>\n";
+      echo " | <a href=\"".$INDEX."?action=new\">"._('new game')."</a>\n";
+      echo " | <a href=\"".$INDEX."?action=stats\">"._('statistics')."</a>\n";
+      echo " | <a href=\"".$WIKI."\">"._('wiki/bugs')."</a>\n";
+      echo " | <a href=\"".$RSS."?uid=".$myid."&amp;token=".$token."\">"._('atom')."</a>\n";
+      echo " |&nbsp;&nbsp;&nbsp; <a href=\"".$INDEX."?action=logout\">"._('logout')."</a>\n";
       echo "</div>\n";
 
-      echo "<div class=\"lastlogin\"><span>last login: ".date("r",$unixtime)."</span></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 "<a href=\"".$INDEX."\">"._('login')."</a>\n";
       echo "</div>\n";
     }
   return;
@@ -486,6 +518,26 @@ function output_select_timezone($name,$timezone="")
   return;
 }
 
+function output_select_language($name,$language="")
+{
+  $LOCALE = array ("English"     => "en",
+                  "Deutsch"     => "de" );
+
+  echo "  <select id=\"$name\" name=\"$name\" size=\"1\">\n";
+
+  foreach($LOCALE as $place=>$locale)
+    {
+      if($language==$locale)
+       echo "   <option value=\"$locale\" selected=\"selected\">$place</option>\n";
+      else
+       echo "   <option value=\"$locale\">$place</option>\n";
+    }
+  echo "  </select>\n";
+
+  return;
+}
+
+
 function output_password_recovery($email,$password)
 {
 ?>
@@ -520,7 +572,7 @@ function output_password_recovery($email,$password)
 
 function output_user_notes($userid,$gameid,$userstatus)
 {
-  echo "<div class=\"notes\"> Personal notes: <br />\n";
+  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";
@@ -556,7 +608,7 @@ function output_exchanged_cards()
    */
 
   /* need some information about the game */
-  global $gameid,$mygametype, $PREF,$me,$mystatus;
+  global $gameid,$mygametype, $PREF,$me,$mystatus, $RULES;
 
   /* some variables to track where the people with poverty are sitting */
   $partnerpos1 = 0;
@@ -573,7 +625,7 @@ function output_exchanged_cards()
       for($mypos=1;$mypos<5;$mypos++)
        {
          $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid);
-         if($usersick == 'poverty')
+         if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump'))
            if($povertypos1)
              $povertypos2 = $mypos;
            else