Class: I2CE Util (Development): Difference between revisions
(Created page with '{{otherversions|Class: I2CE_Util}} This article describes the class ''I2CE_Util'' . *Location: Part of the module I2CE in the package [htt…') |
No edit summary |
||
Line 1: | Line 1: | ||
{{otherversions|Class: I2CE_Util}} | {{otherversions|Class: I2CE_Util}} | ||
This article describes the class ''I2CE_Util'' . | This article describes the class ''I2CE_Util'' . | ||
*Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE] 4. | *Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE] 4.1-dev | ||
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L31 lib/I2CE_Util.php] on line 31 | ||
*Author: Carl Leitner <litlfred@ibiblio.org> | *Author: Carl Leitner <litlfred@ibiblio.org> | ||
I2CE_Util @todo Better documentation | I2CE_Util @todo Better documentation | ||
Line 8: | Line 8: | ||
===array_unique()=== | ===array_unique()=== | ||
array unique which respects multi-dimensional arrays from: the link http://us.php.net/manual/en/function.array-unique.php#84750 sda | array unique which respects multi-dimensional arrays from: the link http://us.php.net/manual/en/function.array-unique.php#84750 sda | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L74 i2ce/lib/I2CE_Util.php] on line 74 | ||
*Signature: static public function array_unique($arr) | *Signature: static public function array_unique($arr) | ||
*Parameters: | *Parameters: | ||
Line 14: | Line 14: | ||
===convertLikeToRegExp()=== | ===convertLikeToRegExp()=== | ||
Convers a sql like statement to a regular expression | Convers a sql like statement to a regular expression | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L503 i2ce/lib/I2CE_Util.php] on line 503 | ||
*Signature: static public function convertLikeToRegExp($like,$escape) | *Signature: static public function convertLikeToRegExp($like,$escape) | ||
*Parameters: | *Parameters: | ||
Line 23: | Line 23: | ||
===explodeAndExecuteSQLQueries()=== | ===explodeAndExecuteSQLQueries()=== | ||
Explode and execute a | Explode and execute a | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L270 i2ce/lib/I2CE_Util.php] on line 270 | ||
*Signature: static public function explodeAndExecuteSQLQueries($sql,$db,$transact,$delimiter) | *Signature: static public function explodeAndExecuteSQLQueries($sql,$db,$transact,$delimiter) | ||
*Parameters: | *Parameters: | ||
Line 35: | Line 35: | ||
===flattenVariables()=== | ===flattenVariables()=== | ||
Flatten variables. Transforms an array of variables of a nested array ['key1']['key2']['key3'] to an array with keys of the form 'key1:key2:key3' | Flatten variables. Transforms an array of variables of a nested array ['key1']['key2']['key3'] to an array with keys of the form 'key1:key2:key3' | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L102 i2ce/lib/I2CE_Util.php] on line 102 | ||
*Signature: static public function flattenVariables($vars,$flat,$encode,$skip_empty,$prefix) | *Signature: static public function flattenVariables($vars,$flat,$encode,$skip_empty,$prefix) | ||
*Parameters: | *Parameters: | ||
Line 48: | Line 48: | ||
===merge_recursive()=== | ===merge_recursive()=== | ||
Performs a recursive array merge which _overwrites_ values, not appends them ( the behaviour of array_merge_recursive). Warning: This is not a symmetric operation. Any multi-index that exists in $a and in $b will result that the value in $a will be overwritten by the value in $a | Performs a recursive array merge which _overwrites_ values, not appends them ( the behaviour of array_merge_recursive). Warning: This is not a symmetric operation. Any multi-index that exists in $a and in $b will result that the value in $a will be overwritten by the value in $a | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L45 i2ce/lib/I2CE_Util.php] on line 45 | ||
*Signature: static public function merge_recursive($a,$b,$addNew,$addEmpty) | *Signature: static public function merge_recursive($a,$b,$addNew,$addEmpty) | ||
*Parameters: | *Parameters: | ||
Line 59: | Line 59: | ||
===runSQLScript()=== | ===runSQLScript()=== | ||
Executes a script | Executes a script | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L194 i2ce/lib/I2CE_Util.php] on line 194 | ||
*Signature: static public function runSQLScript($file,$database,$transact,$dsn,$delimiter) | *Signature: static public function runSQLScript($file,$database,$transact,$dsn,$delimiter) | ||
*Parameters: | *Parameters: | ||
Line 74: | Line 74: | ||
===transformVariables()=== | ===transformVariables()=== | ||
Transforms an array of variables with keys of the form 'key1:key2:key3' into a nested array ['key1']['key2']['key3'] | Transforms an array of variables with keys of the form 'key1:key2:key3' into a nested array ['key1']['key2']['key3'] | ||
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4. | *Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_Util.php#L136 i2ce/lib/I2CE_Util.php] on line 136 | ||
*Signature: static public function transformVariables($vars) | *Signature: static public function transformVariables($vars) | ||
*Parameters: | *Parameters: |
Latest revision as of 08:20, 6 May 2015
This article describes the class I2CE_Util .
- Location: Part of the module I2CE in the package I2CE 4.1-dev
- Source: Defined in the file lib/I2CE_Util.php on line 31
- Author: Carl Leitner <litlfred@ibiblio.org>
I2CE_Util @todo Better documentation
Methods
array_unique()
array unique which respects multi-dimensional arrays from: the link http://us.php.net/manual/en/function.array-unique.php#84750 sda
- Defined in i2ce/lib/I2CE_Util.php on line 74
- Signature: static public function array_unique($arr)
- Parameters:
- $arr
convertLikeToRegExp()
Convers a sql like statement to a regular expression
- Defined in i2ce/lib/I2CE_Util.php on line 503
- Signature: static public function convertLikeToRegExp($like,$escape)
- Parameters:
- Returns: string
explodeAndExecuteSQLQueries()
Explode and execute a
- Defined in i2ce/lib/I2CE_Util.php on line 270
- Signature: static public function explodeAndExecuteSQLQueries($sql,$db,$transact,$delimiter)
- Parameters:
- string $sql
a nuch of sql queries - $db
- boolean $transact
defaults to true meaning that the whole script is executed in a transaction. If a string, it is the name of a savepoint to rollback to/release @param MDB2 connection $db- Default Value: true
- string $delimiter
Defaults to ';'. Needs to be exactly one character- Default Value: ';'
- string $sql
- Returns: boolean
true on sucess or false
flattenVariables()
Flatten variables. Transforms an array of variables of a nested array ['key1']['key2']['key3'] to an array with keys of the form 'key1:key2:key3'
- Defined in i2ce/lib/I2CE_Util.php on line 102
- Signature: static public function flattenVariables($vars,$flat,$encode,$skip_empty,$prefix)
- Parameters:
- array $vars
the variables to flatten. - array &$flat
The array to store the falttened variables in - boolean $encode
Set to true (default) if we should urlencode the values- Default Value: true
- boolean $skip_empty
Set to true (default) skip empty values- Default Value: true
- string $prefix
Defaults to ;- Default Value:
- array $vars
merge_recursive()
Performs a recursive array merge which _overwrites_ values, not appends them ( the behaviour of array_merge_recursive). Warning: This is not a symmetric operation. Any multi-index that exists in $a and in $b will result that the value in $a will be overwritten by the value in $a
- Defined in i2ce/lib/I2CE_Util.php on line 45
- Signature: static public function merge_recursive($a,$b,$addNew,$addEmpty)
- Parameters:
runSQLScript()
Executes a script
- Defined in i2ce/lib/I2CE_Util.php on line 194
- Signature: static public function runSQLScript($file,$database,$transact,$dsn,$delimiter)
- Parameters:
- string $file
The SQL file to execute -- it must lie in the fileSearch's SQL category (this is ensured by addinging it to a <path name='sql'> node in the configuration XML - string $database
If non-null it will connect to the named database.- Default Value: null
- mixed $transact
defaults to true meaning that the whole script is executed in a transaction. If a string, it is the name of a save point to use (assumes you are already in a transaction)- Default Value: true
- string $dsn
An option DSN to connect on. If set $database is ignored. it will use whatever database is refered to by the MDB2::singleton()- Default Value: null
- string $delimiter
Defaults to ';' Needs to be exactly one character- Default Value: ';'
- string $file
- Returns: boolean
true on sucess, false on failure
transformVariables()
Transforms an array of variables with keys of the form 'key1:key2:key3' into a nested array ['key1']['key2']['key3']
- Defined in i2ce/lib/I2CE_Util.php on line 136
- Signature: static public function transformVariables($vars)
- Parameters:
- array $vars
- Returns: array