Marshall an AssessmentItem object into a DOMElement object.

@param \qtism\data\QtiComponent $component An AssessmentItem object.
@return \DOMElement The according DOMElement object.
346592
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
        $this->setDOMElementAttribute($element, 'title', $component->getTitle());
        $this->setDOMElementAttribute($element, 'timeDependent', $component->isTimeDependent());
        $this->setDOMElementAttribute($element, 'adaptive', $component->isAdaptive());

        if ($component->hasLang() === true) {
            $this->setDOMElementAttribute($element, 'lang', $component->getLang());
        }

        if ($component->hasLabel() === true) {
            $this->setDOMElementAttribute($element, 'label', $component->getLabel());
        }

        if ($component->hasToolName() === true) {
            $this->setDOMElementAttribute($element, 'toolName', $component->getToolName());
        }

        if ($component->hasToolVersion() === true) {
            $this->setDOMElementAttribute($element, 'toolVersion', $component->getToolVersion());
        }

        foreach ($component->getResponseDeclarations() as $responseDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($responseDeclaration);
            $element->appendChild($marshaller->marshall($responseDeclaration));
        }

        foreach ($component->getOutcomeDeclarations() as $outcomeDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeDeclaration);
            $element->appendChild($marshaller->marshall($outcomeDeclaration));
        }

        foreach ($component->getTemplateDeclarations() as $templateDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($templateDeclaration);
            $element->appendChild($marshaller->marshall($templateDeclaration));
        }

        if ($component->hasTemplateProcessing() === true) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTemplateProcessing());
            $element->appendChild($marshaller->marshall($component->getTemplateProcessing()));
        }

        foreach ($component->getStylesheets() as $stylesheet) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($stylesheet);
            $element->appendChild($marshaller->marshall($stylesheet));
        }

        if ($component->hasItemBody() === true) {
            $itemBody = $component->getItemBody();
            $marshaller = $this->getMarshallerFactory()->createMarshaller($itemBody);
            $element->appendChild($marshaller->marshall($itemBody));
        }

        if ($component->hasResponseProcessing() === true) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getResponseProcessing());
            $element->appendChild($marshaller->marshall($component->getResponseProcessing()));
        }

        foreach ($component->getModalFeedbacks() as $modalFeedback) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($modalFeedback);
            $element->appendChild($marshaller->marshall($modalFeedback));
        }

        return $element;
    }
27871
public static function fromComponent(IColumnComponent $component) : ChartAxis
    {
        return new self($component->getName(), $component->getLabel(), [$component]);
    }
1374251
public function add(HtmlComponent $component)
    {
        if (isset($this->components[$component->id])) {
            throw new ZE(sprintf(ERROR_COMPONENT_ALREADY_EXISTS, $component->id, $this->id));
        }
        if (property_exists($this, $component->id)) {
            $id = strlen($this->id) > 0 ? $this->id : get_class($this);
            throw new ZE(sprintf(ERROR_COMPONENT_AS_PROPERTY, $component->id, $id));
        }

        $this->components[$component->id] = $component;
        $component->setOwner($this);
        $component->onAdded();
        return $component;
    }
351075
private function update_component( ValueComponentInterface $component )
    {
        $component->value = $this->final_instance[$component->name];
        
        // Skip if this field is disabled
        if( $this->is_disabled($component) )
        {
            return;
        }

        // Apply user-defined filter
        $this->filter( $component );
        
        // Validate value
        $this->validate( $component );
    }
7756
protected function addComponent($component, $value)
    {
        $this->validateComponentExists($component);

        // We need to make sure the value we're given isn't empty before adding it into our components.
        if (! empty($value)) {
            $this->components[$component][] = $value;
        }
    }
154027
protected function marshall(QtiComponent $component)
    {
        $element = self::getDOMCradle()->createElement($component->getQtiClassName());

        if ($component->hasTemplate() === true) {
            $this->setDOMElementAttribute($element, 'template', $component->getTemplate());
        }

        if ($component->hasTemplateLocation() === true) {
            $this->setDOMElementAttribute($element, 'templateLocation', $component->getTemplateLocation());
        }

        foreach ($component->getResponseRules() as $responseRule) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($responseRule);
            $element->appendChild($marshaller->marshall($responseRule));
        }

        return $element;
    }
31318
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'shape', QtiShape::getNameByConstant($component->getShape()));
        $this->setDOMElementAttribute($element, 'coords', $component->getCoords());
        $this->setDOMElementAttribute($element, 'mappedValue', $component->getMappedValue());

        return $element;
    }
263127
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());
        $this->setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
        
        foreach ($component->getShufflingGroups() as $shufflingGroup) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($shufflingGroup);
            $element->appendChild($marshaller->marshall($shufflingGroup));
        }

        return $element;
    }
52262
public function callComponent($componentName)
    {
        if (!isset($this->components[$componentName])) {
            $requiredInterface = isset(static::$defaultComponents[$componentName][1])
                ? static::$defaultComponents[$componentName][1]
                : null;
            $componentConfig = isset(static::$defaultComponents[$componentName][2])
                ? static::$defaultComponents[$componentName][2]
                : [];
            if (isset($this->config['components'][$componentName])){
                $componentConfig = array_merge($componentConfig, $this->config['components'][$componentName]);
            }
            if (isset($componentConfig['class'])) {
                $componentClassName = $componentConfig['class'];
            } else {
                $componentClassName = isset(static::$defaultComponents[$componentName][0])
                    ? static::$defaultComponents[$componentName][0]
                    : null;
            }
            unset($this->config['components'][$componentName]);
            if (isset($componentConfig['class']))
            unset($componentConfig['class']);
            if ($componentClassName) {
                $instance = new $componentClassName($componentConfig, $this);
                if (null === $requiredInterface || ($instance instanceof $requiredInterface)) {
                    $this->components[$componentName] = $instance;
                } else {
                    throw new InvalidInterfaceException([$componentName, $componentClassName, $requiredInterface]);
                }
            } else {
                throw new UnknownComponentException($componentName);
            }
        }
        return $this->components[$componentName];
    }
1241366
public function allowComponent($role, $componentClass, $privilege = null)
    {
        if ($privilege) throw new Kwf_Exception("Not yet implemented");
        if (!is_null($role)) $role = $this->_roleRegistry->get($role);
        $rules =& $this->_getRules('Component', $componentClass, $role, true);
        $rules['type'] = Kwf_Acl::TYPE_ALLOW;
        return $this;
    }
984448
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'mapKey', $component->getMapKey());
        $this->setDOMElementAttribute($element, 'mappedValue', $component->getMappedValue());
        
        if (Version::compare($this->getVersion(), '2.0.0', '>') === true) {
            $this->setDOMElementAttribute($element, 'caseSensitive', $component->isCaseSensitive());
        }

        return $element;
    }
554148
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());

        $expr = $component->getExpression();
        $exprMarshaller = $this->getMarshallerFactory()->createMarshaller($expr);
        $exprElt = $exprMarshaller->marshall($expr);

        $element->appendChild($exprElt);

        return $element;
    }
422723
protected function marshall(QtiComponent $component)
    {
        $element = self::getDOMCradle()->createElement('param');
        $this->setDOMElementAttribute($element, 'name', $component->getName());
        $this->setDOMElementAttribute($element, 'value', $component->getValue());
        $this->setDOMElementAttribute($element, 'valuetype', ParamType::getNameByConstant($component->getValueType()));

        if ($component->hasType() === true) {
            $this->setDOMElementAttribute($element, 'type', $component->getType());
        }

        return $element;
    }
654005
protected function appendElement(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
    {
        $tagName = ($this->hasReplacementTagName() === true) ? $this->getReplacementTagName() : $component->getQtiClassName();
        $fragment->appendChild($this->getRenderingEngine()->getDocument()->createElement($tagName));
    }
1230780
protected function marshall(QtiComponent $component)
    {
        $element = parent::marshall($component);

        foreach ($component->getResponseDeclarations() as $responseDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($responseDeclaration);
            $element->appendChild($marshaller->marshall($responseDeclaration));
        }

        foreach ($component->getOutcomeDeclarations() as $outcomeDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeDeclaration);
            $element->appendChild($marshaller->marshall($outcomeDeclaration));
        }
        
        foreach ($component->getTemplateDeclarations() as $templateDeclaration) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($templateDeclaration);
            $element->appendChild($marshaller->marshall($templateDeclaration));
        }
        
        if ($component->hasTemplateProcessing() === true) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTemplateProcessing());
            $templProcElt = $marshaller->marshall($component->getTemplateProcessing());
            $element->appendChild($templProcElt);
        }
        
        if ($component->hasResponseProcessing() === true) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getResponseProcessing());
            $respProcElt = $marshaller->marshall($component->getResponseProcessing());
            $element->appendChild($respProcElt);
        }
        
        foreach ($component->getModalFeedbackRules() as $modalFeedbackRule) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($modalFeedbackRule);
            $element->appendChild($marshaller->marshall($modalFeedbackRule));
        }
        
        foreach ($component->getShufflings() as $shuffling) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($shuffling);
            $element->appendChild($marshaller->marshall($shuffling));
        }
        
        foreach ($component->getResponseValidityConstraints() as $responseValidityConstraint) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($responseValidityConstraint);
            $element->appendChild($marshaller->marshall($responseValidityConstraint));
        }
        
        $this->setDOMElementAttribute($element, 'adaptive', $component->isAdaptive());
        $this->setDOMElementAttribute($element, 'timeDependent', $component->isTimeDependent());
        
        $endAttemptIdentifiers = $component->getEndAttemptIdentifiers();
        if (count($endAttemptIdentifiers) > 0) {
            $this->setDOMElementAttribute($element, 'endAttemptIdentifiers', implode("\x20", $endAttemptIdentifiers->getArrayCopy()));
        }

        return $element;
    }
833943
protected function marshall(QtiComponent $component)
    {
        $element = static::getDOMCradle()->createElement($component->getQtiClassName());

        $this->setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
        $this->setDOMElementAttribute($element, 'required', $component->isRequired());
        $this->setDOMElementAttribute($element, 'fixed', $component->isFixed());

        foreach ($component->getPreConditions() as $preCondition) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($preCondition);
            $element->appendChild($marshaller->marshall($preCondition));
        }

        foreach ($component->getBranchRules() as $branchRule) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($branchRule);
            $element->appendChild($marshaller->marshall($branchRule));
        }

        if ($component->getItemSessionControl() != null) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getItemSessionControl());
            $element->appendChild($marshaller->marshall($component->getItemSessionControl()));
        }

        if ($component->getTimeLimits() != null) {
            $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTimeLimits());
            $element->appendChild($marshaller->marshall($component->getTimeLimits()));
        }

        return $element;
    }
511327
protected function identifierMatches(QtiComponent $component)
    {
        $variableIdentifier = ($component instanceof FeedbackElement || $component instanceof ModalFeedback) ? $component->getOutcomeIdentifier() : $component->getTemplateIdentifier();
        $identifier = new QtiIdentifier($component->getIdentifier());
        $showHide = $component->getShowHide();
        $state = $this->getState();
        
        $matches = false;
        
        if (($val = $state[$variableIdentifier]) !== null) {
            if ($val instanceof QtiScalar) {
                $matches = $val->equals($identifier);
            } elseif ($val instanceof Container) {
                $matches = $val->contains($identifier);
            }
        }
        
        return $matches;
    }