From a1c07dccbae02ae3663cb30bed875cfe904587a6 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 15 Nov 2011 20:56:02 -0800 Subject: LAYOUT: redone layout of table and cards scales a lot better now and should be better for mobile devices --- include/functions.php | 65 ++++++++++++--- include/game.php | 217 +++++++++++++++++++++++++++++--------------------- include/output.php | 2 +- 3 files changed, 179 insertions(+), 105 deletions(-) (limited to 'include') diff --git a/include/functions.php b/include/functions.php index fc46a61..0313bed 100644 --- a/include/functions.php +++ b/include/functions.php @@ -971,7 +971,7 @@ function can_call($what,$hash) return 0; } -function display_table () +function display_table_begin () { global $gameid, $GT, $debug,$INDEX,$defaulttimezone,$session; global $RULES,$GAME,$gametype; @@ -991,10 +991,57 @@ function display_table () "WHERE Hand.game_id='".$gameid."' ". "ORDER BY position ASC"); - echo "
\n". - " \"table\"\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); + echo " \"table\"\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) +{ + global $gameid, $GT, $debug,$INDEX,$defaulttimezone,$session; + global $RULES,$GAME,$gametype; + $name = $r[0]; $pos = $r[1]; $user = $r[2]; @@ -1139,7 +1186,7 @@ function display_table () "title=\"local time: ".date("Y-m-d H:i:s",$timenow). " ". "last login: ".date("Y-m-d H:i:s",$lastlogin)."\" />"; - echo " "; + echo "
"; /* show how many tricks the person made */ switch($wins) { @@ -1156,12 +1203,6 @@ function display_table () } echo "\n"; echo "
\n"; - - } - echo "\n"; /* end output table */ - - - return; } diff --git a/include/game.php b/include/game.php index c78482c..621b0b0 100644 --- a/include/game.php +++ b/include/game.php @@ -330,6 +330,103 @@ if($mystatus!='gameover') if(isset($_SESSION['id'])) DB_update_user_timestamp($_SESSION['id']); + +/****************************************************************************** + * Output menu for selecting tricks + ******************************************************************************/ + +switch($mystatus) + { + case 'start': + break; + case 'init': + case 'check': + /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ + echo "\n\n"; /* end div trick, end li trick , end tricks*/ + /* end displaying sickness */ + break; + case 'poverty': + /* output pre-game trick in case user reloads, + * only needs to be done when a team has been formed */ + if($myparty=='re' || $myparty=='contra') + { + echo "\n\n\n"; /* end div trick, end li trick , end ul tricks */ + } + /* end output pre-game trick */ + break; + case 'play': + case 'gameover': + + echo "\n\n\n"; + + break; + default: + } + + /****************************************************************************** * Output tricks played, table, messages, and cards (depending on game status) ******************************************************************************/ @@ -338,7 +435,7 @@ if($mystatus!='gameover') echo "
\n"; /* display the table and the names */ -display_table(); +display_table_begin(); /* mystatus gets the player through the different stages of a game. * start: does the player want to play? @@ -361,6 +458,7 @@ $cards_status = CARDS_EMPTY; */ $messages = array(); + switch($mystatus) { case 'start': @@ -428,28 +526,6 @@ switch($mystatus) ***************************/ if(!myisset('solo','wedding','poverty','nines','lowtrump') ) { - /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ - echo "\n\n"; /* end div trick, end li trick , end tricks*/ - /* end displaying sickness */ - $mycards = DB_get_hand($me); output_check_for_sickness($me,$mycards); @@ -546,28 +622,6 @@ switch($mystatus) * this can therefore only be handled once all players finished the last stage */ - /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ - echo "\n\n"; /* end div trick, end li trick , end tricks*/ - /* end displaying sickness */ - $messages[] = _('Checking if someone else selected solo, nines, wedding or poverty.'); /* check if everyone has reached this stage */ @@ -879,24 +933,6 @@ switch($mystatus) }; } - /* output pre-game trick in case user reloads, - * only needs to be done when a team has been formed */ - if($myparty=='re' || $myparty=='contra') - { - echo "\n\n\n"; /* end div trick, end li trick , end ul tricks */ - } - /* end output pre-game trick */ - /* get hand */ $mycards = DB_get_hand($me); @@ -1270,7 +1306,7 @@ switch($mystatus) $pos = DB_get_startplayer_by_gameid($gameid)-1; $firstcard = ''; /* first card in a trick */ - echo "\n\n"; /* end ul tricks*/ + echo "\n"; /* end ul tricks*/ if($myturn && !myisset('card') && $mystatus=='play' ) { @@ -1987,6 +2017,9 @@ switch($mystatus) myerror("error in testing the status"); } /*end of output: tricks, table, messages, card */ +/* display the 2nd half of table and the names */ +display_table_end(); + /************** * show cards * **************/ diff --git a/include/output.php b/include/output.php index 325cf4a..823f193 100644 --- a/include/output.php +++ b/include/output.php @@ -378,7 +378,7 @@ function output_header() - + -- cgit v1.2.3-18-g5258