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

A way for admin report plugins to specify where they appear in the admin tree

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      In each admin report plugin, there will be an optional file lib.php, which may define two variables:

      $placeintree = array('users', 'roles');
      $requirecapability = 'moodle/role:manage';

      If this was in admin/report/capability/lib.php, then it would say that the capability report appears under Users -> Permissions, and is only available to people with the moodle/role:manage capability.

      If lib.php does not exist, or either of these variables are not defined in that file, then the default is

      $placeintree = array('reports');
      $requirecapability = 'moodle/site:viewreports';

      The strings in the $placeintree array are the names passed to the admin_category constructor.

      Note that this has to work, even if reports want to add themselves to the experimental category, that is, reports need to be processed last when building the tree, although the reports category will remain second from last.

      As well as moving the new Capabilities report to Users -> Permissions, we will move Unit tests and Functional DB tests (and XMLDB editor, although that is not a report) to a new Developer top level category.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timhunt Tim Hunt added a comment -

            Actually, there was already a settings.php mechanism for admin reports to control how they were added to the admin tree, so I just used that.

            Changes made to the admin tree:

            • New Capability report put under Users -> Permissions
            • Miscellaneous category renamed to Development
            • Unit tests and Functional DB test moved to be under Development.
            • The hard-coded hack that was used to change the permission that controls the Backups and stats reports replaced with settings.php files.
            • There were two hidden Miscellaneous things in the old category, so I moved them. Multilan upgrade now under Lanuages, and Online assignment cleanup now under Plugins -> Activity modules. Both still hidden.
            Show
            timhunt Tim Hunt added a comment - Actually, there was already a settings.php mechanism for admin reports to control how they were added to the admin tree, so I just used that. Changes made to the admin tree: New Capability report put under Users -> Permissions Miscellaneous category renamed to Development Unit tests and Functional DB test moved to be under Development. The hard-coded hack that was used to change the permission that controls the Backups and stats reports replaced with settings.php files. There were two hidden Miscellaneous things in the old category, so I moved them. Multilan upgrade now under Lanuages, and Online assignment cleanup now under Plugins -> Activity modules. Both still hidden.
            Hide
            timhunt Tim Hunt added a comment -

            Also, the place where admin reports are included in the tree moved from admin/settings/top.php to lib/adminlib.php, so they get added last, and so can choose anywhere in the tree to be added.

            Show
            timhunt Tim Hunt added a comment - Also, the place where admin reports are included in the tree moved from admin/settings/top.php to lib/adminlib.php, so they get added last, and so can choose anywhere in the tree to be added.
            Hide
            skodak Petr Skoda added a comment -

            I like the Development renaming. do you have a patch for review?

            Show
            skodak Petr Skoda added a comment - I like the Development renaming. do you have a patch for review?
            Hide
            skodak Petr Skoda added a comment -

            +1 for commit into HEAD, thanks

            Show
            skodak Petr Skoda added a comment - +1 for commit into HEAD, thanks

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10