当前位置: 首页>>代码示例>>PHP>>正文


PHP data\QtiComponent类代码示例

本文整理汇总了PHP中qtism\data\QtiComponent的典型用法代码示例。如果您正苦于以下问题:PHP QtiComponent类的具体用法?PHP QtiComponent怎么用?PHP QtiComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QtiComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: marshallChildrenKnown

 /**
  * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::marshallChildrenKnown()
  */
 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $version = $this->getVersion();
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     $this->fillElement($element, $component);
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'matchMax', $component->getMatchMax());
     if ($component->isFixed() === true) {
         self::setDOMElementAttribute($element, 'fixed', true);
     }
     if ($component->hasTemplateIdentifier() === true && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'templateIdentifier', $component->getTemplateIdentifier());
     }
     if ($component->getShowHide() !== ShowHide::SHOW && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'showHide', ShowHide::getNameByConstant(ShowHide::HIDE));
     }
     if ($component->getMatchMin() !== 0 && Version::compare($version, '2.1.0', '>=') === true) {
         self::setDOMElementAttribute($element, 'matchMin', $component->getMatchMin());
     }
     if (Version::compare($version, '2.1.0', '<') === true) {
         $matchGroup = $component->getMatchGroup();
         if (count($matchGroup) > 0) {
             self::setDOMElementAttribute($element, 'matchGroup', implode(' ', $matchGroup->getArrayCopy()));
         }
     }
     foreach ($elements as $e) {
         $element->appendChild($e);
     }
     return $element;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:33,代码来源:SimpleAssociableChoiceMarshaller.php

示例2: marshall

 /**
  * Marshall a RandomFloat object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A RandomFloat object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'min', $component->getMin());
     self::setDOMElementAttribute($element, 'max', $component->getMax());
     return $element;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:13,代码来源:RandomFloatMarshaller.php

示例3: marshall

 /**
  * Marshall a VariableMapping object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A VariableMapping object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'sourceIdentifier', $component->getSource());
     self::setDOMElementAttribute($element, 'targetIdentifier', $component->getTarget());
     return $element;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:13,代码来源:VariableMappingMarshaller.php

示例4: marshall

 /**
  * 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;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:13,代码来源:BaseValueMarshaller.php

示例5: marshall

 /**
  * Marshall a Selection object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A Selection object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'select', $component->getSelect());
     self::setDOMElementAttribute($element, 'withReplacement', $component->isWithReplacement());
     return $element;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:13,代码来源:SelectionMarshaller.php

示例6: marshall

 /**
  * Marshall a RubricBlock object into a DOMElement object.
  * 
  * @param QtiComponent $component A RubricBlock object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     $arrayViews = array();
     foreach ($component->getViews() as $view) {
         $key = array_search($view, View::asArray());
         // replace '_' by the space char.
         $arrayViews[] = strtolower(str_replace("ò", " ", $key));
     }
     if (count($arrayViews) > 0) {
         static::setDOMElementAttribute($element, 'view', implode(" ", $arrayViews));
     }
     if ($component->getUse() != '') {
         static::setDOMElementAttribute($element, 'use', $component->getUse());
     }
     if ($component->hasXmlBase() === true) {
         static::setXmlBase($element, $component->getXmlBase());
     }
     foreach ($component->getContent() as $block) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($block);
         $element->appendChild($marshaller->marshall($block));
     }
     foreach ($component->getStylesheets() as $stylesheet) {
         $stylesheetMarshaller = $this->getMarshallerFactory()->createMarshaller($stylesheet);
         $element->appendChild($stylesheetMarshaller->marshall($stylesheet));
     }
     self::fillElement($element, $component);
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:35,代码来源:RubricBlockMarshaller.php

示例7: marshall

 /**
  * Marshall a RubricBlockRef object to its XML counterpart.
  * 
  * @return DOMElement
  */
 public function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement('rubricBlockRef');
     self::setDOMElementAttribute($element, 'identifier', $component->getIdentifier());
     self::setDOMElementAttribute($element, 'href', $component->getHref());
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:12,代码来源:RubricBlockRefMarshaller.php

示例8: marshall

 /**
  * Marshall a PreCondition object into a DOMElement object.
  * 
  * @param QtiComponent $component A PreCondition object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     $marshaller = $this->getMarshallerFactory()->createMarshaller($component->getExpression());
     $element->appendChild($marshaller->marshall($component->getExpression()));
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:13,代码来源:PreConditionMarshaller.php

示例9: marshallChildrenKnown

 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     $headers = $component->getHeaders();
     if (count($headers) > 0) {
         self::setDOMElementAttribute($element, 'headers', implode(" ", $headers->getArrayCopy()));
     }
     if ($component->hasScope() === true) {
         self::setDOMElementAttribute($element, 'scope', TableCellScope::getNameByConstant($component->getScope()));
     }
     if ($component->hasAbbr() === true) {
         self::setDOMElementAttribute($element, 'abbr', $component->getAbbr());
     }
     if ($component->hasAxis() === true) {
         self::setDOMElementAttribute($element, 'axis', $component->getAxis());
     }
     if ($component->hasRowspan() === true) {
         self::setDOMElementAttribute($element, 'rowspan', $component->getRowspan());
     }
     if ($component->hasColspan() === true) {
         self::setDOMElementAttribute($element, 'colspan', $component->getColspan());
     }
     foreach ($component->getContent() as $c) {
         $marshaller = $this->getMarshallerFactory()->createMarshaller($c);
         $element->appendChild($marshaller->marshall($c));
     }
     self::fillElement($element, $component);
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:29,代码来源:TableCellMarshaller.php

示例10: marshallChildrenKnown

 protected function marshallChildrenKnown(QtiComponent $component, array $elements)
 {
     $element = self::getDOMCradle()->createElement($component->getQtiClassName());
     self::fillElement($element, $component);
     self::setDOMElementAttribute($element, 'responseIdentifier', $component->getResponseIdentifier());
     if ($component->hasPrompt() === true) {
         $element->appendChild($this->getMarshallerFactory()->createMarshaller($component->getPrompt())->marshall($component->getPrompt()));
     }
     if ($component->mustShuffle() !== false) {
         self::setDOMElementAttribute($element, 'shuffle', true);
     }
     if ($component->getMaxAssociations() !== 1) {
         self::setDOMElementAttribute($element, 'maxAssociations', $component->getMaxAssociations());
     }
     if ($component->getMinAssociations() !== 0) {
         self::setDOMElementAttribute($element, 'minAssociations', $component->getMinAssociations());
     }
     if ($component->hasXmlBase() === true) {
         self::setXmlBase($element, $component->getXmlBase());
     }
     foreach ($elements as $e) {
         $element->appendChild($e);
     }
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:25,代码来源:AssociateInteractionMarshaller.php

示例11: marshall

 /**
  * 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;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:13,代码来源:WeightMarshaller.php

示例12: buildContent

 public static function buildContent(QtiComponent $component, $content)
 {
     $reflectionClass = new \ReflectionClass($component);
     // TODO: Assumption `setContent` always has content setter on first parameter
     $parameterClass = $reflectionClass->getMethod('setContent')->getParameters()[0]->getClass();
     $contentType = $parameterClass->getShortName();
     try {
         /** @var QtiComponentCollection $content */
         $content = self::validateContent($content);
         if ($contentType === 'InlineCollection') {
             return self::buildInlineCollectionContent($content);
         } elseif ($contentType === 'BlockCollection') {
             return self::buildBlockCollectionContent($content);
         } elseif ($contentType === 'BlockStaticCollection') {
             return self::buildBlockStaticCollectionContent($content);
         } elseif ($contentType === 'FlowCollection') {
             return self::buildFlowCollectionContent($content);
         } elseif ($contentType === 'ObjectFlowCollection') {
             return self::buildFlowCollectionContent($content);
         } elseif ($contentType === 'FlowStaticCollection') {
             return self::buildFlowStaticCollectionContent($content);
         }
         throw new MappingException('Invalid content');
     } catch (\Exception $e) {
         throw new MappingException('Fail mapping `' . $component->getQtiClassName() . '` - ' . $e->getMessage());
     }
 }
开发者ID:learnosity,项目名称:learnosity-qti,代码行数:27,代码来源:ContentCollectionBuilder.php

示例13: marshall

 /**
  * Marshall a TemplateProcessing object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component A TemplateProcessing object.
  * @return \DOMElement The according DOMElement object.
  * @throws \qtism\data\storage\xml\marshalling\MarshallingException
  */
 protected function marshall(QtiComponent $component)
 {
     $element = self::getDOMCradle()->createElement('templateProcessing');
     foreach ($component->getTemplateRules() as $templateRule) {
         $element->appendChild($this->getMarshallerFactory()->createMarshaller($templateRule)->marshall($templateRule));
     }
     return $element;
 }
开发者ID:nagyist,项目名称:qti-sdk,代码行数:15,代码来源:TemplateProcessingMarshaller.php

示例14: marshall

 /**
  * Marshall an AreaMapEntry object into a DOMElement object.
  *
  * @param \qtism\data\QtiComponent $component An AreaMapEntry object.
  * @return \DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'shape', Shape::getNameByConstant($component->getShape()));
     self::setDOMElementAttribute($element, 'coords', $component->getCoords());
     self::setDOMElementAttribute($element, 'mappedValue', $component->getMappedValue());
     return $element;
 }
开发者ID:hutnikau,项目名称:qti-sdk,代码行数:14,代码来源:AreaMapEntryMarshaller.php

示例15: marshall

 /**
  * Marshall an InterpolationTableEntry object into a DOMElement object.
  * 
  * @param QtiComponent $component An InterpolationTableEntry object.
  * @return DOMElement The according DOMElement object.
  */
 protected function marshall(QtiComponent $component)
 {
     $element = static::getDOMCradle()->createElement($component->getQtiClassName());
     self::setDOMElementAttribute($element, 'sourceValue', $component->getSourceValue());
     self::setDOMElementAttribute($element, 'targetValue', $component->getTargetValue());
     self::setDOMElementAttribute($element, 'includeBoundary', $component->doesIncludeBoundary());
     return $element;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:14,代码来源:InterpolationTableEntryMarshaller.php


注:本文中的qtism\data\QtiComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。