diff options
author | Arun Persaud <arun@nubati.net> | 2008-03-01 18:07:05 -0800 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2008-03-01 18:07:05 -0800 |
commit | 73a6f86691f53d8eb6339b5bb5e9156822cc7e54 (patch) | |
tree | c5c64259f865bf0dec9cc847eb8c388fa5848d65 | |
parent | b9e33a977911024ed0df24c10b3e7f05391c17bf (diff) | |
download | e-DoKo-73a6f86691f53d8eb6339b5bb5e9156822cc7e54.tar.gz e-DoKo-73a6f86691f53d8eb6339b5bb5e9156822cc7e54.tar.bz2 e-DoKo-73a6f86691f53d8eb6339b5bb5e9156822cc7e54.zip |
FEATURE: add score table to email at the end of the game
the last 4 lines of the score table are now added to the email that is being send out at the end of a game.
Signed-off-by: Arun Persaud <arun@nubati.net>
-rw-r--r-- | index.php | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -1743,6 +1743,38 @@ else if(myisset("me")) $message .= " Total Points (from the Re point of view): $Tpoint\n"; $message .= "\n"; + $session = DB_get_session_by_gameid($gameid); + $score = generate_score_table($session); + /* convert html to ascii */ + $score = str_replace("<div class=\"scoretable\">\n<table class=\"score\">\n <tr>\n","",$score); + $score = str_replace("\n","",$score); + $score = str_replace(array("<tr>","</tr>","<td>","</td>"),array("","\n","","|"),$score); + $score = str_replace("</table></div>\n","",$score); + $score = explode("\n",$score); + + $header = array_slice($score,0,1); + $header = explode("|",$header[0]); + for($i=0;$i<sizeof($header);$i++) + $header[$i]=str_pad($header[$i],6," ",STR_PAD_BOTH); + $header = implode("|",$header); + $header.= "\n------+------+------+------+------+\n"; + if(sizeof($score)>5) $header.= " ... \n"; + + if(sizeof($score)>5) $score = array_slice($score,-5,5); + for($i=0;$i<sizeof($score);$i++) + { + $line = explode("|",$score[$i]); + for($j=0;$j<sizeof($line);$j++) + $line[$j]=str_pad($line[$j],6," ",STR_PAD_LEFT); + $score[$i] = implode("|",$line); + } + + $score = implode("\n",$score); + $score = $header.$score; + + $message .= "Score Table\n"; + $message .= $score; + /* send out final email */ $all = array(); |