Example #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());
     }
 }
Example #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;
 }
 /**
  * Set the scope attribute.
  * 
  * @param integer $scope A value from the TableCellScope enumeration or -1 if no scope is defined.
  * @throws InvalidArgumentException If $scope is not a value from the TableCellScope enumeration nor -1.
  */
 public function setScope($scope)
 {
     if (in_array($scope, TableCellScope::asArray()) === true || $scope === -1) {
         $this->scope = $scope;
     } else {
         $msg = "The 'scope' argument must be a value from the TableCellScope enumeration, '" . $scope . "' given.";
         throw new InvalidArgumentException($msg);
     }
 }