\n";
- while($r = DB_fetch_array($result))
- {
+ $row0 = DB_fetch_array($result);
+ $row1 = DB_fetch_array($result);
+ $row2 = DB_fetch_array($result);
+ $row3 = DB_fetch_array($result);
+
+ echo "
\n";
+ display_single_user($row1);
+ echo "\n
\n";
+ display_single_user($row0,1); /* mark starting player in case re/contra is not set yet */
+ echo "
\n";
+ display_single_user($row2);
+
+ return;
+}
+function display_table_end ()
+{
+ global $gameid, $GT, $debug,$INDEX,$defaulttimezone,$session;
+ global $RULES,$GAME,$gametype;
+
+ $result = DB_query("SELECT User.fullname as name,".
+ " Hand.position as position, ".
+ " User.id, ".
+ " Hand.party as party, ".
+ " Hand.sickness as sickness, ".
+ " Hand.point_call, ".
+ " User.last_login, ".
+ " Hand.hash, ".
+ " User.timezone, ".
+ " User.email ".
+ "FROM Hand ".
+ "LEFT JOIN User ON User.id=Hand.user_id ".
+ "WHERE Hand.game_id='".$gameid."' ".
+ "ORDER BY position ASC");
+
+ $row0 = DB_fetch_array($result);
+ $row1 = DB_fetch_array($result);
+ $row2 = DB_fetch_array($result);
+ $row3 = DB_fetch_array($result);
+
+ echo "
\n";
+ display_single_user($row3);
+ echo "
\n";
+
+ return;
+}
+
+function display_single_user($r,$start=0)
+{
+ /* start=1, mark starting player, default=0, so the player on the left is not marked */
+
+ global $gameid, $GT, $debug,$INDEX,$defaulttimezone,$session;
+ global $RULES,$GAME,$gametype;
+
$name = $r[0];
$pos = $r[1];
$user = $r[2];
@@ -738,16 +1062,36 @@ function display_table ()
$call = $r[5];
$hash = $r[7];
$timezone = $r[8];
+ $email = $r[9];
+ $wins = DB_get_number_of_tricks($gameid,$pos);
date_default_timezone_set($defaulttimezone);
$lastlogin = strtotime($r[6]);
date_default_timezone_set($timezone);
$timenow = strtotime(date("Y-m-d H:i:s"));
+ $gravatar = "$name
\n";
- if(!$debug)
- echo " $name \n";
+
+ /* mark starting player */
+ if($start && ! ($party=="re" || $party=="contra"))
+ echo '
'._('Starting Player')." \n";
+
+ if($debug)
+ echo "
";
+ if($vacation = check_vacation($user))
+ {
+ $start = $vacation[0];
+ $stop = substr($vacation[1],0,10);
+ $comment = $vacation[2];
+
+ $title = "begin: $start end: $stop $comment";
+ echo " $gravatar (on vacation until $stop) \n";
+ }
else
- echo " $name\n";
+ echo " $gravatar \n";
+ if($debug)
+ echo" \n";
/* add hints for poverty, wedding, solo, etc */
if( $gametype != "solo")
@@ -755,140 +1099,174 @@ function display_table ()
echo " Schweinchen.
";
if($GT=="poverty" && $party=="re")
- if($sickness=="poverty")
+ if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump'))
{
$userhash = DB_get_hash_from_gameid_and_userid($gameid,$user);
$cards = DB_get_all_hand($userhash);
- $trumpNR = count_trump($cards);
+ $trumpNR = count_trump($cards,'all');
if($trumpNR)
- echo "
";
+ echo "
\n";
else
- echo "
";
+ echo "
\n";
}
else
- echo "
\" />";
+ echo "
\n";
if($GT=="dpoverty")
if($party=="re")
- if($sickness=="poverty")
+ if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump'))
{
$userhash = DB_get_hash_from_gameid_and_userid($gameid,$user);
$cards = DB_get_all_hand($userhash);
- $trumpNR = count_trump($cards);
+ $trumpNR = count_trump($cards,'all');
if($trumpNR)
- echo "
";
+ echo "
\n";
else
- echo "
";
+ echo "
\n";
}
else
- echo "
\" />";
+ echo "
\" title=\"poverty partner\" />\n";
else
- if($sickness=="poverty")
+ if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump'))
{
$userhash = DB_get_hash_from_gameid_and_userid($gameid,$user);
$cards = DB_get_all_hand($userhash);
- $trumpNR = count_trump($cards);
+ $trumpNR = count_trump($cards,'all');
if($trumpNR)
- echo "
";
+ echo "
\n";
else
- echo "
";
+ echo "
\n";
}
else
- echo "
\" />";
+ echo "
\" title=\"poverty2 partner\" />\n";
if($GT=="wedding" && $party=="re")
if($sickness=="wedding")
- echo "
";
+ echo "
\n";
else
- echo "
";
+ echo "
\n";
- if(ereg("solo",$GT) && $party=="re")
+ if( (strpos($GT,"solo")!==false) && $party=="re")
{
- if(ereg("queen",$GT))
- echo "
";
- else if(ereg("jack",$GT))
- echo "
";
- else if(ereg("club",$GT))
- echo "
";
- else if(ereg("spade",$GT))
- echo "
";
- else if(ereg("heart",$GT))
- echo "
";
- else if(ereg("trumpless",$GT))
- echo "
";
- else if(ereg("trump",$GT))
- echo "
";
+ if(strpos($GT,"queen")!==false)
+ echo "
\n";
+ else if(strpos($GT,"jack")!==false)
+ echo "
\n";
+ else if(strpos($GT,"club")!==false)
+ echo "
\n";
+ else if(strpos($GT,"spade")!==false)
+ echo "
\n";
+ else if(strpos($GT,"heart")!==false)
+ echo "
\n";
+ else if(strpos($GT,"trumpless")!==false)
+ echo "
\n";
+ else if(strpos($GT,"trump")!==false)
+ echo "
\n";
}
/* add point calls */
if($call!=NULL)
{
if($party=="re")
- echo "
";
+ echo "
\n";
else
- echo "
";
+ echo "
\n";
switch($call)
{
case "0":
- echo "
";
+ echo "
\n";
break;
case "30":
- echo "
";
+ echo "
\n";
break;
case "60":
- echo "
";
+ echo "
\n";
break;
case "90":
- echo "
";
+ echo "
\n";
break;
}
}
- echo "
\n";
- echo "
local time\n";
- echo "
last login\n";
- echo "