-
Notifications
You must be signed in to change notification settings - Fork 1
/
declgrid.php
128 lines (120 loc) · 4.2 KB
/
declgrid.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<? include 'build.php' ?>
<?
$decl = $_POST["decl"];
$start = $_POST["start"];
$end = $_POST["end"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Latin Vocab</title>
<script type="text/javascript" src="decline.js"></script>
</head>
<body>
<p><b>Please input your answers and press "Enter" to check them.</b></p>
<p><hr /></p>
<table>
<?
$count = 10;
$num = 0;
for ($i = 0; $i < sizeof($vocab); $i++) {
if ($start || $end) {
if ($end < $start) $end = $start;
if ($vocab[$i]['CHAPTER'] < $start)
continue;
if ($vocab[$i]['CHAPTER'] > $end)
continue;
}
if (strcasecmp($vocab[$i]['TYPE'], "noun"))
continue;
if ($decl) {
if ($vocab[$i]['DECLENSION'] != $decl)
continue;
}
$list[$num++] = array($vocab[$i]['PLURAL'], $vocab[$i]['LATIN'],
$vocab[$i]['DECLENSION'], $vocab[$i]['GENDER']);
}
if ($start == $end)
$count = sizeof($list);
if (!sizeof($list)) {
print "<tr><td>There aren't any nouns to quiz you on!</td></tr>";
} else while ($count && sizeof($list)) {
$i = rand(0, sizeof($list) - 1);
?>
<tr>
<td><? print $list[$i][1] ?></td>
<td align="center">Singular</td><td></td>
<td align="center">Plural</td><td></td></tr>
<?
$types = array("Nom", "Gen", "Dat", "Acc", "Abl", "Voc");
foreach ($types as $type) {
?>
<tr>
<td><? print $type ?>.</td>
<td>
<? if (!$list[$i][0]): ?>
<form onsubmit="return checkAnswer(<? print $count ?>,
'<? print $type ?>',
1,
'<? print $list[$i][1] ?>',
'<? print $list[$i][2] ?>',
'<? print $list[$i][3] ?>',
false)">
<input id="1<? print $type . $count ?>" />
</form>
<? endif ?>
</td>
<td><label id="result1<? print $type . $count ?>"><font color="white">Incorrect!</font></td>
<td>
<form onsubmit="return checkAnswer(<? print $count ?>,
'<? print $type ?>',
2,
'<? print $list[$i][1] ?>',
'<? print $list[$i][2] ?>',
'<? print $list[$i][3] ?>',
false)">
<input id="2<? print $type . $count ?>" />
</form>
</td>
<td><label id="result2<? print $type . $count ?>"><font color="white">Incorrect!</font></td>
</tr>
<?
}
$count--;
array_splice($list, $i, 1);
if ($count && sizeof($list)) {
print "<tr><td colspan=\"5\"><hr /></td></tr>\n";
}
}
?>
</table>
<hr />
<p><form action="declgrid.php" method="post">
Quiz
<select name="decl">
<option value="0">all</option>
<option value="1">first</option>
<option value="2">second</option>
<option value="3">third</option>
<option value="3i">third, i-stem</option>
<option value="4">fourth</option>
<option value="5">fifth</option>
</select>
declensions for nouns (as grids) from Chapter
<select name="start">
<? for ($i = 1; $i <= 40; $i++): ?>
<option value="<? echo $i; if ($i == $start) echo "\" selected=\"selected" ?>"><? echo $i ?></option>
<? endfor ?>
</select>
to Chapter
<select name="end">
<? for ($i = 1; $i <= 40; $i++): ?>
<option value="<? echo $i; if ($i == $end) echo "\" selected=\"selected" ?>"><? echo $i ?></option>
<? endfor ?>
</select>
<input type="submit" value="Quiz" />
</form></p>
<p><a href="index.php">Return to Main Page</a></p>
</body>
</html>