Skip to content

Commit

Permalink
Refactor course_settings/module_meta.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Jan 15, 2024
1 parent e8a8deb commit 43302c4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Util/CC.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,32 @@ function zip_add_topic_to_module($zip, $module, $title, $text) {
}
}

/** Add the course_settings/module_meta.xml to the manifest and ZIP
*
* <resource identifier="g5d51089383699fa7bcf3f5c9b81c857d"
* type="associatedcontent/imscc_xmlv1p1/learning-application-resource"
* href="course_settings/canvas_export.txt">
*/
function zip_add_canvas_module_meta($zip) {

$zip->addFromString('course_settings/canvas_export.txt',"Q: What did the panda say when he was forced out of his natural habitat?\nA: This is un-BEAR-able\n");

$xpath = new \DOMXpath($this);

$resources = $xpath->query(CC::resource_xpath)->item(0);
$new_resource = $this->add_child_ns(CC::CC_1_1_CP, $resources, 'resource', null,
array(
'identifier' => "g5d51089383699fa7bcf3f5c9b81c857d",
"type" => "associatedcontent/imscc_xmlv1p1/learning-application-resource",
"href" => "course_settings/canvas_export.txt"
)
);

$new_file = $this->add_child_ns(CC::CC_1_1_CP, $new_resource, 'file', null, array("href" => "course_settings/canvas_export.txt"));
$new_file = $this->add_child_ns(CC::CC_1_1_CP, $new_resource, 'file', null, array("href" => "course_settings/module_meta.xml"));

$meta = $this->canvas_module_meta->prettyXML();
$file = 'course_settings/module_meta.xml';
$zip->addFromString($file,$meta);
}
}

0 comments on commit 43302c4

Please sign in to comment.