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

$cm from get_fast_modinfo should include all fields

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Course
    • Labels:
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      There are a few variables which are included in $cm if you get it using get_record from the course_modules table (& similar approaches), but are not included if you get it via get_fast_modinfo.

      These are:

      • Three completion settings (this causes problems if you try to call some completion-related functions using a $cm from get_fast_modinfo)
      • $cm->section (section id; it does have section number) - this used to cause a problem in nav block but it was fixed a different way because not really necessary there, however there might be other areas of code where this would cause a problem if we called specific functions with a cm_info
      • $cm->added (date added)
      • $cm->score (value appears to be unused)
      • $cm->module (module id)
      • $cm->visibleold (previous value of visibility for individual item when section is hidden)

      In order to allow third-party code (and potentially core code) to reliably use get_fast_modinfo to create $cm objects, I would like to add support for passing through these parameters.

      In addition I would like to change the existing logic (it's in the same code) around rebuilding the course cache if user changes the $CFG->enableavailability. IMO it is better to do this when changing the admin setting. I added a new option to admin setting base class so that you can set if a particular admin setting affects modinfo and therefore requires this rebuild.

      Note that these changes unfortunately slightly increase the size of modinfo. Most of these values default to 0/empty so will not take any space but section, module, added, and visibleold will usually be set, adding 4 data items to each modinfo entry.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/May/11