public function ChoiceProcessor::generateHTML in Opigno module 3.x
Same name and namespace in other branches
- 8 ActivityTypes/opigno_h5p/src/TypeProcessors/ChoiceProcessor.php \Drupal\opigno_h5p\TypeProcessors\ChoiceProcessor::generateHTML()
Determines options for interaction, generates a human readable HTML report.
@inheritdoc
Overrides TypeProcessor::generateHTML
File
- ActivityTypes/
opigno_h5p/ src/ TypeProcessors/ ChoiceProcessor.php, line 19
Class
- ChoiceProcessor
- Class FillInProcessor.
Namespace
Drupal\opigno_h5p\TypeProcessorsCode
public function generateHTML($description, $crp, $response, $extras = NULL, $scoreSettings = NULL) {
if ($this
->isLongChoice($extras)) {
return H5PReport::getInstance()
->generateReport($this->xapiData, 'long-choice', $this->disableScoring);
}
// We need some style for our report.
$this
->setStyle('opigno_h5p/opigno_h5p.choice');
if (!isset($crp[0])) {
$crp[0] = '';
}
$correctAnswers = explode('[,]', $crp[0]);
$responses = explode('[,]', $response);
$headerHtml = $this
->generateHeader($description, $scoreSettings);
$tableHTML = $this
->generateTable($extras, $correctAnswers, $responses);
return '<div class="h5p-reporting-container h5p-choices-container">' . $headerHtml . $tableHTML . '</div>';
}