function scorm_seq_overall($scoid, $userid, $request)
{
    $seq = scorm_seq_navigation($scoid, $userid, $request);
    if ($seq->navigation) {
        if ($seq->termination != null) {
            $seq = scorm_seq_termination($scoid, $userid, $seq);
        }
        if ($seq->sequencing != null) {
            //    scorm_sequencing_sequencing($scoid,$userid,$seq);
        }
        if ($seq->target != null) {
            //    scorm_sequencing_delivery($scoid,$userid,$seq);
        }
    }
    if ($seq->exception != null) {
        //    scorm_sequencing_exception($seq);
    }
    return 'true';
}
Beispiel #2
0
function scorm_seq_overall ($scoid,$userid,$request,$attempt) {
    $seq = scorm_seq_navigation($scoid,$userid,$request,$attempt);
    if ($seq->navigation) {
        if ($seq->termination != null) {
            $seq = scorm_seq_termination($scoid,$userid,$seq);
        }
        if ($seq->sequencing != null) {
            $seq = scorm_seq_sequencing($scoid,$userid,$seq);
            if($seq->sequencing == 'exit'){//return the control to the LTS
                return 'true';
            }
        }
        if ($seq->delivery != null) {
            $seq = scorm_sequencing_delivery($scoid,$userid,$seq);
            $seq = scorm_content_delivery_environment ($seq,$userid);
        }
    }
    if ($seq->exception != null) {
        $seq = scorm_sequencing_exception($seq);
    }
    return 'true';
}
    $scorm = $DB->get_record("scorm", array("id" => $cm->instance), '*', MUST_EXIST);
} else {
    if (!empty($a)) {
        $scorm = $DB->get_record("scorm", array("id" => $a), '*', MUST_EXIST);
        $course = $DB->get_record("course", array("id" => $scorm->course), '*', MUST_EXIST);
        $cm = get_coursemodule_from_instance("scorm", $scorm->id, $course->id, false, MUST_EXIST);
    } else {
        print_error('missingparameter');
    }
}
$PAGE->set_url('/mod/scorm/datamodels/sequencinghandler.php', array('scoid' => $scoid, 'attempt' => $attempt, 'id' => $cm->id, 'function' => $function, 'request' => $request));
require_login($course, false, $cm);
if (!empty($scoid) && !empty($function)) {
    require_once $CFG->dirroot . '/mod/scorm/datamodels/scorm_13lib.php';
    if (has_capability('mod/scorm:savetrack', context_module::instance($cm->id))) {
        $result = null;
        switch ($function) {
            case 'scorm_seq_flow':
                if ($request == 'forward' || $request == 'backward') {
                    $seq = scorm_seq_navigation($scoid, $USER->id, $request . '_', $attempt);
                    $sco = scorm_get_sco($scoid);
                    $seq = scorm_seq_flow($sco, $request, $seq, true, $USER->id);
                    if (!empty($seq->nextactivity)) {
                        scorm_seq_end_attempt($sco, $USER->id, $seq);
                    }
                }
                echo json_encode($seq);
                break;
        }
    }
}