![]() |
Xataface 2.0
Xataface Application Framework
|
Static Public Member Functions | |
static | groupBy ($fieldname, $records, $order=array(), $titles=array()) |
static | query2html ($query, $keyFilter=array()) |
static | flattenQuery ($in, &$out, $path=array()) |
static | fireEvent ($name, $params=array()) |
static | quoteIdent ($ident) |
static | redirect ($msg=null, $error=null) |
Contains Utility functions.
Definition at line 26 of file Utilities.php.
static fireEvent | ( | $ | name, |
$ | params = array() |
||
) | [static] |
Fires an event on the delegate classes. In effect, this calls a method called $name on the current table's delegate class if it exists - otherwise it will call the function on the application's delegate class - if it exists.
string | $name | The name of the event. Must be valid method name in a delegate class. |
Definition at line 202 of file Utilities.php.
static flattenQuery | ( | $ | in, |
&$ | out, | ||
$ | path = array() |
||
) | [static] |
Flattens the variables of a query so that they can be written safely to an HTML form.
E.g.: [ 'userid'=>10, 'FirstName'=>'Steve', 'LastName'=>'Hannah', 'Address'=> [ 'Country'=>'Canada', 'Province'=>'BC' ] ]
would be converted to: [ 'userid'=>10, 'FirstName'=>'Steve', 'LastName'=>'Hannah', 'Address[Country]'=>'Canada', 'Address[Province]'=>'BC' ]
array | $in | The input query array. |
array | &$out | The output query array. |
$path | $path An array representing the path of the current element since this method uses itself recursively. |
Definition at line 167 of file Utilities.php.
static groupBy | ( | $ | fieldname, |
$ | records, | ||
$ | order = array() , |
||
$ | titles = array() |
||
) | [static] |
Groups an array of records by a field.
string | $fieldname | The name of the field on which to group the records. |
array | $records | The array of records. This may be an array of associative arrays, an array of Dataface_Record objects, or an array of Dataface_RelatedRecord objects. |
Definition at line 38 of file Utilities.php.
static query2html | ( | $ | query, |
$ | keyFilter = array() |
||
) | [static] |
Converts an query array into a string with a bunch of HTML hidden fields to be placed on an HTML form.
E.g.: $html = Dataface_Utilities::query2Html( array('FirstName'=>'Steve', 'LastName'=>'Hannah', 'Address'=>array('Country'=>'Canada', 'Province'=>'BC') ) );
echo $html;
Would output: <input type="hidden" name="FirstName" value="Steve"> <input type="hidden" name="LastName" value="Hannah"> <input type="hidden" name="Address[Country]" value="Canada"> <input type="hidden" name="Address[Province]" value="BC">
array | $query | Array of request query parameters. e.g. $_REQUEST |
array | $keyFilter | Optional array of keys that should be omitted. |
Definition at line 117 of file Utilities.php.
static quoteIdent | ( | $ | ident | ) | [static] |
Quotes identifiers for use in SQL queries.
Definition at line 227 of file Utilities.php.
static redirect | ( | $ | msg = null , |
$ | error = null |
||
) | [static] |
Redirects the user to a new page based on the query attributes: --redirect, --error_page, and --success_page.
string | $msg | The message to be sent as the --msg attribute. |
PEAR_Error | The error object in case we should be sending back an error code. |
This also respects the --prefix GET parameter that will be prepended to the names of the --msg, --error_code, and --error_message variables that are passed to the redirected pages.
Definition at line 242 of file Utilities.php.