You are here

public function H5PReport::generateReport in Opigno module 3.x

Same name and namespace in other branches
  1. 8 ActivityTypes/opigno_h5p/src/H5PReport.php \Drupal\opigno_h5p\H5PReport::generateReport()

Generate the proper report depending on xAPI data.

Parameters

object $xapiData: XAPI data.

string $forcedProcessor: Force a processor type.

bool $disableScoring: Disables scoring for the report.

Return value

string A report.

File

ActivityTypes/opigno_h5p/src/H5PReport.php, line 34

Class

H5PReport
Class H5PReport.

Namespace

Drupal\opigno_h5p

Code

public function generateReport($xapiData, $forcedProcessor = NULL, $disableScoring = TRUE) {
  $interactionType = isset($forcedProcessor) ? $forcedProcessor : $xapiData->interaction_type;
  if (!isset(self::$processorMap[$interactionType])) {

    // No processor found.
    return '';
  }
  if (!isset($this->processors[$interactionType])) {

    // Not used before. Initialize new processor.
    $this->processors[$interactionType] = new self::$processorMap[$interactionType]();
  }

  // Generate and return report from xAPI data.
  return $this->processors[$interactionType]
    ->generateReport($xapiData, $disableScoring);
}