งานของฉัน

รายการงานที่ได้รับมอบหมายทั้งหมด

prepare("SELECT *, DATEDIFF(due_date, CURDATE()) as days_left FROM assignments WHERE student_id = ? ORDER BY id DESC"); $stmt->execute([$user_id]); $index = 1; while ($row = $stmt->fetch()): // Get all assigned students for this specific task $stmt_group = $pdo->prepare("SELECT u.name FROM assignments a JOIN users u ON a.student_id = u.id WHERE a.title = ? AND a.due_date = ?"); $stmt_group->execute([$row['title'], $row['due_date']]); $assigned_names = $stmt_group->fetchAll(PDO::FETCH_COLUMN); $assigned_list = implode(', ', $assigned_names); // Format Created At $created_timestamp = strtotime($row['created_at']); $created_date_th = date('d-m-', $created_timestamp) . (date('Y', $created_timestamp) + 543); // Format Due Date $due_timestamp = strtotime($row['due_date']); $due_date_th = date('d-m-', $due_timestamp) . (date('Y', $due_timestamp) + 543); $due_html = "{$due_date_th}"; $status_text = "รอดำเนินการ"; if ($row['status'] === 'pending') { if ($row['days_left'] < 0) { $due_html .= " เลยกำหนด " . abs($row['days_left']) . " วัน"; } elseif ($row['days_left'] <= $days_before) { $due_html .= " เหลือ {$row['days_left']} วัน"; } else { $due_html .= " เหลือ {$row['days_left']} วัน"; } } else { $status_text = "เสร็จสิ้น"; } ?>
ลำดับ ชื่องาน/ชื่อวิชา รายละเอียด วันที่เพิ่มข้อมูล กำหนดส่ง สถานะ
เสร็จสิ้น รอดำเนินการ