Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-49557

AICC prerequisites don't work, aicclib.php needs a couple of tweaks.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: 3.1.4, 3.2.1
    • Component/s: SCORM
    • Labels:
    • Testing Instructions:
      Hide

      Add the AICC packages linked in the description to a course - make sure that adding the packages does not throw a db level error. NOTE: these packages do not contain any content and you will see a blank page on entering. Just make sure no DB level errors occur.

      Also - run through the test in MDLQA-8720

      Show
      Add the AICC packages linked in the description to a course - make sure that adding the packages does not throw a db level error. NOTE: these packages do not contain any content and you will see a blank page on entering. Just make sure no DB level errors occur. Also - run through the test in MDLQA-8720
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull Master Branch:
      master_MDL-49557

      Description

      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.»

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jan/17