-
Notifications
You must be signed in to change notification settings - Fork 1
/
searchPage.php
executable file
·64 lines (48 loc) · 1.14 KB
/
searchPage.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
<?php
class searchPage extends cpage {
function __construct() {
parent::__construct('What Do I Need on the Final?');
}
function loadPage() {
ob_start(); // Start output buffering.
if (isset($_GET['course'])) {
$results = false;
$courseCode = $_GET['course'];
$course = new Course($courseCode);
$assessmentItems = $course->fetchAssessment();
if ($assessmentItems) {
$total = $course->total();
if (isset($_POST['submit'])) {
$results = $course->calculateResults($_POST);
} else {
$course->addSearch();
}
include('content/search.php');
} else {
include('content/notFound.php');
}
} else {
include('content/404.php');
}
$content = ob_get_clean();
$this->setContent($content);
}
function assessmentTable($assessmentItems) {
foreach($assessmentItems as $item) {
include('content/assessmentTable.php');
}
}
function resultsTable($results) {
foreach($results as $grade => $result) {
include('content/resultsTable.php');
}
}
function totalClass($total) {
if ($total != 100) {
return 'wrongtotal';
} else {
return '';
}
}
}
?>