X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=a338f388df0bb2822a654f3a13afb27e01d39a3a;hp=382b1488f20512864a68e6091c3e5f3b913e2d2d;hb=af2ee6fe421192cd2b42fcb4bbd09179bbce3943;hpb=880dfb2e715a3770de56fb525f5c90d28a6ccb4c diff --git a/include/functions.php b/include/functions.php index 382b148..a338f38 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,5 +1,5 @@ $name\n"; /* add hints for poverty, wedding, solo, etc */ + if( $gametype != "solo") + if( $RULES["schweinchen"]=="both" && $GAME["schweinchen-who"]==$hash ) + echo " Schweinchen.
"; + if($GT=="poverty" && $party=="re") if($sickness=="poverty") { @@ -809,8 +847,6 @@ function display_table () function display_user_menu() { global $WIKI,$myid,$INDEX; - echo "
\n". - " Go to my user page "; $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand". " LEFT JOIN Game On Hand.game_id=Game.id". @@ -819,22 +855,25 @@ function display_user_menu() " AND Game.status<>'gameover'". " ORDER BY Game.session" ); if(DB_num_rows($result)) - echo "
It's your turn in these games:
\n"; + echo "It's your turn in these games:
\n"; + $i=0; while( $r = DB_fetch_array($result)) { + if($i==0) + echo "
\n"; + + $i++; echo "game ".DB_format_gameid($r[1])."
\n"; + if($i>4) + { + echo "...
\n"; + break; + } } - echo "
Start a new game\n"; - - echo "
Change settings\n"; - - echo "
Statistics\n"; - - echo - "
Report bugs in the wiki\n"; - echo "
\n"; + if($i) + echo "
\n"; return; } @@ -895,6 +934,8 @@ function generate_score_table($session) function generate_global_score_table() { + $return = array(); + /* get all ids */ $gameids = DB_get_gameids_of_finished_games_by_session(0); @@ -927,8 +968,7 @@ function generate_global_score_table() $player[$key]['nr']+=1; } } - - echo "\n \n"; + function cmp($a,$b) { if($a['nr']==0 ) return 1; @@ -937,19 +977,20 @@ function generate_global_score_table() $a=$a['points']/$a['nr']; $b=$b['points']/$b['nr']; - if ($a == $b) + if ($a == $b) return 0; return ($a > $b) ? -1 : 1; } usort($player,"cmp"); + foreach($player as $pl) { + /* limit to players with at least 10 games */ if($pl['nr']>10) - echo " \n"; + $return[] = array( $pl['name'], round($pl['points']/$pl['nr'],3) ); } - echo "
",$pl['name'],"",round($pl['points']/$pl['nr'],3),"
\n"; - - return; + + return $return; }