You are here

class CompoundProcessor in Opigno module 3.x

Same name and namespace in other branches
  1. 8 ActivityTypes/opigno_h5p/src/TypeProcessors/CompoundProcessor.php \Drupal\opigno_h5p\TypeProcessors\CompoundProcessor

Class FillInProcessor.

Processes and generates HTML report for 'fill-in' interaction type.

Hierarchy

Expanded class hierarchy of CompoundProcessor

File

ActivityTypes/opigno_h5p/src/TypeProcessors/CompoundProcessor.php, line 12

Namespace

Drupal\opigno_h5p\TypeProcessors
View source
class CompoundProcessor extends TypeProcessor {

  /**
   * Determines options for interaction, generates a human readable HTML report.
   *
   * @inheritdoc
   */
  public function generateHTML($description, $crp, $response, $extras, $scoreSettings = NULL) {

    // We need some style for our report.
    $this
      ->setStyle('opigno_h5p/opigno_h5p.compound');
    $H5PReport = H5PReport::getInstance();
    $reports = '';
    if (isset($extras->children)) {
      foreach ($extras->children as $childData) {
        $reports .= '<div class="h5p-result">' . $H5PReport
          ->generateReport($childData, NULL, $this->disableScoring) . '</div>';
      }
    }

    // Do not display description when children is empty.
    if (!empty($reports) && !empty($description)) {
      $reports = '<p class="h5p-reporting-description h5p-compound-task-description">' . $description . '</p>' . $reports;
    }
    if (!empty($reports)) {
      return '<div class="h5p-reporting-container h5p-compound-container">' . $reports . '</div>';
    }
    else {
      return NULL;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CompoundProcessor::generateHTML public function Determines options for interaction, generates a human readable HTML report. Overrides TypeProcessor::generateHTML
TypeProcessor::$disableScoring protected property
TypeProcessor::$style private property
TypeProcessor::$xapiData protected property
TypeProcessor::generateReport public function Generate HTML for report.
TypeProcessor::generateScoreHtml protected function Generate score html.
TypeProcessor::getCRP protected function Decode and retrieve Correct Responses Pattern from xAPI data.
TypeProcessor::getDescription protected function Decode and retrieve 'en-US' description from xAPI data.
TypeProcessor::getExtras protected function Decode extras from xAPI data.
TypeProcessor::getResponse protected function Decode and retrieve user response from xAPI data.
TypeProcessor::getScoreSettings protected function Get score settings.
TypeProcessor::getStyle public function Get style used by processor if used.
TypeProcessor::setStyle protected function Set style used by the processor.