/misparim/NumberOrderCheck.php

https://gitlab.com/EdwinHuijsing/learnhebrew · PHP · 243 lines · 83 code · 3 blank · 157 comment · 4 complexity · 39c3a1ad61753d7b895f5b078ff0dcb8 MD5 · raw file

  1. <?php
  2. /* include("Number.php");
  3. Function FNumberTest($Number) {
  4. if (is_numeric($Number) ) {
  5. Return ($Number);
  6. }
  7. }
  8. $Start = FNumberTest($_GET["start"]);
  9. $End = FNumberTest($_GET["end"]);
  10. */
  11. /* ******************** BOF Functios ******************** */
  12. /* Function FColor($pReal, $pUser) {
  13. if ($pReal !== $pUser) {
  14. echo " bgcolor=\"red\"";
  15. }
  16. }
  17. Function FScoreBG($pValue) {
  18. switch ($pValue) {
  19. case 0:
  20. echo " bgcolor=\"red\"";
  21. break;
  22. case ($pValue > 0 && $pValue < 60 ):
  23. echo " bgcolor=\"red\"";
  24. break;
  25. case ($pValue < 90 && $pValue >= 60):
  26. echo " bgcolor=\"orange\"";
  27. break;
  28. case ($pValue >= 90):
  29. echo " bgcolor=\"#00FF00\"";
  30. break;
  31. }
  32. }
  33. Function FFault() {
  34. // Count how many there are wrong.
  35. $fout = "0";
  36. foreach ($_GET as $key => $data) {
  37. if (is_numeric($key) ) {
  38. if (!empty($data) ) {
  39. if ($key!=$data) {
  40. $fout++;
  41. }
  42. }
  43. }
  44. }
  45. Return($fout);
  46. }
  47. Function FNotFilled() {
  48. // Count how many there are wrong.
  49. $NotFilled = "0";
  50. foreach ($_GET as $key => $data) {
  51. if ($data == "" ) {
  52. $NotFilled++;
  53. }
  54. }
  55. Return($NotFilled);
  56. }
  57. */
  58. /* ******************** EOF Functios ******************** */
  59. /*
  60. <HTML>
  61. <header>
  62. <link rel="stylesheet" type="text/css" href="stylesheet.css">
  63. </header>
  64. <BODY>*/
  65. /*<center>
  66. <table>
  67. <tr>
  68. <td valign=top> <!-- ******************** BOF score ******************** -->
  69. <?php
  70. $QtyNumbers = 0;
  71. foreach ($_GET as $key => $data) {
  72. if (is_numeric($key) ) {
  73. $QtyNumbers++;
  74. }
  75. }
  76. $Fault = FFault();
  77. $NotFilled = FNotFilled();
  78. $Good = $QtyNumbers-$Fault-$NotFilled;
  79. $Score = intval(round((($Good/$QtyNumbers)*100),1) );
  80. ?>
  81. <table class=left>
  82. <tr>
  83. <td align=center colspan=2><b>from <?php echo $QtyNumbers; ?> are</b></td>
  84. </tr>
  85. <tr>
  86. <td class=ScoreLeft>Wrong:</td>
  87. <td><?php echo $Fault; ?></td>
  88. </tr>
  89. <tr>
  90. <td class=ScoreLeft>Not filled:</td>
  91. <td><?php echo $NotFilled; ?></td>
  92. </tr>
  93. <tr>
  94. <td class=ScoreLeft>Good:</td>
  95. <td><?php echo $Good; ?></td>
  96. </tr>
  97. <tr>
  98. <td class=ScoreLeft>Score:</td>
  99. <td<?php FScoreBG($Score); ?>><?php echo $Score; ?>%</td>
  100. </tr>
  101. </table>
  102. <a href="NumberOrder.php?start=<?php echo $Start;?>&amp;end=<?php echo $End;?>">Try again!!</a>
  103. </td> <!-- ******************** EOF score ******************** -->
  104. <td>
  105. <table border=1>
  106. <tr>
  107. <td>Number</td>
  108. <td>Place</td>
  109. <td>You</td>
  110. <td>Number</td>
  111. <td>Place</td>
  112. <td>You</td>
  113. </tr>
  114. <?php
  115. $Teller=1;
  116. foreach ($_GET as $key => $data){
  117. if (is_numeric($key) ) {
  118. if (empty($arrNumber[$key]["ilPh"]) ) {
  119. $Number = "ilPhF";
  120. } else {
  121. $Number = "ilPh";
  122. }
  123. if (($Teller%2)>0) {
  124. ?>
  125. <tr>
  126. <td><?php echo $arrNumber[$key][$Number];?></td>
  127. <td Class=Main><?php
  128. echo $key;
  129. ?></td>
  130. <td Class=Main<?php FColor($arrNumber[$key]["Number"], $data);?>><?php echo $data;?>&nbsp;</td>
  131. <?php }else{ ?>
  132. <td><?php echo $arrNumber[$key][$Number];?></td>
  133. <td Class=Main><?php
  134. echo $key;
  135. ?></td>
  136. <td Class=Main<?php FColor($arrNumber[$key]["Number"], $data);?>><?php echo $data;?>&nbsp;</td>
  137. </tr>
  138. <?php }
  139. $Teller++;
  140. }
  141. }
  142. if (($Teller%2)==0) {
  143. ?>
  144. <td colspan=3>&nbsp;</td>
  145. </tr>
  146. <?php }?>
  147. </table>
  148. </td>
  149. </tr>
  150. </table>
  151. </center>
  152. </BODY>
  153. </HTML>
  154. */
  155. Include (DIR_WS_FUNCTIONS . "allround.php");
  156. $objAlefBet = simplexml_load_file(DIR_WS_XML . FILE_XML_MISPARIM);
  157. echo "<table class=quiz>\n";
  158. echo "\t<tr>\n";
  159. echo "\t\t<td valign=top> <!-- ******************** BOF score ******************** -->\n";
  160. $QtyLetters = 0;
  161. foreach ($_GET as $key => $data) {
  162. if (is_numeric($key) ) {
  163. $QtyLetters++;
  164. }
  165. }
  166. $Fault = FFault();
  167. $NotFilled = FNotFilled();
  168. $Good = $QtyLetters-$Fault-$NotFilled;
  169. $Score = intval(round((($Good/$QtyLetters)*100),1) );
  170. echo "\t\t<table class=left>\n";
  171. echo "\t\t\t<tr>\n";
  172. echo "\t\t\t\t<td align=center colspan=2><b>from " . $QtyLetters . " are</b></td>\n";
  173. echo "\t\t\t</tr>\n";
  174. echo "\t\t\t<tr>\n";
  175. echo "\t\t\t\t<td class=ScoreLeft>Wrong:</td>\n";
  176. echo "\t\t\t\t<td>" . $Fault . "</td>\n";
  177. echo "\t\t\t</tr>\n";
  178. echo "\t\t\t<tr>\n";
  179. echo "\t\t\t\t<td class=ScoreLeft>Not filled:</td>\n";
  180. echo "\t\t\t\t<td>" . $NotFilled . "</td>\n";
  181. echo "\t\t\t</tr>\n";
  182. echo "\t\t\t<tr>\n";
  183. echo "\t\t\t\t<td class=ScoreLeft>Good:</td>\n";
  184. echo "\t\t\t\t<td>" . $Good . "</td>\n";
  185. echo "\t\t\t</tr>\n";
  186. echo "\t\t\t<tr>\n";
  187. echo "\t\t\t\t<td class=ScoreLeft>Score:</td>\n";
  188. echo "\t\t\t\t<td " . FScoreBG($Score) . ">" . $Score . "%</td>\n";
  189. echo "\t\t\t</tr>\n";
  190. echo "\t\t</table>\n";
  191. echo "\t\t</td> <!-- ******************** EOF score ******************** -->\n";
  192. echo "\t\t<td>\n";
  193. echo "\t\t\t<table border=1>\n";
  194. echo "\t\t\t<tr>\n";
  195. echo "\t\t\t\t<td>Letter</td>\n";
  196. echo "\t\t\t\t<td>Place</td>\n";
  197. echo "\t\t\t\t<td>You</td>\n";
  198. echo "\t\t\t\t<td>Letter</td>\n";
  199. echo "\t\t\t\t<td>Place</td>\n";
  200. echo "\t\t\t\t<td>You</td>\n";
  201. echo "\t\t\t</tr>\n";
  202. $Teller=1;
  203. if ( $_REQUEST['type']=="mith") {
  204. $type = "unicode";
  205. $classs = "letter";
  206. }else{
  207. $type = "name";
  208. $classs = "Main";
  209. }
  210. foreach ($_GET as $key => $data){
  211. if (is_numeric($key)) {
  212. if (($Teller%2)>0) {
  213. echo "\t\t\t<tr>\n";
  214. echo "\t\t\t\t<td class=" . $classs . ">". $objAlefBet->AlefBet[0]->letter[($key-1)]->$type . "</td>\n";
  215. echo "\t\t\t\t<td class=Main>" . $key . "</td>\n";
  216. echo "\t\t\t\t<td class=\"Main\" " . FColor( $objAlefBet->AlefBet[0]->letter[($key-1)]->Attributes(), $data) . ">" . $data . "&nbsp;</td>\n";
  217. }else{
  218. echo "\t\t\t\t<td class=" . $classs . ">" . $objAlefBet->AlefBet[0]->letter[$key-1]->$type . "</td>\n";
  219. echo "\t\t\t\t<td class=Main>" . $key . "</td>\n";
  220. echo "\t\t\t\t<td class=Main " . FColor( $objAlefBet->AlefBet[0]->letter[($key-1)]->Attributes(), $data) . ">" . $data . "&nbsp;</td>\n";
  221. echo "\t\t\t</tr>\n";
  222. }
  223. $Teller++;
  224. }
  225. }
  226. unset($type);
  227. unset($classs);
  228. echo "\t\t\t<td colspan=3>&nbsp;</td>\n";
  229. echo "\t\t\t</tr>\n";
  230. echo "\t\t\t</table>\n";
  231. echo "\t\t</td>\n";
  232. echo "\t</tr>\n";
  233. echo "</table>\n";
  234. echo "</BODY>\n";
  235. echo "</HTML>\n";
  236. ?>