Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable metadata for apip export #2593

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions model/Export/QTIPackedItemExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,14 @@ public function exportManifest($options = [], $exportResult = [])
}

$manifest = $this->getManifest();
$this->getMetadataExporter()->export($this->getItem(), $manifest);
$this->injectMetadataToManifest($manifest, $this->getItem());
$this->setManifest($manifest);
$isApip = isset($options['apip']) && $options['apip'] === true;
// APIP Package could not include metadata
if (!$isApip) {
$this->getMetadataExporter()->export($this->getItem(), $manifest);
$this->injectMetadataToManifest($manifest, $this->getItem());
}

$this->setManifest($manifest);

// -- Overwrite manifest in the current ZIP archive.
$zipArchive->addFromString('imsmanifest.xml', $this->getManifest()->saveXML());
Expand Down
7 changes: 4 additions & 3 deletions model/qti/templates/imsmanifestApip.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
*
*/

/* phpcs:disable Generic.Files.LineLength.TooLong */
?>
<manifest xmlns="http://www.imsglobal.org/xsd/apip/apipv1p0/imscp_v1p1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:lomm="http://ltsc.ieee.org/xsd/apipv1p0/LOM/manifest"
xsi:schemaLocation="http://ltsc.ieee.org/xsd/apipv1p0/LOM/resource http://www.imsglobal.org/profile/apip/apipv1p0/apipv1p0_lomresourcev1p0_v1p0.xsd http://ltsc.ieee.org/xsd/apipv1p0/LOM/manifest http://www.imsglobal.org/profile/apip/apipv1p0/apipv1p0_lommanifestv1p0_v1p0.xsd http://www.imsglobal.org/xsd/apip/apipv1p0/qtimetadata/imsqti_v2p1 http://www.imsglobal.org/profile/apip/apipv1p0/apipv1p0_qtimetadatav2p1_v1p0.xsd http://www.imsglobal.org/xsd/apip/apipv1p0/imscp_v1p1 http://www.imsglobal.org/profile/apip/apipv1p0/apipv1p0_imscpv1p2_v1p0.xsd"
xsi:schemaLocation="http://www.imsglobal.org/xsd/apip/apipv1p0/imscp_v1p1 http://www.imsglobal.org/profile/apip/apipv1p0/apipv1p0_imscpv1p2_v1p0.xsd"
identifier="<?php echo $manifestIdentifier; ?>">
<metadata>
<schema>APIP Package</schema>
Expand All @@ -33,12 +34,12 @@
<organizations/>
<resources>
<?php foreach ($qtiItems as $qtiItem) : ?>
<resource identifier="<?php echo $qtiItem['identifier']; ?>" type="imsqti_apipitem_xmlv2p1" href="<?php echo str_replace(DIRECTORY_SEPARATOR, '/', $qtiItem['filePath']); ?>">
<resource identifier="<?php echo $qtiItem['identifier']; ?>" type="imsqti_apipitem_xmlv2p2" href="<?php echo str_replace(DIRECTORY_SEPARATOR, '/', $qtiItem['filePath']); ?>">
<file href="<?php echo str_replace(DIRECTORY_SEPARATOR, '/', $qtiItem['filePath']);?>"/>
<?php foreach ($qtiItem['medias'] as $media) :?>
<file href="<?php echo str_replace(DIRECTORY_SEPARATOR, '/', $media);?>"/>
<?php endforeach ?>
</resource>
<?php endforeach ?>
</resources>
</manifest>
</manifest>
Loading