From: Arun Persaud Date: Sat, 4 Aug 2007 18:38:17 +0000 (-0700) Subject: LAYOUT: new user page X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=465e73265bc236531832686a8ae54894be928b81 LAYOUT: new user page mixed finished games, started games and games in progress into one table --- diff --git a/css/standard.css b/css/standard.css index 32060e2..71ae568 100644 --- a/css/standard.css +++ b/css/standard.css @@ -362,5 +362,18 @@ ul.tricks li div div span.comment span{ div span img.button { height: 2em; width: 2em; +} +.gamestatuspre { + padding: 0 0.3em; + + background-color: #fd8901; +} +.gamestatusover { + padding:0 0.3em; + background-color: #f82c20 ; +} +.gamestatusplay { + padding:0 0.3em; + background-color: #15de26; } \ No newline at end of file diff --git a/functions.php b/functions.php index 45fa0ae..5c98274 100644 --- a/functions.php +++ b/functions.php @@ -821,7 +821,7 @@ function display_user_menu() echo "game ".DB_format_gameid($r[1])."
\n"; } - echo "
start a new game"; + echo "
start a new game"; echo diff --git a/index.php b/index.php index c2d93d2..de8dc1d 100644 --- a/index.php +++ b/index.php @@ -1714,86 +1714,70 @@ else if( myisset("email","password") || isset($_SESSION["name"]) ) /* display links to settings */ output_user_settings($email,$password); - echo "last login: ".date("r",$unixtime)."
"; + echo "
last login: ".date("r",$unixtime)."
"; DB_update_user_timestamp($myid); display_user_menu(); - echo "

These are your games that haven't started yet:

\n"; - $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". - " LEFT JOIN Game On Hand.game_id=Game.id". - " WHERE Hand.user_id='$myid' AND Game.status='pre'". - " ORDER BY Game.session" ); - echo "

\n"; - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - { - echo "game ".DB_format_gameid($r[1])." "; - if($r[3]==$myid || $r[3]==NULL) - echo "(it's your turn)\n"; - else - { - $name = DB_get_name_by_userid($r[3]); - echo "(it's $name's turn)\n"; - }; - - if(time()-strtotime($r[2]) > 60*60*24*30) - echo " The game has been running for over a month.". - " Do you want to cancel it? yes". - " (clicking here is final and can't be restored)"; - echo "
"; - } - echo "

\n"; - - echo "

These are the games you are playing in:

\n"; - $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". - " LEFT JOIN Game On Hand.game_id=Game.id". - " WHERE Hand.user_id='$myid' AND Game.status='play'". - " ORDER BY Game.session" ); - echo "

\n"; - while( $r = mysql_fetch_array($result,MYSQL_NUM)) - { - echo "game ".DB_format_gameid($r[1])." "; - if($r[3]) - { - if($r[3]==$myid) - echo "(it's your turn)\n"; - else - { - $name = DB_get_name_by_userid($r[3]); - echo "(it's $name's turn)\n"; - }; - } - if(time()-strtotime($r[2]) > 60*60*24*30) - echo " The game has been running for over a month.". - " Do you want to cancel it? yes". - " (clicking here is final and can't be restored)"; - echo "
"; - } + echo "

These are all your games:

\n"; + echo "

Session:
\n"; + echo " p = pre-game phase "; + echo "P = game in progess "; + echo "F = game finished
"; echo "

\n"; - - echo "

And these are your games that are already done:

\n"; - echo "

Session:\n"; $output = array(); - $result = mysql_query("SELECT hash,game_id from Hand". + $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player,Game.status from Hand". " LEFT JOIN Game ON Game.id=Hand.game_id". - " WHERE user_id='$myid' AND Game.status='gameover'". + " WHERE user_id='$myid'". " ORDER BY Game.session,Game.create_date" ); - $gamenrold = 0; - echo "
\n"; + $gamenrold = -1; + echo "\n \n \n
\n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) { $game = DB_format_gameid($r[1]); $gamenr = (int) $game; if($gamenrold < $gamenr) { + if($gamenrold!=-1) + echo "
$gamenr: "; + else + echo "$gamenr: "; $gamenrold = $gamenr; - echo "
$gamenr: "; } - echo "I "; + if($r[4]=='pre') + { + echo "\n p "; + + } + else if ($r[4]=='gameover') + echo "\n F "; + else + { + echo "\n P "; + } + if($r[4] != 'gameover') + { + echo "
\n "; + if($r[3]) + { + if($r[3]==$myid) + echo "(it's your turn)\n"; + else + { + $name = DB_get_name_by_userid($r[3]); + echo "(it's $name's turn)\n"; + }; + } + if(time()-strtotime($r[2]) > 60*60*24*30) + echo " The game has been running for over a month.". + " Do you want to cancel it? yes". + " (clicking here is final and can't be restored)"; + + } } - echo "

\n"; + echo "
\n"; $names = DB_get_all_names(); echo "

Registered players:

\n

\n"; echo implode(", ",$names)."\n";