68cfb28f7fa96fdc3eda723c448853ec78dcf999
[e-DoKo.git] / output.php
1 <?php
2
3 /* functions which only ouput html  */
4
5 function display_status()
6 {
7   echo "<div class=\"info\">";
8   echo " is someone playing solo, etc?";
9   echo "</div>\n";
10   
11   return;
12 }
13
14 function display_news()
15 {
16   global $wiki;
17   echo "<div class=\"bug\">\n".
18     "  Please hit <strong>shift+reload</strong>.<br /><hr />\n".
19     "  added local time display, let me know what you think<br /><hr />\n".
20     "  If you find more bugs, please list them in the <a href=\"".$wiki.
21     "\">wiki</a>.\n</div>\n";
22   return;
23 }
24
25
26 function output_form_for_new_game()
27 {
28 ?>
29     <p>Please add 4 names, please make sure that the names are correct! </p>
30        <form action="index.php" method="post">
31    Name:  <input name="PlayerA" type="text" size="10" maxlength="20" /> 
32    Name:  <input name="PlayerB" type="text" size="10" maxlength="20" /> 
33    Name:  <input name="PlayerC" type="text" size="10" maxlength="20" /> 
34    Name:  <input name="PlayerD" type="text" size="10" maxlength="20" /> 
35
36    <input type="submit" value="start game" />
37  </form>
38 <?php
39 }
40
41 function display_card($card)
42 {
43   /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ... 
44    * convert even cards to the matching odd value */
45
46   if( $card/2 - (int)($card/2) == 0.5)
47     echo "<img src=\"cards/".$card.".png\"  alt=\"".card_to_name($card)."\" />\n";
48   else
49     echo "<img src=\"cards/".($card-1).".png\"  alt=\"".card_to_name($card-1)."\" />\n";
50
51   return;
52 }
53
54 function display_link_card($card)
55 {
56   if( $card/2 - (int)($card/2) == 0.5)
57     echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".$card.".png\" alt=\"\" />\n";
58   else
59     echo "<input type=\"radio\" name=\"card\" value=\"".$card."\" /><img src=\"cards/".($card-1).".png\" alt=\"\" />\n";
60   return;
61 }
62
63 function check_for_sickness($me,$mycards)
64 {
65  ?>
66   <p> nothing implemented so far, but give it a try anyway ;) </p>                
67
68   <form action="index.php" method="post">
69
70     do you want to play solo? 
71     <select name="solo" size="1">
72       <option>No</option>
73       <option>trumpless</option>
74       <option>trump</option>
75       <option>queen</option>
76       <option>jack</option>
77       <option>club</option>
78       <option>spade</option>
79       <option>heart</option>
80     </select>     
81     <br />
82
83  <?php   
84       
85    echo "wedding?";
86   if(check_wedding($mycards))
87      {
88        echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" />";
89        echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
90      }
91    else
92      {
93        echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
94      };
95
96   echo "do you have poverty?";
97   if(count_trump($mycards)<4)
98     {
99       echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" />";
100       echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
101     }
102   else
103     {
104       echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
105     };
106
107    echo "do you have too many nines?";
108   if(count_nines($mycards)>4)
109      {
110        echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" />";
111        echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
112      }
113    else
114      {
115        echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
116      };
117
118    echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
119    echo "<input type=\"submit\" value=\"count me in\" />\n";
120
121    echo "</form>\n";
122
123   return;
124 }
125
126 function check_want_to_play($me)
127 {
128    ?>
129  <form action="index.php" method="post">
130    Do you want to play a game of DoKo?
131    yes<input type="radio" name="in" value="yes" />
132    no<input type="radio" name="in" value="no" /> <br />
133
134    Do you want to get an email for every card played or only if it your move?
135    every card<input type="radio" name="update" value="card" />
136    only on my turn<input type="radio" name="update" value="turn" /> <br />
137 <?php   
138   echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
139   echo "\n";
140   echo "<input type=\"submit\" value=\"count me in\" />\n";
141   echo " </form>\n";
142
143   return;
144 }
145
146 function home_page()
147 {
148 ?>
149     <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
150     <p> Please <a href="index.php?register">register</a>, in case you haven't done yet  <br />
151         or login with you email-address or name and password here:
152     </p>
153         <form action="index.php" method="post">
154           <fieldset>
155             <legend>Login</legend>
156              <table>
157               <tr>
158                <td><label for="email">Email:</label></td><td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
159               </tr><tr>
160                <td><label for="password">Password:</label></td><td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
161               </tr><tr>
162                <td> <input type="submit" value="login" /></td>
163              </table>
164           </fieldset>
165         </form>
166
167 <?php
168  return;
169 }
170
171 function output_header()
172 {
173 ?>
174 <!DOCTYPE html PUBLIC
175     "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
176     "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
177 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
178   <head>
179      <title>e-Doko</title>
180      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
181      <link rel="stylesheet" type="text/css" href="css/standard.css" />  
182      <script type="text/javascript">
183        function hl(num) {
184          if(document.getElementById){
185            var i;
186            for(i=1;i<13;i++){
187              if(document.getElementById("trick"+i))
188                document.getElementById("trick"+i).style.display = 'none';
189            }
190            document.getElementById("trick"+num).style.display = 'block';
191          }
192        }
193        function high_last(){
194          if(document.getElementById){
195            var i;
196            for(i=12;i>0;i--) {
197              if(document.getElementById("trick"+i))
198                {
199                  hl(i);
200                  break;
201                }
202            }
203          }
204        }
205      </script>
206   </head>
207 <body onload="high_last();">
208 <div class="header">
209 <h1> Welcome to E-Doko </h1>
210 </div>
211
212 <?php
213   return;
214 }
215
216 function output_footer()
217 {
218   echo "</body>\n";
219   echo "</html>\n";
220
221   return;
222 }
223 ?>