Esempio n. 1
0
 /**
  * @see \qtism\runtime\rendering\markup\xhtml\BodyElementRenderer::appendAttributes()
  */
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     if ($component->hasHeaders() === true) {
         $fragment->firstChild->setAttribute('headers', implode(" ", $component->getHeaders()->getArrayCopy()));
     }
     if ($component->hasScope() === true) {
         $fragment->firstChild->setAttribute('scope', TableCellScope::getNameByConstant($component->getScope()));
     }
     if ($component->hasAbbr() === true) {
         $fragment->firstChild->setAttribute('abbr', $component->getAbbr());
     }
     if ($component->hasAxis() === true) {
         $fragment->firstChild->setAttribute('axis', $component->getAxis());
     }
     if ($component->hasRowspan() === true) {
         $fragment->firstChild->setAttribute('rowspan', $component->getRowspan());
     }
     if ($component->hasColspan() === true) {
         $fragment->firstChild->setAttribute('colspan', $component->getColspan());
     }
 }
Esempio n. 2
0
 /**
  * @see \qtism\data\storage\xml\marshalling\RecursiveMarshaller::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));
     }
     $this->fillElement($element, $component);
     return $element;
 }