Skip to content

Commit

Permalink
Fix little bug that does not allow item references to be added
Browse files Browse the repository at this point in the history
  • Loading branch information
stellalie committed Nov 18, 2015
1 parent 16e07e4 commit 23d1299
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Processors/IMSCP/Out/ManifestWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,22 @@ public function convert(Manifest $manifest, array $rules = []) {
}
}

// Build item reference and item tags JSON
$itemReferences = [];
$itemsTags = [];
$resources = $manifest->getResources();


// Build item reference and item tags JSON
$organisations = $manifest->getOrganizations();
// Prioritise `organisation` element to built `items`, if does not exist then can go for `resources`
if (!empty($organisations)) {
foreach ($organisations as $organisation) {
foreach ($organisation->getItems() as $item) {
$itemReferences[] = $item->getIdentifier();
}
}
} else if (!empty($resource)) {
}
// Build item reference and item tags JSON
$resources = $manifest->getResources();
if (!empty($resources)) {
foreach ($resources as $resource) {
// Just add `item` resource as items, and leave css and any other resources alone
if (StringUtil::startsWith($resource->getType(), 'imsqti_item')) {
Expand All @@ -65,12 +68,11 @@ public function convert(Manifest $manifest, array $rules = []) {
}
}


// Build activity JSON
$activity = [
'reference' => $activityReference,
'data' => [
'items' => $itemReferences
'items' => array_values(array_unique($itemReferences)) // Just mash them up together
],
'status' => 'published'
];
Expand Down

0 comments on commit 23d1299

Please sign in to comment.