-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
147 lines (140 loc) · 5.35 KB
/
index.php
File metadata and controls
147 lines (140 loc) · 5.35 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/*************************************************************************************************************************
START PAGE OF APPLICATION
- presents user with possibilities to start creating / editing tests
*************************************************************************************************************************/
//Page Variables:
$title = 'Home';
$header_text = 'E-Test Editor';
$section = 'index';
$action = 'index';
require_once $_SERVER['DOCUMENT_ROOT'] . '/e_tests/php_support/config.php';
$db_con = new Db_Connection();
$test_types = $db_con->selectEntries(false, 'test_types', array("order" => "type_label"));
$tests = $db_con->selectEntries(true, 'tests, test_types', array("where" => "tests.test_type_ID = test_types.type_ID", "order" => "tests.test_name"));
require_once INCLUDE_PATH . 'php_page_elements/page_header.php';
?>
<form name="select_test_form" id="select_test_form" action="<?php echo ROOT_PATH; ?>php_support/manage_tests.php" method="post">
<?php
if (isset($error) && $error) {
?>
<div class="notification">
<header>
Error
<div class="delete_notification_button font-color-4">X</div>
</header>
<section>
<div class="error_msg">
<?php echo $error_msg; ?>
</div>
</section>
</div>
<?php
} //if
else if (isset($deleted_successfully) && $deleted_successfully) {
?>
<div class="notification">
<header>
Success
<div class="delete_notification_button font-color-4">X</div>
</header>
<section>
<div>
The test has been deleted from the database.
</div>
</section>
</div>
<?php
} //if
?>
<header>
Create a new test ...
</header>
<section class="section_without_padding">
<div id="type_button_container">
<?php
foreach ($test_types as $type) {
?>
<button type="submit" name="test_type_button" class="test_type_button border-theme-color bg-color-4" value="<?php echo $type['type_string']; ?>">
<img class="test_type_icon" src="<?php echo ROOT_PATH . $type['type_icon']; ?>" alt="<?php echo $type['type_label']; ?> Icon" width="80px" height="80px"><br>
<div class="test_type_label"><?php echo $type['type_label']; ?></div>
</button>
<?php
} //foreach
?>
<button type="submit" name="test_type_button" class="test_type_button border-theme-color bg-color-4" value="new_idea" id="new_idea_button">
<img src="<?php echo ROOT_PATH; ?>images/contact_icon.png" alt="New Idea" width="80px" height="80px"><br>
<div class="test_type_label">Idea for new format?</div>
</button>
</div>
<?php
foreach ($test_types as $type) {
?>
<div class="test_type_description" id="description_<?php echo $type['type_string']?>">
<?php echo $type['type_description']; ?>
</div>
<?php
} //foreach
?>
<div class="test_type_description" id="description_new_idea">
You have a great idea for a new test format? This editor is built in a way that makes it easily expandable, so that new tests formats can be added at any time.
Click here to contact the author, and you might be able to find your dream format here soon.
</div>
</section>
<header>
... or work with an existing one:
</header>
<section>
<table id="select_test_table" size="10">
<thead id="select_test_tablehead"><tr>
<th class="header_cell sorted_up" id="test_name_header">Test Name<div id="sort_pic"> <img id="arrow_up" src="<?php echo ROOT_PATH; ?>images/arrow_up.png"></div></th>
<th class="header_cell" id="test_type_header">Type</th>
<th class="header_cell" id="test_creation_header">Creation Date</th>
</tr></thead>
<tbody id="test_row_container">
<?php
if (sizeof($tests) > 0) {
foreach ($tests as $test) {
?>
<tr class="test_row" data-test_id="<?php echo $test['test_ID']; ?>" data-type_string="<?php echo $test['type_string']; ?>">
<td class="test_name_column test_name"><?php echo $test['test_name']; ?></td>
<td class="test_type_column test_type"><?php echo $test['type_label']; ?></td>
<td class="test_creation_column test_creation_date"><?php echo explode(" ", $test['test_creation_date'])[0]; ?></td>
</tr>
<?php
} //foreach
} //if
else {
?>
<tr>
<td colspan="3"><em>No tests found in database. Add new tests using the buttons above.</em></td>
</tr>
<?php
} //else
?>
</tbody>
</table>
<div id="select_type_container">
Show ...<br>
<?php
foreach ($test_types as $type) {
?>
<input type="checkbox" class="test_type_checkbox" name="select_test_type[]" id="test_type_checkbox_<?php echo $type['type_string']; ?>" value="<?php echo $type['type_string']; ?>" checked>
<label for="test_type_checkbox_<?php echo $type['type_string']; ?>"><?php echo $type['type_label']; ?></label><br>
<?php
} //foreach
?>
</div>
<div id="button_container">
<input type="hidden" name="selected_test_id" id="selected_test_id" value="">
<input type="hidden" name="selected_type" id="selected_type" value="">
<input type="submit" class="submit_button" name="edit_test" id="edit_test" value="Edit Test" disabled>
<input type="submit" class="submit_button" name="view_test" id="view_test" value="View Test" disabled>
<input type="submit" class="submit_button" name="delete_test" id="delete_test" value="Delete Test" disabled>
<input type="submit" class="submit_button" name="run_test" id="run_test" value="Run Test" disabled>
</div>
</section>
</form>
<?php
include_once INCLUDE_PATH . 'php_page_elements/page_footer.php';
?>