protected function marshall(QtiComponent $component) { $element = static::getDOMCradle()->createElement($component->getQtiClassName()); self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier()); self::setDOMElementAttribute($element, 'navigationMode', NavigationMode::getNameByConstant($component->getNavigationMode())); self::setDOMElementAttribute($element, 'submissionMode', SubmissionMode::getNameByConstant($component->getSubmissionMode())); foreach ($component->getPreConditions() as $preCondition) { $marshaller = $this->getMarshallerFactory()->createMarshaller($preCondition); $element->appendChild($marshaller->marshall($preCondition)); } foreach ($component->getBranchRules() as $branchRule) { $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRule); $element->appendChild($marshaller->marshall($branchRule)); } $itemSessionControl = $component->getItemSessionControl(); if (!empty($itemSessionControl)) { $marshaller = $this->getMarshallerFactory()->createMarshaller($itemSessionControl); $element->appendChild($marshaller->marshall($itemSessionControl)); } $timeLimits = $component->getTimeLimits(); if (!empty($timeLimits)) { $marshaller = $this->getMarshallerFactory()->createMarshaller($timeLimits); $element->appendChild($marshaller->marshall($timeLimits)); } foreach ($component->getAssessmentSections() as $assessmentSection) { $marshaller = $this->getMarshallerFactory()->createMarshaller($assessmentSection); $element->appendChild($marshaller->marshall($assessmentSection)); } foreach ($component->getTestFeedbacks() as $testFeedback) { $marshaller = $this->getMarshallerFactory()->createMarshaller($testFeedback); $element->appendChild($marshaller->marshall($testFeedback)); } return $element; }