eZ Publish  [trunk]
eZHTTPPersistence Class Reference

Object persistence using HTTP post variables. More...

List of all members.

Public Member Functions

 __construct ()
 Initializes the class.

Static Public Member Functions

static fetch ($base_name, array $def, $objects, eZHTTPTool $http, $is_array, $indexField=false)
 Fetches the HTTP post variables using the base name $base_name and stores them in the object $objects, if $is_array is true then $objects is assumed to be an array and all objects are updated.
static fetchElement ($base_name, array $def, $object, eZHTTPTool $http, $index)
 Helper function for eZHTTPPersistence::fetch().
static handleChecked ($base_name, array $def, $objects, eZHTTPTool $http, $is_array=true)
 This function has some serious flaws and will be removed in a future release Goes trough all fields defined in $def and tries to find a post variable which is named $base_name, field name and "checked" with _ between items.
static handleCheckedElement ($base_name, array $def, $object, eZHTTPTool $http)
 Helper function for handleChecked().
static splitSelected ($base_name, $objects, eZHTTPTool $http, $cond, &$keepers, &$rejects)
 Loops over the HTTP post variables with $base_name as the base.

Detailed Description

Object persistence using HTTP post variables.

This class allows objects or data to exist between page views. It can read HTTP post variables and set them in existing objects to override data. This is useful if you want to keep changes in a page but don't want to store the changes in a DB. It also makes it easier to fetch the changes by the user before an object is stored.

Definition at line 20 of file ezhttppersistence.php.


Constructor & Destructor Documentation

Initializes the class.

Definition at line 25 of file ezhttppersistence.php.


Member Function Documentation

static eZHTTPPersistence::fetch ( base_name,
array $  def,
objects,
eZHTTPTool http,
is_array,
indexField = false 
) [static]

Fetches the HTTP post variables using the base name $base_name and stores them in the object $objects, if $is_array is true then $objects is assumed to be an array and all objects are updated.

Parameters:
string$base_nameBase name for HTTP POST variables
array$defDefinition for $objects, uses the same syntax as eZPersistentObject
object|object[]Single object or array of objects having the same definition provided in $def
eZHTTPTool
bool$is_arrayIf true, $objects is assumed to be an array
string | false$indexFieldField name as defined in $def. If provided, will be used to fetch HTTP variables as index.
Returns:
void

Definition at line 42 of file ezhttppersistence.php.

Referenced by eZContentObjectStateGroup\fetchHTTPPersistentVariables(), and eZContentObjectState\fetchHTTPPersistentVariables().

static eZHTTPPersistence::fetchElement ( base_name,
array $  def,
object,
eZHTTPTool http,
index 
) [static]

Helper function for eZHTTPPersistence::fetch().

Parameters:
string$base_name
array$defDefinition for $object, uses the same syntax as eZPersistentObject
object$object
eZHTTPTool$http
int | string | false$indexIndex in HTTP POST data corresponding to $object. Set as string will make use of corresponding field in $def Set to false if posted data is not an array.
See also:
eZHTTPPersistence::fetch()
Returns:
void

Definition at line 72 of file ezhttppersistence.php.

Referenced by fetch().

static eZHTTPPersistence::handleChecked ( base_name,
array $  def,
objects,
eZHTTPTool http,
is_array = true 
) [static]

This function has some serious flaws and will be removed in a future release Goes trough all fields defined in $def and tries to find a post variable which is named $base_name, field name and "checked" with _ between items.

If the post variable is an array the id of the current object is matched against that array, if one is found the matched field is set to be true otherwise false. If no post variable was found with that signature the field is ignored. Example of name: In the HTML code use:
<input type="checkbox" name="ContentClassAttribute_is_searchable_checked[]" value="some_id">

Deprecated:
Parameters:
string$base_name
array$def
object|object[]$objects
eZHTTPTool$http
bool$is_array

Definition at line 121 of file ezhttppersistence.php.

static eZHTTPPersistence::handleCheckedElement ( base_name,
array $  def,
object,
eZHTTPTool http 
) [static]

Helper function for handleChecked().

Deprecated:
This function has some serious flaws and will be removed in a future release
Parameters:
string$base_name
array$def
object$object
eZHTTPTool$http

Definition at line 145 of file ezhttppersistence.php.

Referenced by handleChecked().

static eZHTTPPersistence::splitSelected ( base_name,
objects,
eZHTTPTool http,
cond,
&$  keepers,
&$  rejects 
) [static]

Loops over the HTTP post variables with $base_name as the base.

It examines the HTTP post variable $base_name "_" $cond "_checked" which should contain an array of ids. The ids are then matched against the objects attribute $cond. If they match the object is moved to the $rejects array otherwise the $keepers array.

Parameters:
string$base_name
object[]$objects
eZHTTPTool$http
$cond
$keepers
$rejects
Returns:
boolean

Definition at line 189 of file ezhttppersistence.php.

Referenced by removeSelectedGroups().


The documentation for this class was generated from the following file: