Permalink
Browse files

Fixed bug MDL-8725 and fixed some typo in regulars expressions in cmi…

….objectives elements store and retrieve
  • Loading branch information...
bobopinna
bobopinna committed Mar 13, 2007
1 parent 2a0a625 commit b40f8bad2f358c132d9ce16b3c8180c2a1b8df45
Showing with 16 additions and 5 deletions.
  1. +2 −2 mod/scorm/datamodel.php
  2. +2 −2 mod/scorm/datamodels/scorm_13.js.php
  3. +11 −0 mod/scorm/db/upgrade.php
  4. +1 −1 mod/scorm/version.php
View
@@ -42,8 +42,8 @@
foreach ($_POST as $element => $value) {
$element = str_replace('__','.',$element);
if (substr($element,0,3) == 'cmi') {
- $element = preg_replace('/N(\d+)/',".\$1",$element);
- $result = scorm_insert_track($USER->id, $scorm->id, $scoid, $attempt, $element, $value) && $result;
+ $netelement = preg_replace('/\.N(\d+)\./',"\.\$1\.",$element);
+ $result = scorm_insert_track($USER->id, $scorm->id, $scoid, $attempt, $netelement, $value) && $result;
}
if (substr($element,0,15) == 'adl.nav.request') {
// SCORM 2004 Sequencing Request
@@ -166,8 +166,8 @@ function SCORMapi1_3() {
$objectives = '';
foreach($userdata as $element => $value){
if (substr($element,0,14) == 'cmi.objectives') {
- preg_match('/.(\d+)./',$element,$matches);
- $element = preg_replace('/.(\d+)./',".N\$1.",$element);
+ preg_match('/\.(\d+)\./',$element,$matches);
+ $element = preg_replace('/\.(\d+)\./',".N\$1.",$element);
if ($matches[1] == $count) {
$count++;
$end = strpos($element,$matches[1])+strlen($matches[1]);
View
@@ -250,6 +250,17 @@ function xmldb_scorm_upgrade($oldversion=0) {
}
}
+ if ($result && $oldversion < 2007031300) {
+ $tracks = get_records('scorm_scoes_track');
+ foreach ($tracks as $track) {
+ $element = preg_replace('/\.N(\d+)\./',".\$1.",$track->element);
+ if ($track->element != $element) {
+ $track->element = $element;
+ update_record('scorm_scoes_track',$track);
+ }
+ }
+ }
+
return $result;
}
View
@@ -10,7 +10,7 @@
// catch up now, so until 27th October please only increment in very tiny steps
// in HEAD, until we get past that date..
-$module->version = 2007020200; // The (date) version of this module
+$module->version = 2007031300; // The (date) version of this module
$module->requires = 2007020200; // The version of Moodle that is required
$module->cron = 300; // How often should cron check this module (seconds)?

0 comments on commit b40f8ba

Please sign in to comment.