You are here

function _opigno_scorm_form_submit in Opigno SCORM 3.x

Same name and namespace in other branches
  1. 8 opigno_scorm.module \_opigno_scorm_form_submit()

Form submit callback, used in opigno_h5p_form_alter().

Saves user answer & correct answer patterns.

1 string reference to '_opigno_scorm_form_submit'
opigno_scorm_form_alter in ./opigno_scorm.module
Implements hook_form_alter().

File

./opigno_scorm.module, line 333
Module functionality implementation.

Code

function _opigno_scorm_form_submit($form, FormStateInterface $form_state) {
  $storage = $form_state
    ->getStorage();
  if (!empty($storage['scorm_answer']) && !empty($_SESSION['scorm_answer_results'])) {
    if (!empty($_SESSION['scorm_answer_results']['data']->cmi->interactions)) {
      foreach ($_SESSION['scorm_answer_results']['data']->cmi->interactions as $interaction) {
        _opigno_scorm_save_interaction($interaction, $storage['scorm_answer']);
      }
    }
    unset($_SESSION['scorm_answer_results']);
  }
}