.

Confirmations Class Reference
[Confirmations]

Confirmations facade class. More...

List of all members.

Static Public Member Functions

static  create ($id_item, $data, $action, &$result=null)
  Create a confirmation.
static  create_confirmation_handler ($id, $code)
  Create a confirmatin handler suitable for the desired action of confirmation for given code.
static  remove_expired ()
  Remove expired confirmations.

Detailed Description

Confirmations facade class.

Author:
Gerd Riesselmann

Definition at line 8 of file confirmations.facade.php.


Member Function Documentation

static Confirmations::create ( id_item,
data,
action,
&$  result = null  
) [static]

Create a confirmation.

Returns:
Status

Definition at line 14 of file confirmations.facade.php.

00014                                                                                  {
00015                 self::remove_expired();
00016                 
00017                 $params = array(
00018                         'id_item' => $id_item,
00019                         'data' => $data,
00020                         'action' => $action
00021                 );
00022                 $cmd = CommandsFactory::create_command('confirmations', 'create', $params);
00023                 $ret = $cmd->execute();
00024                 if (!is_null($result)) {
00025                         $result = $cmd->get_result();
00026                 }
00027                 return $ret;            
00028         }
static Confirmations::create_confirmation_handler ( id,
code  
) [static]

Create a confirmatin handler suitable for the desired action of confirmation for given code.

Definition at line 33 of file confirmations.facade.php.

00033                                                                        {
00034                 self::remove_expired();
00035                 
00036                 $confirmation = new DAOConfirmations();
00037                 $confirmation->code = $code;
00038                 $confirmation->id = $id;
00039                 if ($confirmation->find(IDataObject::AUTOFETCH)) {
00040                         return $confirmation->create_handler();
00041                 }
00042                 // Default implementation handles missing confirmation...
00043                 return new ConfirmationHandlerBase(false);                              
00044         }
static Confirmations::remove_expired (  )  [static]

Remove expired confirmations.

Returns:
Status

Definition at line 51 of file confirmations.facade.php.

00051                                                 {
00052                 $c = new DAOConfirmations();
00053                 // Don't delete all expired, since users won't get an "Expired" messages in that case, 
00054                 // only "Not found", which might be confusung.
00055                 // Deleting confirmations that expired a month ago (given that usual expiration time is 
00056                 // about a day) seems OK, though      
00057                 $c->add_where('expirationdate', '<', time() - 30 * GyroDate::ONE_DAY);
00058                 return $c->delete(DataObjectBase::WHERE_ONLY);
00059         }

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