/** * Marshall a TemplateProcessing object into a DOMElement object. * * @param \qtism\data\QtiComponent $component A TemplateProcessing object. * @return \DOMElement The according DOMElement object. * @throws \qtism\data\storage\xml\marshalling\MarshallingException */ protected function marshall(QtiComponent $component) { $element = self::getDOMCradle()->createElement('templateProcessing'); foreach ($component->getTemplateRules() as $templateRule) { $element->appendChild($this->getMarshallerFactory()->createMarshaller($templateRule)->marshall($templateRule)); } return $element; }
protected function getChildrenComponents(QtiComponent $component) { return $component->getTemplateRules()->getArrayCopy(); }
/** * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::getChildrenComponents() */ protected function getChildrenComponents(QtiComponent $component) { if ($component instanceof TemplateIf || $component instanceof TemplateElseIf || $component instanceof TemplateElse) { // TemplateControl return $component->getTemplateRules()->getArrayCopy(); } else { // TemplateCondition $returnValue = array($component->getTemplateIf()); if (count($component->getTemplateElseIfs()) > 0) { $returnValue = array_merge($returnValue, $component->getTemplateElseIfs()->getArrayCopy()); } if ($component->getTemplateElse() !== null) { $returnValue[] = $component->getTemplateElse(); } return $returnValue; } }