-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_problems.php
76 lines (65 loc) · 2.41 KB
/
math_problems.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
<?php
//CLEANUP: move repeated code to bootstrap/load file
$generatorPath = 'generators';
$directoryHandle = @opendir($generatorPath) or die("Unable to find question generators at path: $generatorPath.");
while( $file = readdir($directoryHandle) ) {
if( preg_match( '/\.php$/', $file ) ) {
require_once("$generatorPath/$file");
}
}
closedir($directoryHandle);
$generatorsToIgnore = array('Generator', 'CompoundGenerator');
$generators = array();
foreach( get_declared_classes() as $class ) {
if( preg_match('/Generator$/', $class) && !in_array($class, $generatorsToIgnore)) {
$generators[] = new $class();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math Questions</title>
<link rel="stylesheet" href="stylesheets/base.css" type="text/css" media="screen" />
<link rel="stylesheet" id="current-theme" href="stylesheets/themes/drastic-dark/style.css" type="text/css" media="screen" />
</head>
<body>
<div id="container">
<div id="header">
<h1><a href="index.html">Math Questions</a></h1>
<div id="main-navigation">
<ul class="wat-cf">
<li class="active"><a>Problem selection</a></li>
</ul>
</div>
</div>
<div id="wrapper" class="wat-cf">
<div id="main">
<div class="block" id="block-text">
<div class="content">
<div class="inner">
<form action="math.php" method=GET>
<?php
foreach( $generators as $generator ) {
echo "<INPUT TYPE=CHECKBOX NAME='".get_class($generator)."'>{$generator->getShortName()}</INPUT>";
echo "<br/>";
$info_divs[] = $generator->getAdditionalInfoBlock();
}
echo implode("\n", $info_divs);
?>
<input type=submit name=submit value="Create questions">
</form>
</div>
</div>
</div>
<div id="footer">
<div class="block">
<p>Copyright © 2011 Dale Fukami.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>