Moodle
  1. Moodle
  2. MDL-17533

modify database and a few core file to prepare for supporting to list courses in multiple categories

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      9520

      Description

      Functionality that would allow listing a course in multiple categories has been requested for a long time (at least since Moodle 1.4 as evidenced by the MDL_2231 and numerous discussions on the forums). I have this functionality implemented in Moodle 1.5 and it works really well for the past few years . I am hereby proposing here a few to the database and a few core files to provide foundation for proper implementation of that feature. The proposed changes do not affect the current operation. However, with these changes in place, I will be able to create a hack/patch to prepare for implementing it properly in a future release.

      1. Add a new table mdl_course_category with the following fields (see attached pic for this table in Moodle 1.5)

      id – bigint(10) – the usual running id for a given table
      course – bigint(10) – the id field from mdl_course
      category – bigint(10) – the category field from mdl_course (in turn id field in mdl_course_categories)
      sortorder – bigint(10) – the sortorder field from mdl_course
      visiblehere - tinyint(1) – new field to control visibility of course in a given category

      The new field visiblehere is needed since a course can be visible in one but not in another category. This field will not be used for now.

      2. Modify the Moodle upgrade script to

      a) create the above table automatically upon version upgrade
      b) create a record in the new table for each record in the mdl_course table copying the values as listed in item 1.
      c) remove field sortorder and category from the mdl_course table

      3. Modify the course backup and restore functions to support new table

      a. backup must write the new table out
      b. restore must enter values into the new table for all restores, that is copying data to new table for pre-version2 backups

      4. Modify the course/category.php (and any related files if needed) to use the new table instead of mdl_course for handling category assignments and sorting courses within category

      I think this is all.

        Issue Links

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: