示例#1
0
 /**
  * Marshall a BaseValue object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A BaseValue object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'baseType', BaseType::getNameByConstant($component->getBaseType()));
     self::setDOMElementValue($element, $component->getValue());
     return $element;
 }
 /**
  * Marshall a Weight object into a DOMElement object.
  * 
  * @param QtiComponent $component A Weight object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'value', $component->getValue());
     return $element;
 }
示例#3
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;
 }
示例#4
0
 /**
  * Marshall a Value object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A Value object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     $fieldIdentifer = $component->getFieldIdentifier();
     $baseType = $component->getBaseType();
     self::setDOMElementValue($element, $component->getValue());
     if (!empty($fieldIdentifer)) {
         static::setDOMElementAttribute($element, 'fieldIdentifier', $fieldIdentifer);
     }
     if ($component->isPartOfRecord() && $baseType >= 0) {
         static::setDOMElementAttribute($element, 'baseType', BaseType::getNameByConstant($baseType));
     }
     return $element;
 }