diff options
author | Simon Rettberg | 2016-05-13 18:24:08 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-05-13 18:24:08 +0200 |
commit | 7d916647e1b82fcc8a17b68d3ae0615af42f53e0 (patch) | |
tree | da83387a203c3b25980c4a5068418862c2b6a0a9 /modules-available/baseconfig/inc/baseconfigutil.inc.php | |
parent | Still working in modularization cleanup and refinement (diff) | |
download | slx-admin-7d916647e1b82fcc8a17b68d3ae0615af42f53e0.tar.gz slx-admin-7d916647e1b82fcc8a17b68d3ae0615af42f53e0.tar.xz slx-admin-7d916647e1b82fcc8a17b68d3ae0615af42f53e0.zip |
Get baseconfig ready for modularization
Diffstat (limited to 'modules-available/baseconfig/inc/baseconfigutil.inc.php')
-rw-r--r-- | modules-available/baseconfig/inc/baseconfigutil.inc.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/modules-available/baseconfig/inc/baseconfigutil.inc.php b/modules-available/baseconfig/inc/baseconfigutil.inc.php new file mode 100644 index 00000000..33875156 --- /dev/null +++ b/modules-available/baseconfig/inc/baseconfigutil.inc.php @@ -0,0 +1,42 @@ +<?php + +class BaseConfigUtil +{ + + /** + * Return all config variables to be handled directly by the baseconfig edit module. + * The array will contain a list of mapping of type: + * VARNAME => array( + * catid => xx, + * defaultvalue => xx, + * permissions => xx, + * validator => xx, + * ) + * + * @return array all known config variables + */ + public static function getVariables() + { + $settings = array(); + foreach (glob('modules/*/baseconfig/settings.json', GLOB_NOSORT) as $file) { + $data = json_decode(file_get_contents($file), true); + if (is_array($data)) { + $settings += $data; + } + } + return $settings; + } + + public static function getCategories() + { + $categories = array(); + foreach (glob('modules/*/baseconfig/categories.json', GLOB_NOSORT) as $file) { + $data = json_decode(file_get_contents($file), true); + if (is_array($data)) { + $categories += $data; + } + } + return $categories; + } + +}
\ No newline at end of file |