-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdashboard.php
79 lines (72 loc) · 3.15 KB
/
dashboard.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
<?php
include_once './notices.php';
if ($notices) {
foreach ($notices as $notice) {
echo "<p>$notice</p>";
}
}
$test = new \Database\Test;
$user = isset($_GET['username']) ? $_GET['username'] : null;
$tests = $test->getUserTests($user);
?>
<?php include_once './head.php'; ?>
<!-- Portfolio Grid Section -->
<section class="full-height">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-push-2 text-center">
<?php if ($tests): ?>
<h2>Your Tests</h2>
<?php else: ?>
<?php if ($_GET['username']): ?>
<h2>No test exists for this user</h2>
<?php else: ?>
<h2>Please set username to see tests.</h2>
<?php endif; ?>
<?php endif; ?>
<hr class="star-primary">
<?php if ($tests): ?>
<table class="table table-hover table-striped text-left">
<thead>
<tr>
<th>Username</th>
<th>Test Name</th>
<th>URL</th>
<th>Number of Results</th>
<th>Results</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($tests as $test): ?>
<tr>
<td><?= $test->username ?></td>
<td><?= $test->test_name ?></td>
<td><?= $test->url ?></td>
<td><?= count($test->results) ?></td>
<td><a href="results.php?username=<?= $_GET['username'] ?>&test_id=<?= $test->test_id ?>">Results </a> </td>
<td>
<?php if ($test->is_started): ?>
<a href="abort_test.php?username=<?= $_GET['username'] ?>&test_id=<?= $test->test_id ?>"> Abort </a>
<?php else: ?>
Aborted
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<form class="form-inline" method="get" action="" style="margin-top: 20px;">
<div class="form-group">
<input type="text" name="username" value="<?= $_GET['username'] ?>" placeholder="Set Username..." class="form-control">
</div>
<div class="form-group">
<button class="btn btn-primary"> Update </button>
</div>
</form>
</div>
</div>
</div>
</section>
<?php include_once './footer.php'; ?>