當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。