Administration

Overview

The Administration class is used to manage settings stored in the database ‘config’ table.

The Administration Class

The Administration class is located in ‘modules/Administration/Administration.php’. Settings modified using this class are written to the ‘config’ table..

Creating / Updating Settings

To create or update a specific setting, you can specify the new value using the Administraton ‘saveSetting’ function as shown below:
require_once('modules/Administration/Administration.php');

$administrationObj = new Administration();

//save the setting
$administrationObj->saveSetting("MyCategory", "MySetting", 'MySettingsValue');

Retrieving Settings

You can access the config settings by using the Administration ‘retrieveSettings’ function. You can filter the settings by category by passing in filter a parameter. If no value is passed to ‘retrieveSettings’, all settings will be returned. An example is show below:
require_once('modules/Administration/Administration.php');

$administrationObj = new Administration();

//Retrieve all settings in the category of 'MyCategory'.
//This parameter can be left empty to retrieve all settings.
$administrationObj->retrieveSettings('MyCategory');

//Use a specific setting
$MySetting = $administrationObj->settings['MyCategory_MySetting'];

Considerations

When looking to store custom settings, the administration class will store the settings in the ‘config’ table. Alternatively, you can use the Configurator class located in ./modules/Configurator/Configurator.php to store the settings in the ‘config_override.php’ file.