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

Move course category creation to separate function

XMLWordPrintable

    • Any
    • MOODLE_21_STABLE
    • MOODLE_23_STABLE
    • MDL-29044-master-3
    • Easy
    • Hide

      Run supplied unit tests first:

      • Navigate to Settings -> Site Administration -> Courses -> Add/edit courses
      • Add new category
      • Create a new category at 'Top'
        • Name the category 'MDL-29044-1'
        • Confirm that the new category was created in the 'Top' course category
      • Add another new category
        • Name the category 'MDL-29044-2'
        • Create this new category under MDL-29044-1 to confirm that parenting works
        • Confirm that the new category was created within MDL-29044-1
      • Add another new category
      Show
      Run supplied unit tests first: Navigate to Settings -> Site Administration -> Courses -> Add/edit courses Add new category Create a new category at 'Top' Name the category ' MDL-29044 -1' Confirm that the new category was created in the 'Top' course category Add another new category Name the category ' MDL-29044 -2' Create this new category under MDL-29044 -1 to confirm that parenting works Confirm that the new category was created within MDL-29044 -1 Add another new category Name the category ' MDL-29044 -0' Create this new category under MDL-29044 -1 Confirm that the new category was created within MDL-29044 -1 Confirm that categories are listed in the order MDL-29044 -2, MDL-29044 -0

      As requested by Petr in MDL-28516, we ideally need to move course category creation to a separate function to support creating course categories in enrolment plugins (and anywhere else too).

      This patch creates a new function in course/lib.php called create_course_category().
      At present it marks the created context as dirty, but does not call fix_course_sortorder. This is because course/editcategory.php (which is the only place which calls this code) calls this regardless of whether a course category is created, or edited.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Andrew Davis Andrew Davis
            Sam Hemelryk Sam Hemelryk
            Ankit Agarwal Ankit Agarwal
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.