h5p-report.class.php in Quiz 7.4
File
question_types/quiz_h5p/report/h5p-report.class.php
View source
<?php
class H5PReport {
private static $processorMap = array(
'compound' => 'CompoundProcessor',
'fill-in' => 'FillInProcessor',
'true-false' => 'TrueFalseProcessor',
'matching' => 'MatchingProcessor',
'choice' => 'ChoiceProcessor',
'long-choice' => 'LongChoiceProcessor',
);
private $processors = array();
public function generateReport($xapiData, $forcedProcessor = null, $disableScoring = false) {
$interactionType = isset($forcedProcessor) ? $forcedProcessor : $xapiData->interaction_type;
if (!isset(self::$processorMap[$interactionType])) {
return '';
}
if (!isset($this->processors[$interactionType])) {
$this->processors[$interactionType] = new self::$processorMap[$interactionType]();
}
return $this->processors[$interactionType]
->generateReport($xapiData, $disableScoring);
}
public function getStylesUsed() {
$styles = array(
'styles/shared-styles.css',
);
foreach ($this->processors as $processor) {
$style = $processor
->getStyle();
if (!empty($style)) {
$styles[] = $style;
}
}
return $styles;
}
public static function getInstance() {
static $instance;
if (!$instance) {
$instance = new H5PReport();
}
return $instance;
}
}
Classes
Name |
Description |
H5PReport |
Class H5PReport
@property fillInProcessor |