Commit cb7ac89b authored by William Paul Liggett's avatar William Paul Liggett

Built a web database to store the OV tests and they show up nicely in the admin page.

parent 77e6402c
......@@ -17,7 +17,7 @@
$error_msg = " "; // No error = Non-breaking space character.
// Used to display an HTML login form on first load or if the username and password was incorrect.
// Note: The tab whitespace is back slightly to make the HTML source pretty.
// Note: The tab whitespace is weird to make the HTML source pretty.
$login_form = '
<form action="admin" name="AdminLogin" method="post">
<label for="username">Username:</label>
......@@ -63,9 +63,56 @@
// Login successful!
else {
echo "Login successful!";
// Logs into the OpenVigilance Task tests database to control and alter user tests.
// `$pdo' is defined as the database connection.
require_once "../../../../protected_site_configs/junktext.com/openvigilance_db_connection.php";
// Test Control: Active tests.
$sql = "SELECT subject_id, test_condition, test_pin FROM test_control WHERE active=1 ORDER BY subject_id";
$statement = $pdo->prepare($sql);
$statement->execute();
$rows = $statement->fetchAll(); // Grabs all of the rows.
$num_rows = count($rows);
// Section heading.
echo '
<h2>Scheduled Tests</h2>';
if($num_rows > 0) {
// Sets up the <table> heading.
echo '
<table>
<thead>
<tr>
<th>Subject ID</th>
<th>Test Condition</th>
<th>Test PIN</th>
</tr>
</thead>
<tbody>';
// The rows of the <table>.
foreach($rows as $key => $value) {
echo '
<tr>
<td>' . $value["subject_id"] . '</td>
<td>' . $value["test_condition"] . '</td>
<td>' . $value["test_pin"] . '</td>
</tr>';
}
// Closes out the <table>
echo '
</tbody>
</table>' . PHP_EOL;
}
// There were no rows to display. More OV tests should be added.
else {
echo '<p class="center">There are no tests currently scheduled.</p>';
}
}
}
?>
</body>
......
......@@ -18,24 +18,41 @@
.version_info {
text-decoration: underline;
margin-top: 3.5rem;
margin-top: 2rem;
}
li {
margin-bottom: 1rem;
margin-bottom: 0.5rem;
}
</style>
</head>
<body>
<h1>OpenVigilance Task: Change Log</h1>
<h2>Programmer: William Paul Liggett (junktext@junktext.com)</h2>
<p><em>Total labor time: 17 hours.</em></p>
<p><em>Total labor time: 19.5 hours.</em></p>
<p class="version_info"><strong>To Do:</strong></p>
<ol>
<li>Admin Page: Capability to add, edit, and remove user tests.</li>
<li>Subject Login Page: Allow a test participant to login if they have a test scheduled.</li>
<li>Vigilance Tests: Record the activity of each subject during the test and save it as a CSV data file on the server.</li>
<li>Admin Page: Add a section to show the stored CSV files so that they can be downloaded or deleted at will.</li>
</ol>
<p class="version_info">Version 1.4.0 (2018-02-19):</p>
<p><em>Estimated labor time: 2.5 hours.</em></p>
<ul>
<li>Built a web database to store and manage the user tests.</li>
<li>Put mock tests in the database and have confirmed it is accurate for both when there are tests scheduled and when they are not.</li>
<li>Styled the table and the other layout elements so that everything is easy to understand.</li>
</ul>
<p class="version_info">Version 1.3.0 (2018-02-18):</p>
<p><em>Estimated labor time: 1.5 hours.</em></p>
<ul>
<li>Added an admin page. The login process works. The rest of the functionality will be incorporated later.</li>
<li>Made the admin login form look a bit nicer.</li>
</ul>
<p class="version_info">Version 1.2.0 (2018-02-16):</p>
......
......@@ -11,11 +11,22 @@
src: url("../media/fonts/qag2.003otf/texgyreadventor-bold.otf");
}
.center {
text-align: center;
}
h1 {
font-size: 14pt;
font-size: 20pt;
text-align: center;
}
h2 {
font-size: 16pt;
text-align: center;
text-decoration: underline;
margin-top: 2rem;
}
/* Background image container to have the random letter to be centered vertically. */
.container {
position: relative;
......@@ -104,4 +115,23 @@ form[name = "AdminLogin"] {
margin: auto;
display: block;
width: 16rem;
}
\ No newline at end of file
}
table {
border-collapse: collapse;
margin: auto;
}
tr:nth-child(even) {
background-color: #cfe2f3; /* Light blue. */
}
th {
padding-left: 2rem;
padding-right: 2rem;
}
td {
border: solid 1pt black;
text-align: center;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment