X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=7b29a28fe311dbd12e27fd1e2af53d1a6250cc5d;hp=fdb461e233448de9ce89fec9719b8b11e86bffa4;hb=98fcfc10d9f2ae7bc90713f47e809fa1f6eccf15;hpb=f7037807083af50fcbf136cfbf18b617342d7c4e diff --git a/include/functions.php b/include/functions.php index fdb461e..7b29a28 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,5 +1,5 @@ $name\n"; + echo " $name\n"; /* add hints for poverty, wedding, solo, etc */ if( $gametype != "solo") @@ -814,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". @@ -823,23 +854,27 @@ function display_user_menu() " AND Game.player='$myid'". " AND Game.status<>'gameover'". " ORDER BY Game.session" ); - if(DB_num_rows($result)) - echo "
It's your turn in these games:
\n"; + $i=0; while( $r = DB_fetch_array($result)) { - echo "game ".DB_format_gameid($r[1])."
\n"; + if($i==0) + { + echo "
\n"; + echo "It's your turn in these games:
\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; } @@ -900,6 +935,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); @@ -932,8 +969,7 @@ function generate_global_score_table() $player[$key]['nr']+=1; } } - - echo "\n \n"; + function cmp($a,$b) { if($a['nr']==0 ) return 1; @@ -942,19 +978,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; }