X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=9103c6f517fc9e19501fc2364f1283315e66f582;hp=466b4ae34f631d7c6a08414ebbbdd079aa0943b9;hb=44e91af3fd631752e4de74673b591bce17ce7a79;hpb=b568d14fe83e919b41452d8ae5b57a7dedc671cf
diff --git a/include/functions.php b/include/functions.php
index 466b4ae..9103c6f 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -727,7 +727,7 @@ function can_call($what,$hash)
function display_table ()
{
- global $gameid, $GT, $debug,$INDEX,$defaulttimezone;
+ global $gameid, $GT, $debug,$INDEX,$defaulttimezone,$session;
global $RULES,$GAME,$gametype;
$result = DB_query("SELECT User.fullname as name,".
@@ -779,12 +779,12 @@ function display_table ()
$cards = DB_get_all_hand($userhash);
$trumpNR = count_trump($cards);
if($trumpNR)
- echo " ";
+ echo " ";
else
- echo " ";
+ echo " ";
}
else
- echo " \" />";
+ echo " \" title=\"poverty partner\" />";
if($GT=="dpoverty")
if($party=="re")
@@ -794,12 +794,12 @@ function display_table ()
$cards = DB_get_all_hand($userhash);
$trumpNR = count_trump($cards);
if($trumpNR)
- echo " ";
+ echo " ";
else
- echo " ";
+ echo " ";
}
else
- echo " \" />";
+ echo " \" title=\"poverty partner\" />";
else
if($sickness=="poverty")
{
@@ -807,64 +807,64 @@ function display_table ()
$cards = DB_get_all_hand($userhash);
$trumpNR = count_trump($cards);
if($trumpNR)
- echo " ";
+ echo " ";
else
- echo " ";
+ echo " ";
}
else
- echo " \" />";
+ echo " \" title=\"poverty2 partner\" />";
if($GT=="wedding" && $party=="re")
if($sickness=="wedding")
- echo " ";
+ echo " ";
else
- echo " ";
+ echo " ";
if(ereg("solo",$GT) && $party=="re")
{
if(ereg("queen",$GT))
- echo " ";
+ echo " ";
else if(ereg("jack",$GT))
- echo " ";
+ echo " ";
else if(ereg("club",$GT))
- echo " ";
+ echo " ";
else if(ereg("spade",$GT))
- echo " ";
+ echo " ";
else if(ereg("heart",$GT))
- echo " ";
+ echo " ";
else if(ereg("trumpless",$GT))
- echo " ";
+ echo " ";
else if(ereg("trump",$GT))
- echo " ";
+ echo " ";
}
/* add point calls */
if($call!=NULL)
{
if($party=="re")
- echo " ";
+ echo " ";
else
- echo " ";
+ echo " ";
switch($call)
{
case "0":
- echo " ";
+ echo " ";
break;
case "30":
- echo " ";
+ echo " ";
break;
case "60":
- echo " ";
+ echo " ";
break;
case "90":
- echo " ";
+ echo " ";
break;
}
}
echo "
\n";
- echo " local time\n";
- echo " last login\n";
+ echo " time info\n";
echo " \n";
}
@@ -939,11 +939,12 @@ function generate_score_table($session)
foreach($gameids as $gameid)
{
$re_score = DB_get_score_by_gameid($gameid);
+ $gametype = DB_get_gametype_by_gameid($gameid);
foreach($player as $id=>$points)
{
$party = DB_get_party_by_gameid_and_userid($gameid,$id);
if($party == "re")
- if(DB_get_gametype_by_gameid($gameid)=="solo")
+ if($gametype=="solo")
$player[$id] += 3*$re_score;
else
$player[$id] += $re_score;
@@ -953,7 +954,7 @@ function generate_score_table($session)
$score[$i]['gameid'] = $gameid ;
$score[$i]['players'] = $player;
$score[$i]['points'] = abs($re_score);
- $score[$i]['solo'] = (DB_get_gametype_by_gameid($gameid)=="solo");
+ $score[$i]['solo'] = ($gametype=="solo");
$i++;
}
@@ -982,12 +983,14 @@ function generate_global_score_table()
foreach($gameids as $gameid)
{
$re_score = DB_get_score_by_gameid($gameid);
+ $gametype = DB_get_gametype_by_gameid($gameid);
+
/* TODO: this shouldn't loop over all players, just the 4 players that are in the game */
foreach($player as $key=>$pl)
{
$party = DB_get_party_by_gameid_and_userid($gameid,$pl['id']);
if($party == "re")
- if(DB_get_gametype_by_gameid($gameid)=="solo")
+ if($gametype=="solo")
$player[$key]['points'] += 3*$re_score;
else
$player[$key]['points'] += $re_score;
@@ -1070,39 +1073,60 @@ function format_score_table_html($score,$userid)
if(sizeof($score)==0)
return "";
- $output = "
No | "; + $header = ""; + $header.= " \n|||||||
---|---|---|---|---|---|---|---|
No | "; foreach($score[0]['players'] as $id=>$points) { $name = DB_get_name('userid',$id); /*TODO*/ - $output.= "".substr($name,0,2)." | "; + $header.= "".substr($name,0,2)." | "; } - $output.="P | \nP | \n \n \n"; + /* use the same as footer */ + $footer = ""; + $footer.= " \n|||
No | "; + foreach($score[0]['players'] as $id=>$points) + { + $name = DB_get_name('userid',$id); /*TODO*/ + $footer.= "".substr($name,0,2)." | "; + } + $footer.="P | \n|||||
$i | "; + $body.="$i | "; else - $output.="$i | "; + $body.="$i | "; foreach($game['players'] as $id=>$points) - $output.="".$points." | "; - $output.="".$game['points']; + $body.=" | ".$points." | "; + $body.="".$game['points']; /* check for solo */ if($game['solo']) - $output.= " S"; - $output.=" |