session 
[ doc home ] [ class tree: session ] [ index: session ] [ all elements ]

Class: IsterSession

Source Location: /IsterSession.php

Class Overview

IsterObject
   |
   --IsterAttributeSet
      |
      --IsterSession

This class represents a session.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterAttributeSet

IsterAttributeSet::IsterAttributeSet()
Constructor
IsterAttributeSet::addAttribute()
depricated
IsterAttributeSet::addAttributeReference()
depricated
IsterAttributeSet::addAttributesArray()
depricated
IsterAttributeSet::delete()
Delete all attributes.
IsterAttributeSet::deleteAttribute()
Delete an aAttribute.
IsterAttributeSet::getAttribute()
Get the value of an attribute.
IsterAttributeSet::getAttributeNames()
Return an array containing the names of all attributes.
IsterAttributeSet::getAttributeReference()
Get the reference value of an attribute.
IsterAttributeSet::getAttributesArray()
Get all attributes.
IsterAttributeSet::hasAttribute()
Check whether an attribute has been set.
IsterAttributeSet::setAttribute()
Set a new attribute or overwrite an already existing attribute.
IsterAttributeSet::setAttributeReference()
Set an attribute and store only a reference of the attribute.
IsterAttributeSet::setAttributesArray()
Set an array of key value pairs, each pair an attribute.

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents a session.

An IsterSession object can register objects automatically to a session. It will also automatically include all required class definitions before the session is restored.

Only one instance of IsterSession can be created in a script. This is a "Singleton".

Note: This class can only save and restore objects having a class definition in a file named by the class and located in the include path. Includes like 'class/Object.php' won't work. Also, the objects must be subclasses of IsterObject.


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterSession

IsterSession IsterSession( )

Constructor

The constructor will trigger a fatal error if another instance of IsterSession has already been created.


[ Top ]

method getCookie

object IsterHttpCookie getCookie( )

Get the session cookie.

[ Top ]

method getCounter

integer getCounter( )

Get session count.

[ Top ]

method getObject

object IsterObject getObject( string $name)

Get a restored object by name.

return:  Returns the object or false on error.

Parameters:

string   $name  

[ Top ]

method getTimeLeft

integer getTimeLeft( )

Get time left before the session times out, in seconds.

[ Top ]

method getUniqueId

string getUniqueId( )

Return a 32 character unique identifier.

Note: You may wish to call this as a static method.


[ Top ]

method isTimedOut

boolean isTimedOut( )

Checks whether the session timed out.

[ Top ]

method kill

boolean kill( )

Kill the current session.

[ Top ]

method registerObject

boolean registerObject( string $name, object IsterObject &$object)

Register an object to the session.

This method registers objects by storing references, it does not serialize the objects. As long as IsterSession::save() was not called, the objects may change as needed.


Parameters:

string   $name   Name of the object.
object IsterObject   &$object   The object to register.

[ Top ]

method restore

boolean restore( object IsterHttpCookie $cookie)

Restore a session

The method checks whether the session timed out. If so, a warning is triggered, but the IsterSession object is still valid and session data can be read. So, check isTimedOut() and decide what you think the user should know about timeouts.


return:  True on success, false if the session timed out.

Parameters:

object IsterHttpCookie   $cookie  

[ Top ]

method save

boolean save( )

Save the current session.

[ Top ]

method start

boolean start( object IsterHttpCookie $cookie, [integer $timeout = 3600])

Start a session.

You may specify a timeout value in seconds. If this value is set to 0, the session will never time out (regardless of what the garbadge collector may think, so, use this with care).

Note: The timeout value will effect the lifetime of cookies. Cookies expire when the session timed out.


Parameters:

object IsterHttpCookie   $cookie  
integer   $timeout  

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:21:06 +0100 by phpDocumentor 1.3.0RC4