コード例 #1
0
 /**
  * Marshall an numberSelected QTI element in its NumberSelected object equivalent.
  * 
  * @param DOMElement A DOMElement object.
  * @return QtiComponent The corresponding NumberSelected object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     $object = new NumberSelected();
     $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
     $object->setIncludeCategories($baseComponent->getIncludeCategories());
     $object->setExcludeCategories($baseComponent->getExcludeCategories());
     return $object;
 }
コード例 #2
0
 /**
  * Marshall an numberCorrect QTI element in its NumberCorrect object equivalent.
  *
  * @param \DOMElement $element A DOMElement object.
  * @return \qtism\data\QtiComponent The corresponding NumberCorrect object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     // Please PHP core development team, give us real method overloading !!! :'(
     $object = new NumberCorrect();
     $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
     $object->setIncludeCategories($baseComponent->getIncludeCategories());
     $object->setExcludeCategories($baseComponent->getExcludeCategories());
     return $object;
 }
コード例 #3
0
 /**
  * Marshall an outcomeMaximum QTI element in its OutcomeMaximum object equivalent.
  *
  * @param \DOMElement A DOMElement object.
  * @return \qtism\data\QtiComponent The corresponding OutcomeMaximum object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     if (($outcomeIdentifier = static::getDOMElementAttributeAs($element, 'outcomeIdentifier')) !== null) {
         $object = new OutcomeMaximum($outcomeIdentifier);
         $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
         $object->setIncludeCategories($baseComponent->getIncludeCategories());
         $object->setExcludeCategories($baseComponent->getExcludeCategories());
         if (($weightIdentifier = static::getDOMElementAttributeAs($element, 'weightIdentifier')) !== null) {
             $object->setWeightIdentifier($weightIdentifier);
         }
         return $object;
     } else {
         $msg = "The mandatory attribute 'outcomeIdentifier' is missing from element '" . $element->localName . "'.";
         throw new UnmarshallingException($msg, $element);
     }
 }
コード例 #4
0
 /**
  * Marshall a testVariable QTI element in its TestVariable object equivalent.
  *
  * @param \DOMElement A DOMElement object.
  * @return \qtism\data\QtiComponent The corresponding TestVariable object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     if (($variableIdentifier = static::getDOMElementAttributeAs($element, 'variableIdentifier')) !== null) {
         $object = new TestVariables($variableIdentifier);
         $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
         $object->setIncludeCategories($baseComponent->getIncludeCategories());
         $object->setExcludeCategories($baseComponent->getExcludeCategories());
         if (($baseType = static::getDOMElementAttributeAs($element, 'baseType')) !== null) {
             $object->setBaseType(BaseType::getConstantByName($baseType));
         }
         if (($weightIdentifier = static::getDOMElementAttributeAs($element, 'weightIdentifier')) !== null) {
             $object->setWeightIdentifier($weightIdentifier);
         }
         return $object;
     } else {
         $msg = "The mandatory attribute 'variableIdentifier' is missing from element '" . $element->localName . "'.";
         throw new UnmarshallingException($msg, $element);
     }
 }