function opigno_scorm_extract_manifest_resources in Opigno 7
Extract the manifest SCO resources.
We only extract resource information that is relevant to us. We don't care about references files, dependencies, etc. Only about the href attribute, type and identifier.
Parameters
array $manifest:
Return value
array
1 call to opigno_scorm_extract_manifest_resources()
- opigno_scorm_extract_manifest_data in modules/
scorm/ includes/ opigno_scorm.manifest.inc - Extract the manifest data.
File
- modules/
scorm/ includes/ opigno_scorm.manifest.inc, line 495 - Manifest file extraction logic.
Code
function opigno_scorm_extract_manifest_resources($manifest) {
$items = array();
foreach ($manifest['children'] as $child) {
if ($child['name'] == OPIGNO_SCORM_MANIFEST_RESOURCES) {
foreach ($child['children'] as $resource) {
if ($resource['name'] == OPIGNO_SCORM_MANIFEST_RESOURCE) {
if (!empty($resource['attrs'][OPIGNO_SCORM_MANIFEST_ID_ATTR])) {
$identifier = $resource['attrs'][OPIGNO_SCORM_MANIFEST_ID_ATTR];
}
else {
$identifier = uniqid();
}
if (!empty($resource['attrs'][OPIGNO_SCORM_MANIFEST_HREF_ATTR])) {
$href = $resource['attrs'][OPIGNO_SCORM_MANIFEST_HREF_ATTR];
}
else {
$href = '';
}
if (!empty($resource['attrs'][OPIGNO_SCORM_MANIFEST_TYPE_ATTR])) {
$type = $resource['attrs'][OPIGNO_SCORM_MANIFEST_TYPE_ATTR];
}
else {
$type = '';
}
if (!empty($resource['attrs'][OPIGNO_SCORM_MANIFEST_SCORM_TYPE_ATTR])) {
$scorm_type = $resource['attrs'][OPIGNO_SCORM_MANIFEST_SCORM_TYPE_ATTR];
}
else {
$scorm_type = '';
}
$items[] = array(
'identifier' => $identifier,
'href' => $href,
'type' => $type,
'scorm_type' => $scorm_type,
);
}
}
}
}
return $items;
}