Wraps the PHP Session super global array for the MVC system. This class can be extended for a specific site with additional methods for convenience e.g. to fetch the user object or other objects by key instead of trying to store an object within the session.
The session name can only be set by extending this class.
Sessions are initiated by using the mvcDistributorPluginSession which is set in the site config.xml file.
public __construct([$inMvcRequest = null])
Starts the session and sets up vars
public initialise()
Performs any initialisation of the session
protected _preInitialise()
Performs any pre-initialisation e.g. setting session cookie parameters
protected _postInitialise()
Performs any post-initialisation, e.g. any one time actions such as stats logging or handset detection
public destroy()
Destroys the currently started session, setting all session parameters to null first
public isModified()
Returns true if object has been modified
public setModified([$inStatus = true])
Set object status
public getParam($inParamName)
Returns session param $inParamName
public getParams()
Returns all session params
public setParam($inParamName, $inParamValue)
Sets the session param $inParamName overriding the previous value
public removeParam($inParamName)
Removes and unsets $inParamName from the session
public getSessionName()
Returns $_SessionName
public setSessionName($inSessionName)
Set $_SessionName to $inSessionName
public getSessionID()
Returns $_SessionID
public setSessionID($inSessionID)
Set $_SessionID to $inSessionID
public regenerateSessionID()
Regenerates the session ID, returning the mvcSession object
public getFormToken()
Creates a token for use with forms and stores it and the generation time in the current session.
public isValidFormToken([$inFormToken = null])
Returns true if the supplied token matches the current session token
public clearFormToken()
Removes the current session form token but does not create a new one
public newFormToken()
Creates a new form token
public getFormTokenLifetime()
Returns $_FormTokenLifetime
public setFormTokenLifetime($inFormTokenLifetime)
Set the time that the token is valid for; valid only for the current request
public getRequest()
Returns $_Request
public setRequest($inRequest)
Set $_Request to $inRequest
Tags: mvc, mvcsessionbase,
mvc Articles