Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Admin settings: Difference between revisions

From MoodleDocs
(New page: Moodle's configuration is stored in a mixture of the config, config_plugins, and a few other tables. These settings are edited through the administration screens, which can be accessed by ...)
 
No edit summary
Line 11: Line 11:
In my experience most of this code is pretty easy to understand and work with, so here I will focus of giving an overview. For details, see the code.
In my experience most of this code is pretty easy to understand and work with, so here I will focus of giving an overview. For details, see the code.


==The admin tree==
==The admin tree - building blocs==


All the settings are arranged into a tree structure. This tree structure is represented in memory as a tree of PHP objects.
All the settings are arranged into a tree structure. This tree structure is represented in memory as a tree of PHP objects.
Line 21: Line 21:
Admin categories contain other categories, '''admin_settingpage'''s, and '''admin_externalpage'''s.
Admin categories contain other categories, '''admin_settingpage'''s, and '''admin_externalpage'''s.


Settings pages contiain invidual settings.
Settings pages contain individual '''admin_setting'''s.
 
admin_setting is a base class with lots of subclasses like '''admin_setting_configtext''', '''admin_setting_configcheckbox''', and so on.
 
'''The rest of the page still needs to be written, I am on the case ...'''
 
==The admin tree - contents==

Revision as of 10:28, 18 September 2008

Moodle's configuration is stored in a mixture of the config, config_plugins, and a few other tables. These settings are edited through the administration screens, which can be accessed by going to the .../admin/index.php URL on your moodle site, or using the Administration block that appears to administrators of the Moodle front page. This page explains how the code for displaying and editing of these settings works.

Where to find the code

This is explained further below, but in summary:

  • The library code is all in lib/adminlib.php.
  • The definition of the all the parts of the admin tree is in admin/settings/* some of which call out to plugins to see if they have settings they want to add.
  • The editing and saving of settings is managed by admin/settings.php, admin/upgradesettings.php, and admin/search.php.
  • The administration blocks that appear on the front page and on most of the admin streens is in blocks/admin_tree and blocks/admin_bookmarks.

In my experience most of this code is pretty easy to understand and work with, so here I will focus of giving an overview. For details, see the code.

The admin tree - building blocs

All the settings are arranged into a tree structure. This tree structure is represented in memory as a tree of PHP objects.

At the root of the tree is an admin_root object.

That has children that are admin_categorys.

Admin categories contain other categories, admin_settingpages, and admin_externalpages.

Settings pages contain individual admin_settings.

admin_setting is a base class with lots of subclasses like admin_setting_configtext, admin_setting_configcheckbox, and so on.

The rest of the page still needs to be written, I am on the case ...

The admin tree - contents