Merge branch 'master_MDL-49557' of git://github.com/danmarsden/moodle
authorDavid Monllao <david.monllao@gmail.com>
Wed, 4 Jan 2017 05:02:44 +0000 (06:02 +0100)
committerDan Poltawski <dan@moodle.com>
Wed, 4 Jan 2017 11:34:00 +0000 (11:34 +0000)
mod/scorm/datamodels/aicclib.php

index 354018c..d06cd5c 100644 (file)
@@ -251,8 +251,12 @@ 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)) {
-                    $elementid = substr(trim($matches[$columns->mastercol + 1]), 1, -1);
-                    $prereq = substr(trim($matches[2 - $columns->mastercol]), 1, -1);
+                    $elementid = trim($matches[$columns->mastercol + 1]);
+                    $elementid = trim(trim($elementid, '"'), "'"); // Remove any quotes.
+
+                    $prereq = trim($matches[2 - $columns->mastercol]);
+                    $prereq = trim(trim($prereq, '"'), "'"); // Remove any quotes.
+
                     $courses[$courseid]->elements[$elementid]->prerequisites = $prereq;
                 }
             }