config : read the configuration from data or datas

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2092 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-04-29 09:38:29 +00:00
parent e35e3c0e5b
commit 2fedd63db4

View File

@@ -3,6 +3,8 @@
@package domframework
@author Dominique Fournier <dominique@fournier38.fr> */
require_once ("domframework/form.php");
/** Manage the configurations of the module done by administrator in a config
file
It is based on the module configuration defaults
@@ -26,6 +28,10 @@ class config
{
if (defined("CONFIGFILE"))
$this->confFile = CONFIGFILE;
if (file_exists ("./datas/configuration.php"))
$this->confFile = "./datas/configuration.php";
elseif (file_exists ("./data/configuration.php"))
$this->confFile = "./data/configuration.php";
}
/** List all the parameters configurable in the software */
@@ -144,4 +150,25 @@ class config
return $phpcode;
}
/** Return an array of fields */
private function configRead ($params)
{
$fields = array ();
foreach ($params as $p1=>$vals1)
{
if (is_array ($vals1))
{
$fields = array_merge ($fields, $this->configRead ($vals1));
}
else
{
$field = new formfield ($vals1, $vals1);
$field->group = $p1;
$fields[] = $field;
unset ($field);
}
}
return $fields;
}
}