/
teacherHome.php
62 lines (57 loc) · 1.57 KB
/
teacherHome.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
<?php
// Only render this page if it's included in index.php, not accessed by URL
if(!defined('includeConst')) { die('Direct access not permitted'); } ?>
<body>
<main>
<?php include "header.inc"; ?>
<div class="half">
<form action="?action=newPost" method="post">
<label for="bulletin">Send Global Announcement</label>
<input type="text" name="content" id="bulletin" placeholder="Enter Announcement Here"/>
<input type="submit" value="Send"/>
</form>
<?php renderGroupPosts(getAllPosts($db), $db) ?>
</div>
<div class="half">
<?php
$query = ('SELECT * FROM groups WHERE tutor = :teacherId');
$statement = $db -> prepare($query);
$statement -> bindValue(':teacherId', $sessionId);
if (!$statement -> execute()) {
print_r($statement->errorInfo());
return false;
} else {
$result = $statement -> fetchAll(PDO::FETCH_ASSOC);
}
?>
<h2>Groups</h2>
<div class="scrollContainer">
<table>
<tr>
<th>Name</th>
<th>Preferred Project Type</th>
</tr>
<?php foreach ($result as $row) { ?>
<tr>
<td><?=$row['name']?></td>
<td><?=$row['projectType']?></td>
</tr>
<?php } ?>
</table>
</div>
<?php
$query = ('SELECT * FROM users');
$statement = $db -> prepare($query);
if (!$statement -> execute()) {
print_r($statement->errorInfo());
return false;
} else {
$result = $statement -> fetchAll(PDO::FETCH_ASSOC);
}
?>
</div>
</div>
<?php include 'footer.php' ?>
</main>
</body>
</html>