eZHTTPPersistence Class Reference
[HTTP utilities]

Object persistence using HTTP post variables. More...

List of all members.


Public Methods

 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 Methods

 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.

Definition at line ezhttppersistence.php.


Constructor & Destructor Documentation

eZHTTPPersistence::eZHTTPPersistence  
 

Initializes the class.

Definition at line ezhttppersistence.php.


Member Function Documentation

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:
def  The definition of the objects, uses the same syntax as eZPersistentObject
http  The eZHTTPTool object

Definition at line ezhttppersistence.php.

References fetchElement().

eZHTTPPersistence::fetchElement   base_name,
&$    def,
&$    object,
&$    http,
  index
[private]
 

Helper function for fetch().

Definition at line ezhttppersistence.php.

Referenced by fetch().

eZHTTPPersistence::handleChecked   base_name,
&$    def,
&$    objects,
&$    http,
  is_array = true
 

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" />
Parameters:
def  The definition of the objects, uses the same syntax as eZPersistentObject

Definition at line ezhttppersistence.php.

References handleCheckedElement().

eZHTTPPersistence::handleCheckedElement   base_name,
&$    def,
&$    object,
&$    http
[private]
 

Helper function for handleChecked().

Definition at line ezhttppersistence.php.

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:
http  The eZHTTPTool object

Definition at line ezhttppersistence.php.


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

Exponential