feat(ecosystem): full Grade 10 curriculum sync, real device fingerprinting, teacher video dashboard, and official textbook assets
This commit is contained in:
@@ -76,6 +76,72 @@ class VideoController
|
||||
} catch (\Throwable $e) { error_log('Version playback failed: '.$e->getMessage()); $response->status(503)->json(['status'=>'unavailable','message'=>'تعذر تجهيز تشغيل نسخة الفيديو.']); }
|
||||
}
|
||||
|
||||
/** GET /api/teacher/submissions */
|
||||
public function listTeacherSubmissions(Request $request, Response $response): void
|
||||
{
|
||||
$teacherId = (int)$request->user_id;
|
||||
try {
|
||||
$rows = Database::select(
|
||||
"SELECT ts.id AS submission_id, ts.uuid AS submission_uuid, ts.status AS submission_status,
|
||||
ts.current_published_video_version_id, ts.created_at, ts.updated_at,
|
||||
cl.id AS lesson_id, cl.uuid AS curriculum_lesson_uuid, cl.title AS lesson_title,
|
||||
cl.subject_key, cl.grade_level, cl.semester_key, cl.unit_key, cl.lesson_key,
|
||||
vv.id AS video_version_id, vv.uuid AS video_version_uuid, vv.version_number,
|
||||
vv.status AS video_status, vv.published_at, vv.created_at AS version_created_at
|
||||
FROM teacher_submissions ts
|
||||
JOIN curriculum_lessons cl ON cl.id = ts.curriculum_lesson_id
|
||||
LEFT JOIN video_versions vv ON vv.teacher_submission_id = ts.id
|
||||
WHERE ts.teacher_id = ?
|
||||
ORDER BY ts.updated_at DESC, vv.version_number DESC",
|
||||
[$teacherId]
|
||||
);
|
||||
|
||||
$submissions = [];
|
||||
foreach ($rows as $row) {
|
||||
$subId = (string)$row['submission_uuid'];
|
||||
if (!isset($submissions[$subId])) {
|
||||
$submissions[$subId] = [
|
||||
'submission_uuid' => $row['submission_uuid'],
|
||||
'submission_status' => $row['submission_status'],
|
||||
'lesson_title' => $row['lesson_title'],
|
||||
'subject_key' => $row['subject_key'],
|
||||
'grade_level' => $row['grade_level'],
|
||||
'semester_key' => $row['semester_key'],
|
||||
'unit_key' => $row['unit_key'],
|
||||
'lesson_key' => $row['lesson_key'],
|
||||
'created_at' => $row['created_at'],
|
||||
'updated_at' => $row['updated_at'],
|
||||
'versions' => [],
|
||||
];
|
||||
}
|
||||
if (!empty($row['video_version_uuid'])) {
|
||||
$submissions[$subId]['versions'][] = [
|
||||
'video_version_uuid' => $row['video_version_uuid'],
|
||||
'version_number' => (int)$row['version_number'],
|
||||
'video_status' => $row['video_status'],
|
||||
'is_current_published' => ($row['current_published_video_version_id'] == $row['video_version_id']),
|
||||
'published_at' => $row['published_at'],
|
||||
'created_at' => $row['version_created_at'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$response->json([
|
||||
'status' => 'success',
|
||||
'data' => [
|
||||
'submissions' => array_values($submissions),
|
||||
'total' => count($submissions),
|
||||
]
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('listTeacherSubmissions failed: ' . $e->getMessage());
|
||||
$response->status(500)->json([
|
||||
'status' => 'error',
|
||||
'message' => 'تعذر جلب قائمة الحصص المرفوعة للمعلم.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/** GET /api/curriculum/lessons/{lessonId}/videos?cursor=&limit= */
|
||||
public function listPublishedLessonVideos(Request $request, Response $response): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user