Update Saqel Platform: 2026-09-02 07:43:58
This commit is contained in:
@@ -211,6 +211,25 @@ class CurriculumService
|
||||
return $walk(self::getCurriculumTree());
|
||||
}
|
||||
|
||||
/** Resolve a manifest file path to its canonical lesson record. */
|
||||
public static function findLessonByFile(string $file): ?array
|
||||
{
|
||||
$walk = function ($node) use (&$walk, $file): ?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['file'] ?? '') === $file) 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