protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $fragment->firstChild->setAttribute('name', $component->getName());
     $fragment->firstChild->setAttribute('value', $component->getValue());
     $fragment->firstChild->setAttribute('valuetype', ParamType::getNameByConstant($component->getValueType()));
     if ($component->hasType() === true) {
         $fragment->firstChild->setAttribute('type', $component->hasType());
     }
 }
示例#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;
 }