protected function on_create(DOMDocument &$doc, $rootmanifestnode = null, $nmanifestID = null)
 {
     $doc->formatOutput = true;
     $doc->preserveWhiteSpace = true;
     $this->manifestID = is_null($nmanifestID) ? cc_helpers::uuidgen('M_') : $nmanifestID;
     $mUUID = $doc->createAttribute('identifier');
     $mUUID->nodeValue = $this->manifestID;
     if (is_null($rootmanifestnode)) {
         if (!empty($this->_generator)) {
             $comment = $doc->createComment($this->_generator);
             $doc->appendChild($comment);
         }
         $rootel = $doc->createElementNS($this->ccnamespaces['imscc'], 'manifest');
         $rootel->appendChild($mUUID);
         $doc->appendChild($rootel);
         //add all namespaces
         foreach ($this->ccnamespaces as $key => $value) {
             if ($key != 'lom') {
                 $dummy_attr = $key . ":dummy";
                 $doc->createAttributeNS($value, $dummy_attr);
             }
         }
         // add location of schemas
         $schemaLocation = '';
         foreach ($this->ccnsnames as $key => $value) {
             $vt = empty($schemaLocation) ? '' : ' ';
             $schemaLocation .= $vt . $this->ccnamespaces[$key] . ' ' . $value;
         }
         $aSchemaLoc = $doc->createAttributeNS($this->ccnamespaces['xsi'], 'xsi:schemaLocation');
         $aSchemaLoc->nodeValue = $schemaLocation;
         $rootel->appendChild($aSchemaLoc);
     } else {
         $rootel = $doc->createElementNS($this->ccnamespaces['imscc'], 'imscc:manifest');
         $rootel->appendChild($mUUID);
     }
     $metadata = $doc->createElementNS($this->ccnamespaces['imscc'], 'metadata');
     $schema = $doc->createElementNS($this->ccnamespaces['imscc'], 'schema', 'IMS Common Cartridge');
     $schemaversion = $doc->createElementNS($this->ccnamespaces['imscc'], 'schemaversion', $this->ccversion);
     $metadata->appendChild($schema);
     $metadata->appendChild($schemaversion);
     $rootel->appendChild($metadata);
     if (!is_null($rootmanifestnode)) {
         $rootmanifestnode->appendChild($rootel);
     }
     $organizations = $doc->createElementNS($this->ccnamespaces['imscc'], 'organizations');
     $rootel->appendChild($organizations);
     $resources = $doc->createElementNS($this->ccnamespaces['imscc'], 'resources');
     $rootel->appendChild($resources);
     return true;
 }
Example #2
0
 public function init_empty_new()
 {
     $this->identifier = cc_helpers::uuidgen('I_', '_R');
     $this->type = null;
     $this->href = null;
     $this->persiststate = null;
     $this->filename = null;
     $this->isempty = false;
     $this->identifierref = null;
 }
Example #3
0
 protected function on_save()
 {
     $rns = $this->ccnamespaces[$this->rootns];
     //root assesment element - required
     $assessment = $this->append_new_element_ns($this->root, $rns, cc_qti_tags::assessment);
     $this->append_new_attribute_ns($assessment, $rns, cc_qti_tags::ident, cc_helpers::uuidgen('QDB_'));
     $this->append_new_attribute_ns($assessment, $rns, cc_qti_tags::title, $this->assessment_title);
     //metadata - optional
     if (!empty($this->metadata)) {
         $this->metadata->generate($this, $assessment, $rns);
     }
     //rubric - optional
     if (!empty($this->rubric)) {
         $this->rubric->generate($this, $assessment, $rns);
     }
     //presentation_material - optional
     if (!empty($this->presentation_material)) {
         $this->presentation_material->generate($this, $assessment, $rns);
     }
     //section - required
     if (!empty($this->section)) {
         $this->section->generate($this, $assessment, $rns);
     }
     return true;
 }
Example #4
0
 public function init_new_item()
 {
     $this->identifier = cc_helpers::uuidgen('I_');
     $this->isvisible = true;
     //default is true
     $this->title = null;
     $this->parameters = null;
     $this->childitems = null;
     $this->parentItem = null;
     $this->isempty = false;
 }