-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_task_progress.php
More file actions
66 lines (63 loc) · 1.86 KB
/
update_task_progress.php
File metadata and controls
66 lines (63 loc) · 1.86 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'] !== 'Team Member') {
header('Location: login.php');
exit();
}
require 'db.php.inc';
try {
$stmt = $pdo->prepare("
SELECT t.task_id, t.task_name, t.progress, t.status, t.start_date, t.end_date
FROM tasks t
JOIN task_allocations ta ON t.task_id = ta.task_id
WHERE ta.user_id = :user_id
");
$stmt->execute([':user_id' => $_SESSION['user']['user_id']]);
$tasks = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Update Task Progress</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'header.php'; ?>
<main>
<h2>Update Task Progress</h2>
<?php include 'sidebar.php';?>
<?php if (!empty($tasks)): ?>
<table>
<thead>
<tr>
<th>Task ID</th>
<th>Task Name</th>
<th>Progress (%)</th>
<th>Status</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['progress'] ?>%</td>
<td><?= $task['status'] ?></td>
<td>
<a href="update_task.php?task_id=<?= $task['task_id'] ?>">Update</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>No tasks assigned to you yet.</p>
<?php endif; ?>
</main>
<?php include 'footer.php';?>
</body>
</html>