summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2007-08-04 11:38:17 -0700
committerArun Persaud <arun@nubati.net>2007-08-04 12:37:59 -0700
commit465e73265bc236531832686a8ae54894be928b81 (patch)
tree616a09039c2d72fc7430c96dc52edf9421f5d2ac
parentc44e3cfcc5f363f001b101a82b1c06bfa7b05e69 (diff)
downloade-DoKo-465e73265bc236531832686a8ae54894be928b81.tar.gz
e-DoKo-465e73265bc236531832686a8ae54894be928b81.tar.bz2
e-DoKo-465e73265bc236531832686a8ae54894be928b81.zip
LAYOUT: new user page
mixed finished games, started games and games in progress into one table
-rw-r--r--css/standard.css13
-rw-r--r--functions.php2
-rw-r--r--index.php106
3 files changed, 59 insertions, 62 deletions
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 "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
}
- echo "<hr> <a href=\"".$host."?new\">start a new game</a>";
+ echo "<hr /> <a href=\"".$host."?new\">start a new game</a>";
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)."<br />";
+ echo "<div style=\"position:absolute; font-size:smaller; top:0; left:0; \">last login: ".date("r",$unixtime)."</div>";
DB_update_user_timestamp($myid);
display_user_menu();
- echo "<h4>These are your games that haven't started yet:</h4>\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 "<p>\n";
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- {
- echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
- if($r[3]==$myid || $r[3]==NULL)
- echo "(it's <strong>your</strong> 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? <a href=\"$host?cancle=1&amp;me=".$r[0]."\">yes</a>".
- " (clicking here is final and can't be restored)";
- echo "<br />";
- }
- echo "</p>\n";
-
- echo "<h4>These are the games you are playing in:</h4>\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 "<p>\n";
- while( $r = mysql_fetch_array($result,MYSQL_NUM))
- {
- echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a>";
- if($r[3])
- {
- if($r[3]==$myid)
- echo "(it's <strong>your</strong> 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? <a href=\"$host?cancle=1&amp;me=".$r[0]."\">yes</a>".
- " (clicking here is final and can't be restored)";
- echo "<br />";
- }
+ echo "<h4>These are all your games:</h4>\n";
+ echo "<p>Session: <br />\n";
+ echo "<span class=\"gamestatuspre\"> p </span> = pre-game phase ";
+ echo "<span class=\"gamestatusplay\">P </span> = game in progess ";
+ echo "<span class=\"gamestatusover\">F </span> = game finished <br />";
echo "</p>\n";
-
- echo "<h4>And these are your games that are already done:</h4>\n";
- echo "<p>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 "<br />\n";
+ $gamenrold = -1;
+ echo "<table>\n <tr><td>\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 "</td></tr>\n <tr> <td>$gamenr:</td><td> ";
+ else
+ echo "$gamenr:</td><td> ";
$gamenrold = $gamenr;
- echo "<br /> $gamenr: ";
}
- echo "<a href=\"".$host."?me=".$r[0]."\">I </a>";
+ if($r[4]=='pre')
+ {
+ echo "\n <span class=\"gamestatuspre\"><a href=\"".$host."?me=".$r[0]."\">p </a></span> ";
+
+ }
+ else if ($r[4]=='gameover')
+ echo "\n <span class=\"gamestatusover\"><a href=\"".$host."?me=".$r[0]."\">F </a></span> ";
+ else
+ {
+ echo "\n <span class=\"gamestatusplay\"><a href=\"".$host."?me=".$r[0]."\">P </a></span> ";
+ }
+ if($r[4] != 'gameover')
+ {
+ echo "</td><td>\n ";
+ if($r[3])
+ {
+ if($r[3]==$myid)
+ echo "(it's <strong>your</strong> 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? <a href=\"$host?cancle=1&amp;me=".$r[0]."\">yes</a>".
+ " (clicking here is final and can't be restored)";
+
+ }
}
- echo "</p>\n";
+ echo "</td></tr>\n</table>\n";
$names = DB_get_all_names();
echo "<h4>Registered players:</h4>\n<p>\n";
echo implode(", ",$names)."\n";