-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassign_team_member.php
More file actions
66 lines (64 loc) · 2.16 KB
/
assign_team_member.php
File metadata and controls
66 lines (64 loc) · 2.16 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
<?php
session_start();
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] !== 'Project Leader') {
header('Location: login.php');
exit();
}
require 'db.php.inc';
try {
$stmt = $pdo->prepare("
SELECT t.task_id, t.task_name, t.start_date, t.status, t.priority
FROM tasks t
JOIN projects p ON t.project_id = p.project_id
WHERE p.team_leader_id = :team_leader_id
ORDER BY (SELECT COUNT(*) FROM task_allocations ta WHERE ta.task_id = t.task_id) ASC, t.start_date ASC
");
$stmt->execute([':team_leader_id' => $_SESSION['user']['user_id']]);
$tasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Assign Team Members</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'header.php'; ?>
<main>
<?php include 'sidebar.php'; ?>
<section>
<h2>Assign Team Members to Tasks</h2>
<table>
<thead>
<tr>
<th>Task ID</th>
<th>Task Name</th>
<th>Start Date</th>
<th>Status</th>
<th>Priority</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($tasks as $task): ?>
<tr>
<td><?= $task['task_id'] ?></td>
<td><?= $task['task_name'] ?></td>
<td><?= $task['start_date'] ?></td>
<td><?= $task['status'] ?></td>
<td><?= $task['priority'] ?></td>
<td><a href="allocate_member.php?task_id=<?= $task['task_id']?>">[Assign Team Members]</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
</main>
<?php include 'footer.php'; ?>
</body>
</html>