You are here

public function MatchingProcessor::generateHTML in Opigno module 8

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

Processes xAPI data and returns a human readable HTML report.

@inheritdoc

Overrides TypeProcessor::generateHTML

File

ActivityTypes/opigno_h5p/src/TypeProcessors/MatchingProcessor.php, line 25

Class

MatchingProcessor
Class MatchingProcessor.

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.matching');
  $dropzones = $this
    ->getDropzones($extras);
  $draggables = $this
    ->getDraggables($extras);
  $mappedCRP = $this
    ->mapPatternIDsToIndexes($crp[0], $dropzones, $draggables);
  $mappedResponse = $this
    ->mapPatternIDsToIndexes($response, $dropzones, $draggables);
  if (empty($mappedCRP) && empty($mappedResponse)) {
    return '';
  }
  $header = $this
    ->generateHeader($description, $scoreSettings);
  $tableHTML = $this
    ->generateTable($mappedCRP, $mappedResponse, $dropzones, $draggables);
  $container = '<div class="h5p-reporting-container h5p-matching-container">' . $header . $tableHTML . '</div>';
  return $container;
}