Update Saqel Platform: 2026-09-02 01:23:51
This commit is contained in:
@@ -192,6 +192,25 @@ class CurriculumService
|
||||
return [];
|
||||
}
|
||||
|
||||
/** Resolve a manifest lesson slug to its canonical title/file. */
|
||||
public static function findLessonById(string $lessonId): ?array
|
||||
{
|
||||
$walk = function ($node) use (&$walk, $lessonId): ?array {
|
||||
if (!is_array($node)) return null;
|
||||
if (isset($node['lessons']) && is_array($node['lessons'])) {
|
||||
foreach ($node['lessons'] as $lesson) {
|
||||
if (is_array($lesson) && (string)($lesson['id'] ?? '') === $lessonId) return $lesson;
|
||||
}
|
||||
}
|
||||
foreach ($node as $value) {
|
||||
$found = $walk($value);
|
||||
if ($found !== null) return $found;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
return $walk(self::getCurriculumTree());
|
||||
}
|
||||
|
||||
/**
|
||||
* Save/Update Complete Curriculum Tree Manifest
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user