eZPublish  3.8
eZHTTPPersistence Class Reference

Object persistence using HTTP post variables. More...

Public Member Functions

 eZHTTPPersistence ()
 
 fetch ($base_name, &$def, &$objects, &$http, $is_array)
 
 handleChecked ($base_name, &$def, &$objects, &$http, $is_array=true)
 
 splitSelected ($base_name, &$objects, &$http, $cond, &$keepers, &$rejects)
 

Private Member Functions

 fetchElement ($base_name, &$def, &$object, &$http, $index)
 
 handleCheckedElement ($base_name, &$def, &$object, &$http)
 

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.

Member Function Documentation

eZHTTPPersistence::eZHTTPPersistence ( )

Initializes the class.

eZHTTPPersistence::fetch (   $base_name,
$def,
$objects,
$http,
  $is_array 
)

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
$defThe definition of the objects, uses the same syntax as eZPersistentObject
$httpThe eZHTTPTool object
eZHTTPPersistence::fetchElement (   $base_name,
$def,
$object,
$http,
  $index 
)
private

Helper function for fetch().

Referenced by fetch().

eZHTTPPersistence::handleChecked (   $base_name,
$def,
$objects,
$http,
  $is_array = true 
)
Deprecated:
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:<br/>
<input type="checkbox" name="ContentClassAttribute_is_searchable_checked[]" value="some_id" />
Parameters
$defThe definition of the objects, uses the same syntax as eZPersistentObject
eZHTTPPersistence::handleCheckedElement (   $base_name,
$def,
$object,
$http 
)
private

Helper function for handleChecked().

Deprecated:
This function has some serious flaws and will be removed in a future release

Referenced by handleChecked().

eZHTTPPersistence::splitSelected (   $base_name,
$objects,
$http,
  $cond,
$keepers,
$rejects 
)

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
$httpThe eZHTTPTool object

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