MDL-45887 mod_scorm : Fixing variable names

This commit is contained in:
nobelium 2014-08-15 13:55:06 +05:30 committed by Dan Marsden
parent 4cb25b3605
commit 15838edb63
7 changed files with 110 additions and 151 deletions

View File

@ -121,10 +121,10 @@ if (!empty($command)) {
}
if ($sco = scorm_get_sco($scoid)) {
$score = isset($sco->mastery_score) && is_numeric($sco->mastery_score) ? trim($sco->mastery_score) : '';
$userdata->course_id = $sco->identifier;
$userdata->datafromlms = isset($sco->datafromlms) ? $sco->datafromlms : '';
$userdata->mastery_score = $score;
$userdata->mastery_score = isset($sco->mastery_score) && is_numeric($sco->mastery_score) ?
trim($sco->mastery_score) : '';
$userdata->max_time_allowed = isset($sco->max_time_allowed) ? $sco->max_time_allowed : '';
$userdata->time_limit_action = isset($sco->time_limit_action) ? $sco->time_limit_action : '';

View File

@ -191,8 +191,7 @@ function scorm_parse_aicc(&$scorm) {
if (!isset($courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1 , -1)])) {
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1 , -1)] = new stdClass();
}
$temp = substr(trim($matches[$j + 1]), 1, -1);
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1 , -1)]->$column = $temp;
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1 , -1)]->$column = substr(trim($matches[$j + 1]), 1, -1);
}
}
}
@ -206,8 +205,7 @@ function scorm_parse_aicc(&$scorm) {
if (preg_match($regexp, $rows[$i], $matches)) {
for ($j = 0; $j < count($columns->columns); $j++) {
$column = $columns->columns[$j];
$temp = substr(trim($matches[$j + 1]), 1, -1);
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1, -1)]->$column = $temp;
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol + 1]), 1, -1)]->$column = substr(trim($matches[$j + 1]), 1, -1);
}
}
}
@ -223,8 +221,7 @@ function scorm_parse_aicc(&$scorm) {
if ($j != $columns->mastercol) {
$element = substr(trim($matches[$j + 1]), 1 , -1);
if (!empty($element)) {
$temp = substr(trim($matches[$columns->mastercol + 1]), 1, -1);
$courses[$courseid]->elements[$element]->parent = $temp;
$courses[$courseid]->elements[$element]->parent = substr(trim($matches[$columns->mastercol + 1]), 1, -1);
}
}
}
@ -240,8 +237,7 @@ function scorm_parse_aicc(&$scorm) {
if (preg_match($regexp, $rows[$i], $matches)) {
for ($j = 0; $j < count($matches) - 1; $j++) {
if ($j != $columns->mastercol) {
$temp = substr(trim($matches[$columns->mastercol + 1]), 1, -1);
$courses[$courseid]->elements[substr(trim($matches[$j + 1]), 1, -1)]->parent = $temp;
$courses[$courseid]->elements[substr(trim($matches[$j + 1]), 1, -1)]->parent = substr(trim($matches[$columns->mastercol + 1]), 1, -1);
}
}
}
@ -254,8 +250,7 @@ function scorm_parse_aicc(&$scorm) {
$regexp = scorm_forge_cols_regexp($columns->columns, '(.+),');
for ($i = 1; $i < count($rows); $i++) {
if (preg_match($regexp, $rows[$i], $matches)) {
$temp = substr(trim($matches[2 - $columns->mastercol]), 1, -1);
$courses[$courseid]->elements[$columns->mastercol + 1]->prerequisites = $temp;
$courses[$courseid]->elements[$columns->mastercol + 1]->prerequisites = substr(trim($matches[2 - $columns->mastercol]), 1, -1);
}
}
}

View File

@ -53,12 +53,12 @@ function scorm_get_manifest($blocks, $scoes) {
foreach ($block['children'] as $metadata) {
if ($metadata['name'] == 'SCHEMAVERSION') {
if (empty($scoes->version)) {
$version = (preg_match("/^(1\.2)$|^(CAM )?(1\.3)$/", $metadata['tagData'], $matches));
if (isset($metadata['tagData']) && $version) {
$isversionset = (preg_match("/^(1\.2)$|^(CAM )?(1\.3)$/", $metadata['tagData'], $matches));
if (isset($metadata['tagData']) && $isversionset) {
$scoes->version = 'SCORM_'.$matches[count($matches) - 1];
} else {
$version = (preg_match("/^2004 (3rd|4th) Edition$/", $metadata['tagData'], $matches));
if (isset($metadata['tagData']) && $version) {
$isversionset = (preg_match("/^2004 (3rd|4th) Edition$/", $metadata['tagData'], $matches));
if (isset($metadata['tagData']) && $isversionset) {
$scoes->version = 'SCORM_1.3';
} else {
$scoes->version = 'SCORM_1.2';
@ -152,8 +152,7 @@ function scorm_get_manifest($blocks, $scoes) {
if (empty($resources[$idref]['ADLCP:SCORMTYPE'])) {
$resources[$idref]['ADLCP:SCORMTYPE'] = 'asset';
}
$scormtype = $resources[$idref]['ADLCP:SCORMTYPE'];
$scoes->elements[$manifest][$organization][$identifier]->scormtype = $scormtype;
$scoes->elements[$manifest][$organization][$identifier]->scormtype = $resources[$idref]['ADLCP:SCORMTYPE'];
}
}
@ -224,8 +223,7 @@ function scorm_get_manifest($blocks, $scoes) {
if (!isset($block['attrs']['MINPROGRESSMEASURE'])) {
$block['attrs']['MINPROGRESSMEASURE'] = '1.0';
}
$progress = $block['attrs']['MINPROGRESSMEASURE'];
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->threshold = $progress;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->threshold = $block['attrs']['MINPROGRESSMEASURE'];
break;
case 'ADLNAV:PRESENTATION':
$parent = array_pop($parents);
@ -236,32 +234,25 @@ function scorm_get_manifest($blocks, $scoes) {
foreach ($adlnav['children'] as $adlnavinterface) {
if ($adlnavinterface['name'] == 'ADLNAV:HIDELMSUI') {
if ($adlnavinterface['tagData'] == 'continue') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidecontinue
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidecontinue = 1;
}
if ($adlnavinterface['tagData'] == 'previous') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideprevious
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideprevious = 1;
}
if ($adlnavinterface['tagData'] == 'exit') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexit
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexit = 1;
}
if ($adlnavinterface['tagData'] == 'exitAll') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexitall
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideexitall = 1;
}
if ($adlnavinterface['tagData'] == 'abandon') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandon
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandon = 1;
}
if ($adlnavinterface['tagData'] == 'abandonAll') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandonall
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hideabandonall = 1;
}
if ($adlnavinterface['tagData'] == 'suspendAll') {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidesuspendall
= 1;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->hidesuspendall = 1;
}
}
}
@ -276,54 +267,52 @@ function scorm_get_manifest($blocks, $scoes) {
foreach ($block['children'] as $sequencing) {
if ($sequencing['name'] == 'IMSSS:CONTROLMODE') {
if (isset($sequencing['attrs']['CHOICE'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->choice
= $sequencing['attrs']['CHOICE'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->choice =
$sequencing['attrs']['CHOICE'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['CHOICEEXIT'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->choiceexit
= $sequencing['attrs']['CHOICEEXIT'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->choiceexit =
$sequencing['attrs']['CHOICEEXIT'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['FLOW'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->flow
= $sequencing['attrs']['FLOW'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->flow =
$sequencing['attrs']['FLOW'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['FORWARDONLY'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->forwardonly
= $sequencing['attrs']['FORWARDONLY'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->forwardonly =
$sequencing['attrs']['FORWARDONLY'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['USECURRENTATTEMPTOBJECTINFO'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->usecurrentattemptobjectinfo
= $sequencing['attrs']['USECURRENTATTEMPTOBJECTINFO'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->usecurrentattemptobjectinfo =
$sequencing['attrs']['USECURRENTATTEMPTOBJECTINFO'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['USECURRENTATTEMPTPROGRESSINFO'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->usecurrentattemptprogressinfo
= $sequencing['attrs']['USECURRENTATTEMPTPROGRESSINFO'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->usecurrentattemptprogressinfo =
$sequencing['attrs']['USECURRENTATTEMPTPROGRESSINFO'] == 'true' ? 1 : 0;
}
}
if ($sequencing['name'] == 'IMSSS:DELIVERYCONTROLS') {
if (isset($sequencing['attrs']['TRACKED'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->tracked
= $sequencing['attrs']['TRACKED'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->tracked =
$sequencing['attrs']['TRACKED'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['COMPLETIONSETBYCONTENT'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->completionsetbycontent
= $sequencing['attrs']['COMPLETIONSETBYCONTENT'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->completionsetbycontent =
$sequencing['attrs']['COMPLETIONSETBYCONTENT'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['OBJECTIVESETBYCONTENT'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->objectivesetbycontent
= $sequencing['attrs']['OBJECTIVESETBYCONTENT'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->objectivesetbycontent =
$sequencing['attrs']['OBJECTIVESETBYCONTENT'] == 'true' ? 1 : 0;
}
}
if ($sequencing['name'] == 'ADLSEQ:CONSTRAINEDCHOICECONSIDERATIONS') {
if (isset($sequencing['attrs']['CONSTRAINCHOICE'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->constrainChoice
= $sequencing['attrs']['CONSTRAINCHOICE'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->constrainChoice =
$sequencing['attrs']['CONSTRAINCHOICE'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['PREVENTACTIVATION'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->preventactivation
= $sequencing['attrs']['PREVENTACTIVATION'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->preventactivation =
$sequencing['attrs']['PREVENTACTIVATION'] == 'true' ? 1 : 0;
}
}
if ($sequencing['name'] == 'IMSSS:OBJECTIVES') {
@ -337,8 +326,8 @@ function scorm_get_manifest($blocks, $scoes) {
case 'IMSSS:OBJECTIVE':
$objectivedata->satisfiedbymeasure = 0;
if (isset($objective['attrs']['SATISFIEDBYMEASURE'])) {
$objectivedata->satisfiedbymeasure
= $objective['attrs']['SATISFIEDBYMEASURE'] == 'true' ? 1 : 0;
$objectivedata->satisfiedbymeasure =
$objective['attrs']['SATISFIEDBYMEASURE'] == 'true' ? 1 : 0;
}
$objectivedata->objectiveid = '';
if (isset($objective['attrs']['OBJECTIVEID'])) {
@ -359,32 +348,28 @@ function scorm_get_manifest($blocks, $scoes) {
$mapinfo = new stdClass();
$mapinfo->targetobjectiveid = '';
if (isset($objectiveparam['attrs']['TARGETOBJECTIVEID'])) {
$mapinfo->targetobjectiveid
= $objectiveparam['attrs']['TARGETOBJECTIVEID'];
$mapinfo->targetobjectiveid =
$objectiveparam['attrs']['TARGETOBJECTIVEID'];
}
$mapinfo->readsatisfiedstatus = 1;
if (isset($objectiveparam['attrs']['READSATISFIEDSTATUS'])) {
$mapinfo->readsatisfiedstatus
= $objectiveparam['attrs']
['READSATISFIEDSTATUS'] == 'true' ? 1 : 0;
$mapinfo->readsatisfiedstatus =
$objectiveparam['attrs']['READSATISFIEDSTATUS'] == 'true' ? 1 : 0;
}
$mapinfo->writesatisfiedstatus = 0;
if (isset($objectiveparam['attrs']['WRITESATISFIEDSTATUS'])) {
$mapinfo->writesatisfiedstatus
= $objectiveparam['attrs']
['WRITESATISFIEDSTATUS'] == 'true' ? 1 : 0;
$mapinfo->writesatisfiedstatus =
$objectiveparam['attrs']['WRITESATISFIEDSTATUS'] == 'true' ? 1 : 0;
}
$mapinfo->readnormalizemeasure = 1;
if (isset($objectiveparam['attrs']['READNORMALIZEDMEASURE'])) {
$mapinfo->readnormalizemeasure
= $objectiveparam['attrs']
['READNORMALIZEDMEASURE'] == 'true' ? 1 : 0;
$mapinfo->readnormalizemeasure =
$objectiveparam['attrs']['READNORMALIZEDMEASURE'] == 'true' ? 1 : 0;
}
$mapinfo->writenormalizemeasure = 0;
if (isset($objectiveparam['attrs']['WRITENORMALIZEDMEASURE'])) {
$mapinfo->writenormalizemeasure
= $objectiveparam['attrs']
['WRITENORMALIZEDMEASURE'] == 'true' ? 1 : 0;
$mapinfo->writenormalizemeasure =
$objectiveparam['attrs']['WRITENORMALIZEDMEASURE'] == 'true' ? 1 : 0;
}
array_push($mapinfos, $mapinfo);
}
@ -401,30 +386,26 @@ function scorm_get_manifest($blocks, $scoes) {
}
if ($sequencing['name'] == 'IMSSS:LIMITCONDITIONS') {
if (isset($sequencing['attrs']['ATTEMPTLIMIT'])) {
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptLimit
= $sequencing['attrs']['ATTEMPTLIMIT'];
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptLimit =
$sequencing['attrs']['ATTEMPTLIMIT'];
}
if (isset($sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->attemptAbsoluteDurationLimit
= $sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'];
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->attemptAbsoluteDurationLimit =
$sequencing['attrs']['ATTEMPTABSOLUTEDURATIONLIMIT'];
}
}
if ($sequencing['name'] == 'IMSSS:ROLLUPRULES') {
if (isset($sequencing['attrs']['ROLLUPOBJECTIVESATISFIED'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->rollupobjectivesatisfied
= $sequencing['attrs']['ROLLUPOBJECTIVESATISFIED'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rollupobjectivesatisfied =
$sequencing['attrs']['ROLLUPOBJECTIVESATISFIED'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->rollupprogresscompletion
= $sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'] == 'true' ? 1 : 0;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rollupprogresscompletion =
$sequencing['attrs']['ROLLUPPROGRESSCOMPLETION'] == 'true' ? 1 : 0;
}
if (isset($sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'])) {
$scoes->elements[$manifest][$parent->organization]
[$parent->identifier]->objectivemeasureweight
= $sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'];
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->objectivemeasureweight =
$sequencing['attrs']['OBJECTIVEMEASUREWEIGHT'];
}
if (!empty($sequencing['children'])) {
@ -450,8 +431,7 @@ function scorm_get_manifest($blocks, $scoes) {
$conditions = array();
$rolluprule->conditioncombination = 'all';
if (isset($rolluproleconditions['attrs']['CONDITIONCOMBINATION'])) {
$rolluprule->CONDITIONCOMBINATION
= $rolluproleconditions['attrs']['CONDITIONCOMBINATION'];
$rolluprule->CONDITIONCOMBINATION = $rolluproleconditions['attrs']['CONDITIONCOMBINATION'];
}
foreach ($rolluproleconditions['children'] as $rolluprulecondition) {
if ($rolluprulecondition['name'] == 'IMSSS:ROLLUPCONDITION') {
@ -461,8 +441,7 @@ function scorm_get_manifest($blocks, $scoes) {
}
$condition->operator = 'noOp';
if (isset($rolluprulecondition['attrs']['OPERATOR'])) {
$condition->operator
= $rolluprulecondition['attrs']['OPERATOR'];
$condition->operator = $rolluprulecondition['attrs']['OPERATOR'];
}
array_push($conditions, $condition);
}
@ -477,8 +456,7 @@ function scorm_get_manifest($blocks, $scoes) {
array_push($rolluprules, $rolluprule);
}
}
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rolluprules
= $rolluprules;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->rolluprules = $rolluprules;
}
}
@ -505,8 +483,7 @@ function scorm_get_manifest($blocks, $scoes) {
$ruleconditions = array();
$sequencingrule->conditioncombination = 'all';
if (isset($conditionrule['attrs']['CONDITIONCOMBINATION'])) {
$sequencingrule->conditioncombination
= $conditionrule['attrs']['CONDITIONCOMBINATION'];
$sequencingrule->conditioncombination = $conditionrule['attrs']['CONDITIONCOMBINATION'];
}
foreach ($conditionrule['children'] as $rulecondition) {
if ($rulecondition['name'] == 'IMSSS:RULECONDITION') {
@ -520,13 +497,11 @@ function scorm_get_manifest($blocks, $scoes) {
}
$condition->measurethreshold = 0.0000;
if (isset($rulecondition['attrs']['MEASURETHRESHOLD'])) {
$condition->measurethreshold
= $rulecondition['attrs']['MEASURETHRESHOLD'];
$condition->measurethreshold = $rulecondition['attrs']['MEASURETHRESHOLD'];
}
$condition->referencedobjective = '';
if (isset($rulecondition['attrs']['REFERENCEDOBJECTIVE'])) {
$condition->referencedobjective
= $rulecondition['attrs']['REFERENCEDOBJECTIVE'];
$condition->referencedobjective = $rulecondition['attrs']['REFERENCEDOBJECTIVE'];
}
array_push($ruleconditions, $condition);
}
@ -541,8 +516,7 @@ function scorm_get_manifest($blocks, $scoes) {
array_push($sequencingrules, $sequencingrule);
}
}
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->sequencingrules
= $sequencingrules;
$scoes->elements[$manifest][$parent->organization][$parent->identifier]->sequencingrules = $sequencingrules;
}
}
}
@ -553,7 +527,8 @@ function scorm_get_manifest($blocks, $scoes) {
}
if (!empty($manifestresourcesnotfound)) {
// Throw warning to user to let them know manifest contains references to resources that don't appear to exist.
if (!defined('DEBUGGING_PRINTED')) { // Prevent redirect and display warning.
if (!defined('DEBUGGING_PRINTED')) {
// Prevent redirect and display warning.
define('DEBUGGING_PRINTED', 1);
}
echo $OUTPUT->notification(get_string('invalidmanifestresource', 'scorm').' '. implode(', ', $manifestresourcesnotfound));
@ -638,7 +613,8 @@ function scorm_parse_scorm(&$scorm, $manifest) {
// Insert the new SCO, and retain the link between the old and new for later adjustment.
$id = $DB->insert_record('scorm_scoes', $newitem);
}
$newscoes[$id] = $newitem; // Save this sco in memory so we can use it later.
// Save this sco in memory so we can use it later.
$newscoes[$id] = $newitem;
if ($optionaldatas = scorm_optionals_data($item, $standarddatas)) {
$data = new stdClass();

View File

@ -33,26 +33,25 @@ function xmldb_scorm_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012032100) {
unset_config('updatetime', 'scorm');
upgrade_mod_savepoint(true, 2012032100, 'scorm');
}
// Adding completion fields to scorm table.
// Adding completion fields to scorm table
if ($oldversion < 2012032101) {
$table = new xmldb_table('scorm');
$field = new xmldb_field('completionstatusrequired', XMLDB_TYPE_INTEGER, '1',
XMLDB_UNSIGNED, null, null, null, 'timemodified');
$field = new xmldb_field('completionstatusrequired', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, 'timemodified');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('completionscorerequired', XMLDB_TYPE_INTEGER, '2',
XMLDB_UNSIGNED, null, null, null, 'completionstatusrequired');
$field = new xmldb_field('completionscorerequired', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, null, 'completionstatusrequired');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
@ -60,21 +59,22 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2012032101, 'scorm');
}
// Moodle v2.3.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Rename config var from maxattempts to maxattempt.
//rename config var from maxattempts to maxattempt
if ($oldversion < 2012061701) {
$maxattempts = get_config('scorm', 'maxattempts');
$maxattemptsadv = get_config('scorm', 'maxattempts_adv');
$maxattempts_adv = get_config('scorm', 'maxattempts_adv');
set_config('maxattempt', $maxattempts, 'scorm');
set_config('maxattempt_adv', $maxattemptsadv, 'scorm');
set_config('maxattempt_adv', $maxattempts_adv, 'scorm');
unset_config('maxattempts', 'scorm'); // Remove old setting.
unset_config('maxattempts_adv', 'scorm'); // Remove old setting.
unset_config('maxattempts', 'scorm'); //remove old setting.
unset_config('maxattempts_adv', 'scorm'); //remove old setting.
upgrade_mod_savepoint(true, 2012061701, 'scorm');
}
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this.

View File

@ -1001,29 +1001,18 @@ function scorm_pluginfile($course, $cm, $context, $filearea, $args, $forcedownlo
*/
function scorm_supports($feature) {
switch($feature) {
case FEATURE_GROUPS:
return false;
case FEATURE_GROUPINGS:
return false;
case FEATURE_GROUPMEMBERSONLY:
return true;
case FEATURE_MOD_INTRO:
return true;
case FEATURE_COMPLETION_TRACKS_VIEWS:
return true;
case FEATURE_COMPLETION_HAS_RULES:
return true;
case FEATURE_GRADE_HAS_GRADE:
return true;
case FEATURE_GRADE_OUTCOMES:
return true;
case FEATURE_BACKUP_MOODLE2:
return true;
case FEATURE_SHOW_DESCRIPTION:
return true;
case FEATURE_GROUPS: return false;
case FEATURE_GROUPINGS: return false;
case FEATURE_GROUPMEMBERSONLY: return true;
case FEATURE_MOD_INTRO: return true;
case FEATURE_COMPLETION_TRACKS_VIEWS: return true;
case FEATURE_COMPLETION_HAS_RULES: return true;
case FEATURE_GRADE_HAS_GRADE: return true;
case FEATURE_GRADE_OUTCOMES: return true;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
default:
return null;
default: return null;
}
}

View File

@ -237,8 +237,7 @@ echo html_writer::tag('title', 'LoadSCO');
e.innerHTML = --cSeconds;
} else {
clearInterval(timer);
document.body.innerHTML = "<p><?php echo get_string('activitypleasewait', " +
s"'scorm');?></p>";
document.body.innerHTML = "<p><?php echo get_string('activitypleasewait', 'scorm');?></p>";
location = "<?php echo $result ?>";
}
}, 1000);

View File

@ -20,12 +20,12 @@ require_once('../../config.php');
require_once($CFG->dirroot.'/mod/scorm/locallib.php');
require_once($CFG->libdir . '/completionlib.php');
$id = optional_param('cm', '', PARAM_INT); // Course Module ID, or
$a = optional_param('a', '', PARAM_INT); // scorm ID
$scoid = required_param('scoid', PARAM_INT); // sco ID
$mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode
$currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt.
$id = optional_param('cm', '', PARAM_INT); // Course Module ID, or
$a = optional_param('a', '', PARAM_INT); // scorm ID
$scoid = required_param('scoid', PARAM_INT); // sco ID
$mode = optional_param('mode', 'normal', PARAM_ALPHA); // navigation mode
$currentorg = optional_param('currentorg', '', PARAM_RAW); // selected organization
$newattempt = optional_param('newattempt', 'off', PARAM_ALPHA); // the user request to start a new attempt.
$displaymode = optional_param('display', '', PARAM_ALPHA);
if (!empty($id)) {
@ -211,8 +211,8 @@ if (empty($scorm->popup) || $displaymode == 'popup') {
$scorm->course, get_string('finishscormlinkname', 'scorm'));
echo $OUTPUT->box(get_string('finishscorm', 'scorm', $linkcourse), 'generalbox', 'altfinishlink');
}
echo html_writer::end_div(); // ...<!-- toctree -->.
echo html_writer::end_div(); // ...<!-- tocbox -->.
echo html_writer::end_div(); // Toc tree ends.
echo html_writer::end_div(); // Toc box ends.
echo html_writer::tag('noscript', html_writer::div(get_string('noscriptnoscorm', 'scorm'), '', array('id' => 'noscript')));
if ($result->prerequisites) {
@ -235,7 +235,7 @@ if ($result->prerequisites) {
} else {
echo $OUTPUT->box(get_string('noprerequisites', 'scorm'));
}
echo html_writer::end_div(); // ...<!-- SCORM page -->.
echo html_writer::end_div(); // Scorm page ends.
$scoes = scorm_get_toc_object($USER, $scorm, $currentorg, $sco->id, $mode, $attempt);
$adlnav = scorm_get_adlnav_json($scoes['scoes']);