Exemplo n.º 1
0
 /**
  * Unmarshall a StatsOperator object into a QTI statsOperator element.
  *
  * @param \qtism\data\QtiComponent $component The StatsOperator object to marshall.
  * @param array $elements An array of child DOMEelement objects.
  * @return \DOMElement The marshalled QTI statsOperator element.
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'name', Statistics::getNameByConstant($component->getName()));
     foreach ($elements as $elt) {
         $element->appendChild($elt);
     }
     return $element;
 }
Exemplo n.º 2
0
 /**
  * Marshall a Param object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A Param object.
  * @return \DOMElement The according DOMElement object.
  * @throws \qtism\data\storage\xml\marshalling\MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement('param');
     self::setDOMElementAttribute($element, 'name', $component->getName());
     self::setDOMElementAttribute($element, 'value', $component->getValue());
     self::setDOMElementAttribute($element, 'valuetype', ParamType::getNameByConstant($component->getValueType()));
     if ($component->hasType() === true) {
         self::setDOMElementAttribute($element, 'type', $component->getType());
     }
     return $element;
 }
Exemplo n.º 3
0
 /**
  * Marshall a MathConstant object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A MathConstant object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'name', MathEnumeration::getNameByConstant($component->getName()));
     return $element;
 }