You are here

public function LongChoiceProcessor::generateHTML in Opigno module 8

Same name and namespace in other branches
  1. 3.x ActivityTypes/opigno_h5p/src/TypeProcessors/LongChoiceProcessor.php \Drupal\opigno_h5p\TypeProcessors\LongChoiceProcessor::generateHTML()

Options for interaction and generates a human readable HTML report.

Overrides TypeProcessor::generateHTML

File

ActivityTypes/opigno_h5p/src/TypeProcessors/LongChoiceProcessor.php, line 17

Class

LongChoiceProcessor
Class FillInProcessor.

Namespace

Drupal\opigno_h5p\TypeProcessors

Code

public function generateHTML($description, $crp, $response, $extras = NULL, $scoreSettings = NULL) {

  // We need some style for our report.
  $this
    ->setStyle('opigno_h5p/opigno_h5p.long-choice');
  $correctAnswers = explode('[,]', $crp[0]);
  $responses = !empty($response) ? explode('[,]', $response) : [];
  $header = $this
    ->generateHeader($description, $scoreSettings);
  $bodyHTML = $this
    ->generateBody($extras, $correctAnswers, $responses);
  $footer = $this
    ->generateFooter();
  return '<div class="h5p-reporting-container h5p-long-choice-container">' . $header . $bodyHTML . '</div>' . $footer;
}