-
Bug
-
Resolution: Fixed
-
Minor
-
2.7.3
-
MOODLE_27_STABLE
-
MOODLE_31_STABLE, MOODLE_32_STABLE
-
master_
MDL-49557 -
When importing an AICC course with a .pre descriptor I get a "Default exception handler: Error writing to database Debug: Column 'identifier' cannot be null".
After some debug it turns out that the relevant part of aicclib.php contains a logical error in line 253:
$courses[$courseid]->elements[$columns->mastercol + 1]->prerequisites = substr(trim($matches[2 - $columns->mastercol]), 1, -1);
|
should be
$courses[$courseid]->elements[substr(trim($matches[$columns->mastercol+1]), 1, -1)]->prerequisites = substr(trim($matches[1-$columns->mastercol+1]), 1, -1);
|
After this correction the import works fine, but then you get an error on the page displaying the AICC course structure: in locallib.php a call to scorm_eval_prerequisites() can't find the function, since this is contained in scorm_12lib.php that's not included when in AICC mode.
So you need to add:
require_once($CFG->dirroot.'/mod/scorm/datamodels/scorm_12lib.php');
|
at the very start of aicclib.php.
After this couple of edits everything works as expected: the AICC package containing a .pre descriptor file is loaded in Moodle without any error, and the prerequisites are honored when playing the course.
The code should also be consolidated because it expects the values in files to be quoted and without any space between values, while in datatype CMIFormatCSV «Field data may or may not be enclosed in double-quotes (“”). Field data must be enclosed in double quotes if it contains leading/trailing spaces or commas (“,”s). Leading/trailing space on unquote field data is ignored.»
- has a non-specific relationship to
-
MDL-51018 SCORM convert php eval() to use EvalMath Class
- Closed