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:
27
config.php
27
config.php
@@ -3,6 +3,8 @@
|
|||||||
@package domframework
|
@package domframework
|
||||||
@author Dominique Fournier <dominique@fournier38.fr> */
|
@author Dominique Fournier <dominique@fournier38.fr> */
|
||||||
|
|
||||||
|
require_once ("domframework/form.php");
|
||||||
|
|
||||||
/** Manage the configurations of the module done by administrator in a config
|
/** Manage the configurations of the module done by administrator in a config
|
||||||
file
|
file
|
||||||
It is based on the module configuration defaults
|
It is based on the module configuration defaults
|
||||||
@@ -26,6 +28,10 @@ class config
|
|||||||
{
|
{
|
||||||
if (defined("CONFIGFILE"))
|
if (defined("CONFIGFILE"))
|
||||||
$this->confFile = 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 */
|
/** List all the parameters configurable in the software */
|
||||||
@@ -144,4 +150,25 @@ class config
|
|||||||
|
|
||||||
return $phpcode;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user