/**
  * Marshall an OutcomeProcessing object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component An OutcomeProcessing object.
  * @return \DOMElement The according DOMElement object.
  * @throws \qtism\data\storage\xml\marshalling\MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     foreach ($component->getOutcomeRules() as $outcomeRule) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeRule);
         $element->appendChild($marshaller->marshall($outcomeRule));
     }
     return $element;
 }
 protected function getChildrenComponents(QtiComponent $component)
 {
     if ($component instanceof OutcomeIf || $component instanceof OutcomeElseIf || $component instanceof OutcomeElse) {
         // OutcomeControl
         return $component->getOutcomeRules()->getArrayCopy();
     } else {
         // OutcomeCondition
         $returnValue = array($component->getOutcomeIf());
         if (count($component->getOutcomeElseIfs()) > 0) {
             $returnValue = array_merge($returnValue, $component->getOutcomeElseIfs()->getArrayCopy());
         }
         if ($component->getOutcomeElse() !== null) {
             $returnValue[] = $component->getOutcomeElse();
         }
         return $returnValue;
     }
 }
Exemplo n.º 3
0
 /**
  * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::getChildrenComponents()
  */
 protected function getChildrenComponents(QtiComponent $component)
 {
     return $component->getOutcomeRules()->getArrayCopy();
 }