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

scorm_get_toc rewrite

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3
    • 2.4
    • SCORM

    Description

      scorm_get_toc needs a rewrite as it doesn't always generate valid html for complex scorm packages and doesn't contain the information in a easy to parse manner for other functions (like seq/nav for SCORM 2004)

      We need at least 3 new functions.
      scorm_get_toc_object()
      this should be based on the existing scorm_get_toc but instead of generating html, it should generate an object that can be parsed to create the html - this function should take the data from a call to scorm_get_scoes and return each sco in a formatted object with these extra params:

      $sco->url = ''; //this isn't a full url, just the bits required to link to the sco - this is what is inserted into the 'title' tag in the yui treeview.
      $sco->statusicon = '<img>'; //this is the status icon that should be displayed with the sco
      $sco->children = array() - this contains an array of any children $scos formatted in a similar way.

      Then a separate function
      scorm_format_toc_for_treeview()
      which takes the output of scorm_get_toc_object() and generates the html used by the YUI treeview object.

      Then a separate function
      scorm_format_toc_for_droplist()
      which generates a drop list used by $result->tocmenu for the drop list nav item.

      Finally another function scorm_get_toc_new() - this function should return the exact same information as the existing scorm_get_toc() but using the new functions above so we can easily swap between using the old scorm_get_toc() and the new scorm_get_toc_new()

      these functions should all be in mod/scorm/locallib.php and the changes shouldn't modify any existing functions. It is preferred if the existing functions don't do what is required then we duplicate that existing function under a new name and change the "new" copy of that function. Doing this means we can compare the existing scorm_get_toc with the new code to make sure the new one operates as expected.

      Attachments

        Issue Links

          Activity

            People

              danmarsden Dan Marsden
              danmarsden Dan Marsden
              Dan Poltawski Dan Poltawski
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3/Dec/12