protected function marshall(QtiComponent $component)
    {
        $element = parent::marshall($component);
        $version = $this->getVersion();

        // deal with views.
        // !!! If $arrayViews contain all possible views, it means that the treated
        // !!! outcome is relevant to all views, as per QTI 2.1 spec.
        if (Version::compare($version, '2.1.0', '>=') === true && !in_array($component->getViews()->getArrayCopy(), View::asArray())) {
            $arrayViews = array();
            foreach ($component->getViews() as $view) {
                $arrayViews[] = View::getNameByConstant($view);
            }

            if (count($arrayViews) > 0) {
                $this->setDOMElementAttribute($element, 'view', implode("\x20", $arrayViews));
            }
        }

        // deal with interpretation.
        if ($component->getInterpretation() != '') {
            $this->setDOMElementAttribute($element, 'interpretation', $component->getInterpretation());
        }

        // deal with long interpretation.
        if ($component->getLongInterpretation() != '') {
            $this->setDOMElementAttribute($element, 'longInterpretation', $component->getLongInterpretation());
        }

        // Deal with normal maximum.
        if ($component->getNormalMaximum() !== false) {
            $this->setDOMElementAttribute($element, 'normalMaximum', $component->getNormalMaximum());
        }

        // Deal with normal minimum.
        if (Version::compare($version, '2.1.0', '>=') === true && $component->getNormalMinimum() !== false) {
            $this->setDOMElementAttribute($element, 'normalMinimum', $component->getNormalMinimum());
        }

        // Deal with mastery value.
        if (Version::compare($version, '2.1.0', '>=') === true && $component->getMasteryValue() !== false) {
            $this->setDOMElementAttribute($element, 'masteryValue', $component->getMasteryValue());
        }

        // Deal with lookup table.
        if ($component->getLookupTable() != null) {
            $lookupTableMarshaller = $this->getMarshallerFactory()->createMarshaller($component->getLookupTable(), array($component->getBaseType()));
            $element->appendChild($lookupTableMarshaller->marshall($component->geTLookupTable()));
        }

        return $element;
    }
protected function marshall(QtiComponent $component)
    {
        $element = parent::marshall($component);
        $version = $this->getVersion();

        // deal with views.
        // !!! If $arrayViews contain all possible views, it means that the treated
        // !!! outcome is relevant to all views, as per QTI 2.1 spec.
        if (Version::compare($version, '2.1.0', '>=') === true && !in_array($component->getViews()->getArrayCopy(), View::asArray())) {
            $arrayViews = array();
            foreach ($component->getViews() as $view) {
                $arrayViews[] = View::getNameByConstant($view);
            }

            if (count($arrayViews) > 0) {
                $this->setDOMElementAttribute($element, 'view', implode("\x20", $arrayViews));
            }
        }

        // deal with interpretation.
        if ($component->getInterpretation() != '') {
            $this->setDOMElementAttribute($element, 'interpretation', $component->getInterpretation());
        }

        // deal with long interpretation.
        if ($component->getLongInterpretation() != '') {
            $this->setDOMElementAttribute($element, 'longInterpretation', $component->getLongInterpretation());
        }

        // Deal with normal maximum.
        if ($component->getNormalMaximum() !== false) {
            $this->setDOMElementAttribute($element, 'normalMaximum', $component->getNormalMaximum());
        }

        // Deal with normal minimum.
        if (Version::compare($version, '2.1.0', '>=') === true && $component->getNormalMinimum() !== false) {
            $this->setDOMElementAttribute($element, 'normalMinimum', $component->getNormalMinimum());
        }

        // Deal with mastery value.
        if (Version::compare($version, '2.1.0', '>=') === true && $component->getMasteryValue() !== false) {
            $this->setDOMElementAttribute($element, 'masteryValue', $component->getMasteryValue());
        }

        // Deal with lookup table.
        if ($component->getLookupTable() != null) {
            $lookupTableMarshaller = $this->getMarshallerFactory()->createMarshaller($component->getLookupTable(), array($component->getBaseType()));
            $element->appendChild($lookupTableMarshaller->marshall($component->geTLookupTable()));
        }

        return $element;
    }
protected function marshall ( QtiComponent $ component ) { $ element = parent :: marshall ( $ component ) ; $ version = $ this -> getVersion ( ) ; // deal with views. // !!! If $arrayViews contain all possible views, it means that the treated // !!! outcome is relevant to all views, as per QTI 2.1 spec. if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && ! in_array ( $ component -> getViews ( ) -> getArrayCopy ( ) , View :: asArray ( ) ) ) { $ arrayViews = array ( ) ; foreach ( $ component -> getViews ( ) as $ view ) { $ arrayViews [ ] = View :: getNameByConstant ( $ view ) ; } if ( count ( $ arrayViews ) > 0 ) { $ this -> setDOMElementAttribute ( $ element , 'view' , implode ( "\x20" , $ arrayViews ) ) ; } } // deal with interpretation. if ( $ component -> getInterpretation ( ) != '' ) { $ this -> setDOMElementAttribute ( $ element , 'interpretation' , $ component -> getInterpretation ( ) ) ; } // deal with long interpretation. if ( $ component -> getLongInterpretation ( ) != '' ) { $ this -> setDOMElementAttribute ( $ element , 'longInterpretation' , $ component -> getLongInterpretation ( ) ) ; } // Deal with normal maximum. if ( $ component -> getNormalMaximum ( ) !== false ) { $ this -> setDOMElementAttribute ( $ element , 'normalMaximum' , $ component -> getNormalMaximum ( ) ) ; } // Deal with normal minimum. if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && $ component -> getNormalMinimum ( ) !== false ) { $ this -> setDOMElementAttribute ( $ element , 'normalMinimum' , $ component -> getNormalMinimum ( ) ) ; } // Deal with mastery value. if ( Version :: compare ( $ version , '2.1.0' , '>=' ) === true && $ component -> getMasteryValue ( ) !== false ) { $ this -> setDOMElementAttribute ( $ element , 'masteryValue' , $ component -> getMasteryValue ( ) ) ; } // Deal with lookup table. if ( $ component -> getLookupTable ( ) != null ) { $ lookupTableMarshaller = $ this -> getMarshallerFactory ( ) -> createMarshaller ( $ component -> getLookupTable ( ) , array ( $ component -> getBaseType ( ) ) ) ; $ element -> appendChild ( $ lookupTableMarshaller -> marshall ( $ component -> geTLookupTable ( ) ) ) ; } return $ element ; }
Marshall an OutcomeDeclaration object into a DOMElement object.

@param \qtism\data\QtiComponent $component An OutcomeDeclaration object.
@return \DOMElement The according DOMElement object.
Marshall an OutcomeDeclaration object into a DOMElement object .