Ejemplo 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->hasCite() === true) {
         $fragment->firstChild->setAttribute('cite', $this->transformUri($component->getCite(), $base));
     }
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $this->additionalClass('qti-rubricBlock');
     $dataView = array();
     if ($component->getViews()->contains(View::AUTHOR)) {
         $this->additionalClass('qti-view-author');
         $dataView[] = 'author';
     }
     if ($component->getViews()->contains(View::CANDIDATE)) {
         $this->additionalClass('qti-view-candidate');
         $dataView[] = 'candidate';
     }
     if ($component->getViews()->contains(View::PROCTOR)) {
         $this->additionalClass('qti-view-proctor');
         $dataView[] = 'proctor';
     }
     if ($component->getViews()->contains(View::SCORER)) {
         $this->additionalClass('qti-view-scorer');
         $dataView[] = 'scorer';
     }
     if ($component->getViews()->contains(View::TEST_CONSTRUCTOR)) {
         $this->additionClass('qti-view-testConstructor');
         $dataView[] = 'testConstructor';
     }
     if ($component->getViews()->contains(View::TUTOR)) {
         $this->additionalClass('qti-view-tutor');
         $dataView[] = 'tutor';
     }
     $fragment->firstChild->setAttribute('data-view', implode(" ", $dataView));
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     if ($component->hasSummary() === true) {
         $fragment->firstChild->setAttribute('summary', $component->getSummary());
     }
 }
Ejemplo n.º 4
0
 /**
  * @see \qtism\runtime\rendering\markup\xhtml\AbstractXhtmlRenderer::appendChildren()
  */
 protected function appendChildren(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendChildren($fragment, $component, $base);
     // For browser compatibility, we do not want self-closing object elements.
     if ($fragment->firstChild->childNodes->length === 0) {
         $fragment->firstChild->appendChild($fragment->ownerDocument->createTextNode(''));
     }
 }
 public function testRenderChildren()
 {
     $ctx = new XhtmlRenderingEngine();
     $abbr = new Abbr('my-abbr', 'qti qti-abbr');
     $abbrRenderer = new BodyElementRenderer();
     $abbrRenderer->setRenderingEngine($ctx);
     $textRun = new TextRun('abbreviation...');
     $textRunRenderer = new TextRunRenderer();
     $textRunRenderer->setRenderingEngine($ctx);
     $renderedTextRun = $textRunRenderer->render($textRun);
     $ctx->storeRendering($textRun, $renderedTextRun);
     $abbr->setContent(new InlineCollection(array($textRun)));
     $element = $abbrRenderer->render($abbr)->firstChild;
     $this->assertEquals('abbr', $element->nodeName);
     $this->assertEquals('my-abbr', $element->getAttribute('id'));
     $this->assertEquals('qti qti-abbr qti-bodyElement qti-abbr', $element->getAttribute('class'));
     $this->assertEquals('abbreviation...', $element->firstChild->wholeText);
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $this->additionalClass('qti-feedbackElement');
     $fragment->firstChild->setAttribute('data-outcome-identifier', $component->getOutcomeIdentifier());
     $fragment->firstChild->setAttribute('data-show-hide', ShowHide::getNameByConstant($component->getShowHide()));
     $fragment->firstChild->setAttribute('data-identifier', $component->getIdentifier());
     if ($this->getRenderingEngine()->getFeedbackShowHidePolicy() === XhtmlRenderingEngine::CONTEXT_STATIC) {
         $this->additionalClass($component->getShowHide() === ShowHide::SHOW ? 'qti-hide' : 'qti-show');
     }
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $this->additionalClass('qti-choice');
     $fragment->firstChild->setAttribute('data-identifier', $component->getIdentifier());
     $fragment->firstChild->setAttribute('data-fixed', $component->isFixed() === true ? 'true' : 'false');
     if ($component->hasTemplateIdentifier() === true) {
         $this->additionalClass($component->getShowHide() === ShowHide::SHOW ? 'qti-hide' : 'qti-show');
         $fragment->firstChild->setAttribute('data-template-identifier', $component->getTemplateIdentifier());
         $fragment->firstChild->setAttribute('data-show-hide', $component->getShowHide() === ShowHide::SHOW ? 'show' : 'hide');
     }
 }
Ejemplo n.º 8
0
 /**
  * @see \qtism\runtime\rendering\markup\xhtml\BodyElementRenderer::appendAttributes()
  */
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $fragment->firstChild->setAttribute('src', $this->transformUri($component->getSrc(), $base));
     $fragment->firstChild->setAttribute('alt', $component->getAlt());
     if ($component->hasLongdesc() === true) {
         $fragment->firstChild->setAttribute('longdesc', $this->transformUri($component->getLongdesc(), $base));
     }
     if ($component->hasHeight() === true) {
         $fragment->firstChild->setAttribute('height', $component->getHeight());
     }
     if ($component->hasWidth() === true) {
         $fragment->firstChild->setAttribute('width', $component->getWidth());
     }
 }
Ejemplo n.º 9
0
 /**
  * @see \qtism\runtime\rendering\markup\xhtml\BodyElementRenderer::appendAttributes()
  */
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $this->additionalClass('qti-printedVariable');
     $fragment->firstChild->setAttribute('data-identifier', $component->getIdentifier());
     if ($component->hasFormat() === true) {
         $fragment->firstChild->setAttribute('data-format', $component->getFormat());
     }
     $fragment->firstChild->setAttribute('data-power-form', $component->mustPowerForm() === true ? 'true' : 'false');
     $fragment->firstChild->setAttribute('data-base', $component->getBase());
     if ($component->hasIndex() === true) {
         $fragment->firstChild->setAttribute('data-index', $component->getIndex());
     }
     $fragment->firstChild->setAttribute('data-delimiter', $component->getDelimiter());
     if ($component->hasField() === true) {
         $fragment->firstChild->setAttribute('data-field', $component->getField());
     }
     $fragment->firstChild->setAttribute('data-mapping-indicator', $component->getMappingIndicator());
 }
Ejemplo n.º 10
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());
     }
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $this->additionalClass('qti-itemBody');
 }
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $fragment->firstChild->setAttribute('data-response-identifier', $component->getResponseIdentifier());
 }
Ejemplo n.º 13
0
 /**
  * @see \qtism\runtime\rendering\markup\xhtml\BodyElementRenderer::appendAttributes()
  */
 protected function appendAttributes(DOMDocumentFragment $fragment, QtiComponent $component, $base = '')
 {
     parent::appendAttributes($fragment, $component, $base);
     $fragment->firstChild->setAttribute('span', $component->getSpan());
 }