DomCI : Update all the PHPDoc
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3279 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
70
config.php
70
config.php
@@ -6,22 +6,22 @@
|
||||
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
|
||||
The DocType allow to define the configuration HTML page. It must contains
|
||||
@param : the name of the parameter
|
||||
@description : the textual description of the parameter
|
||||
@type : the type of the parameter (string, integer, array)
|
||||
@values : an array containing the allowed values to the parameter. Can be
|
||||
a function like timezone_identifiers_list
|
||||
@default : the default value (can be an array or a string or a number)
|
||||
@group : Group all the parameters in a group
|
||||
POC :
|
||||
$config = new config();
|
||||
$config->default = array ("param"=>"default",
|
||||
"param2"=>array (1,2,3),
|
||||
"param3"=>null);
|
||||
$var = $config->get ("param");
|
||||
* file
|
||||
* It is based on the module configuration defaults
|
||||
* The DocType allow to define the configuration HTML page. It must contains
|
||||
* @param : the name of the parameter
|
||||
* @description : the textual description of the parameter
|
||||
* @type : the type of the parameter (string, integer, array)
|
||||
* @values : an array containing the allowed values to the parameter. Can be
|
||||
* a function like timezone_identifiers_list
|
||||
* @default : the default value (can be an array or a string or a number)
|
||||
* @group : Group all the parameters in a group
|
||||
* POC :
|
||||
* $config = new config();
|
||||
* $config->default = array ("param"=>"default",
|
||||
* "param2"=>array (1,2,3),
|
||||
* "param3"=>null);
|
||||
* $var = $config->get ("param");
|
||||
*/
|
||||
class config
|
||||
{
|
||||
@@ -30,7 +30,8 @@ class config
|
||||
/** Use the .php to protect the information */
|
||||
public $confFile = null;
|
||||
|
||||
/** Select the configuration file */
|
||||
/** Select the configuration file
|
||||
*/
|
||||
public function selectConfFile ()
|
||||
{
|
||||
if ($this->confFile !== null)
|
||||
@@ -45,14 +46,16 @@ class config
|
||||
$this->confFile = "./data/configuration.php";
|
||||
}
|
||||
|
||||
/** List all the parameters configurable in the software */
|
||||
/** List all the parameters configurable in the software
|
||||
*/
|
||||
public function params ()
|
||||
{
|
||||
$this->selectConfFile ();
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
/** Return the defined values */
|
||||
/** Return the defined values
|
||||
*/
|
||||
public function getAll ()
|
||||
{
|
||||
$this->selectConfFile ();
|
||||
@@ -64,8 +67,9 @@ class config
|
||||
}
|
||||
|
||||
/** Get the value of the provided parameter recorded in .php file
|
||||
If it is not set in .php file, use the default value
|
||||
@param string $param The option name to be returned */
|
||||
* If it is not set in .php file, use the default value
|
||||
* @param string $param The option name to be returned
|
||||
*/
|
||||
public function get ($param)
|
||||
{
|
||||
$this->selectConfFile ();
|
||||
@@ -125,10 +129,11 @@ class config
|
||||
}
|
||||
|
||||
/** Define a value for the parameter in the config file. Add all the default
|
||||
values if they are not defined
|
||||
@param string $param The option name
|
||||
@param mixed $value The option value
|
||||
@return TRUE if the parameter is saved or an exception */
|
||||
* values if they are not defined
|
||||
* @param string $param The option name
|
||||
* @param mixed $value The option value
|
||||
* @return TRUE if the parameter is saved or an exception
|
||||
*/
|
||||
public function set ($param, $value)
|
||||
{
|
||||
$this->selectConfFile ();
|
||||
@@ -171,9 +176,10 @@ class config
|
||||
}
|
||||
|
||||
/** Display the $values in PHP format to be "require" easily
|
||||
@param mixed $values Values to be recorded
|
||||
@param string $phpcode Actual value of the php code
|
||||
@param integer $indent Number of spaces in the indentation of config */
|
||||
* @param mixed $values Values to be recorded
|
||||
* @param string $phpcode Actual value of the php code
|
||||
* @param integer $indent Number of spaces in the indentation of config
|
||||
*/
|
||||
private function writePHP ($values, $phpcode, $indent)
|
||||
{
|
||||
foreach ($values as $key=>$val)
|
||||
@@ -207,7 +213,9 @@ class config
|
||||
return $phpcode;
|
||||
}
|
||||
|
||||
/** Convert a string to the right PHP type, without using the eval function */
|
||||
/** Convert a string to the right PHP type, without using the eval function
|
||||
* @param string $values The string to convert
|
||||
*/
|
||||
private function strToType ($values)
|
||||
{
|
||||
$values = str_replace ("array (", "array(", $values);
|
||||
@@ -260,7 +268,9 @@ class config
|
||||
}
|
||||
|
||||
/** Return an array containing the definitions read from the default config
|
||||
file */
|
||||
* file
|
||||
* @param string $modelFile The file model to read
|
||||
*/
|
||||
public function docComment ($modelFile)
|
||||
{
|
||||
$debug = 0;
|
||||
|
||||
Reference in New Issue
Block a user