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

Move course category creation to separate function

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.3
    • Component/s: Course, Enrolments
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      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
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-29044-master-3

      Description

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12