diff options
author | Arun Persaud <arun@nubati.net> | 2011-11-19 16:34:00 -0800 |
---|---|---|
committer | Arun Persaud <apersaud@lbl.gov> | 2011-11-19 16:34:00 -0800 |
commit | 1829c4b57884b84b5ef6cb54a031a62ce53005fa (patch) | |
tree | 0bc13785c15e5b5b3942c708b609b68cb78c9d6c /include/output.php | |
parent | 022246b947178ed5c7b1cd6a6dcc21414559b260 (diff) | |
download | e-DoKo-1829c4b57884b84b5ef6cb54a031a62ce53005fa.tar.gz e-DoKo-1829c4b57884b84b5ef6cb54a031a62ce53005fa.tar.bz2 e-DoKo-1829c4b57884b84b5ef6cb54a031a62ce53005fa.zip |
LAYOUT: fixed layout for new game page
Diffstat (limited to 'include/output.php')
-rw-r--r-- | include/output.php | 96 |
1 files changed, 64 insertions, 32 deletions
diff --git a/include/output.php b/include/output.php index f66a1d2..50da579 100644 --- a/include/output.php +++ b/include/output.php @@ -53,48 +53,80 @@ function output_form_for_new_game($names) * after we selected them to make sure that each name * only shows up once */ + + /* delete players name, since he will be on position D anyway */ + unset($copy_names[array_search($_SESSION["name"],$copy_names)]); + srand((float) microtime() * 10000000); + + echo ' <form action="index.php?action=new" method="post">'; echo ' <h2> '._('Select players (Remember: you need to be one of the players)').' </h2>'; - echo ' <div class="table">'; - echo ' <img class="table" src="pics/table.png" alt="table" />'; - /* ask player for names */ + echo ' <div class="table">'; - $i=0; + echo " <div class=\"table1\">\n"; + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo " <select name=\"PlayerB\" size=\"1\"> \n"; + foreach($names as $name) + { + if($name==$rand) + echo " <option selected=\"selected\">$name</option>\n"; + else + echo " <option>$name</option>\n"; + } + echo " </select>\n </div>\n"; - /* delete players name, since he will be on position D anyway */ - unset($copy_names[array_search($_SESSION["name"],$copy_names)]); + echo ' <div class="middle">'; - srand((float) microtime() * 10000000); - foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player) + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo " <div class=\"table0\">\n"; + echo " <select name=\"PlayerA\" size=\"1\"> \n"; + foreach($names as $name) { - /* pick 3 names at random and put the players name on position D*/ - if($i<3) - { - $randkey = array_rand($copy_names); - $rand = $copy_names[$randkey]; - /* delete this name from the list of possible names */ - unset($copy_names[$randkey]); - } + if($name==$rand) + echo " <option selected=\"selected\">$name</option>\n"; else - { - $rand = $_SESSION["name"]; - } + echo " <option>$name</option>\n"; + } + echo " </select>\n </div>\n"; - echo " <div class=\"table".$i."\">\n"; - $i++; - echo " <select name=\"$player\" size=\"1\"> \n"; - foreach($names as $name) - { - if($name==$rand) - { - echo " <option selected=\"selected\">$name</option>\n"; - } - else - echo " <option>$name</option>\n"; - } - echo " </select>\n </div>\n"; + echo ' <img class="table" src="pics/table.png" alt="table" />'; + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo " <div class=\"table2\">\n"; + echo " <select name=\"PlayerC\" size=\"1\"> \n"; + foreach($names as $name) + { + if($name==$rand) + echo " <option selected=\"selected\">$name</option>\n"; + else + echo " <option>$name</option>\n"; } + echo " </select>\n </div>\n"; + + echo ' </div>'; + $rand = $_SESSION["name"]; + echo " <div class=\"table3\">\n"; + $i++; + echo " <select name=\"PlayerD\" size=\"1\"> \n"; + foreach($names as $name) + { + if($name==$rand) + echo " <option selected=\"selected\">$name</option>\n"; + else + echo " <option>$name</option>\n"; + } + echo " </select>\n </div>\n"; + + /* ask player for names */ echo ' </div>'; echo ''; |