ZenMagick 0.9.10


zenmagick.store.sf.mvc\Session
mvc\Session.php at line 35

Class Session

ZMObject
└─Session

public class Session
extends ZMObject

Simple wrapper around $_SESSION to centralise access.

PLEASE NOTE THAT THIS CLASS CURRENTLY DOES **NOT** EXTEND FROM ZMSession.

Author:
DerManoMann

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct()

Create new instance.

void

clear()

Clear the session.

void

clearMessages()

Clear all session messages.

mixed

get(string name, mixed default)

Support to access property values by name. Alias for getValue().

int

getAccountId()

Get the account id.

string

getClientAddress()

Get the client ip address.

string

getClientHostname()

Get the client host name.

string

getCurrencyCode()

Get currency code.

ZMLanguage

getLanguage()

Get the language.

int

getLanguageId()

Get the language id.

void

getMessages(array Messages.)

Get all session messages.

string

getName()

Get the session name.

string

getToken(boolean renew)

Get the session security token.

char

getType()

Returns the current session type.

void

getValue(mixed name, mixed namespace)

{@inheritDoc}

mixed

getZCShoppingCart()

Get the current shopping cart.

boolean

isAnonymous()

Returns true if the user is not logged in at all.

boolean

isGuest()

Returns true if the user is a guest user.

boolean

isOpen()

Check if a proper session has been started yet.

boolean

isRegistered()

Returns true if the user is a registered user.

boolean

isStarted()

Check if this session is started.

boolean

isValid()

Check if the current session is valid and open.

void

recreate(boolean force)

Recreate session.

boolean

registerAccount(ZMAccount account, ZMRequest request, mixed source)

Register an account as user for this session.

void

removeValue(string name)

Remove a session value.

void

restoreCart()

Restore the shopping cart contents.

void

set(string name, mixed value)

Support to set property values by name. Alias for setValue().

void

setAccount(ZMAccount account)

Set the account for the current session.

void

setCurrencyCode(string currencyCode)

Set currency code.

void

setLanguage(ZMLanguage language)

Set the language.

void

setMessages(array messages)

Save the given messages in the session.

void

setValue(mixed name, mixed value, mixed namespace)

{@inheritDoc}

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

mvc\Session.php at line 40

__construct

public void __construct()

Create new instance.


mvc\Session.php at line 213

clear

public void clear()

Clear the session.

This will effectively logoff the curent account.


mvc\Session.php at line 251

clearMessages

public void clearMessages()

Clear all session messages.


mvc\Session.php at line 109

get

public mixed get(string name, mixed default)

Support to access property values by name.

Alias for getValue().

Parameters:
name - The property name.
default - A default value; default value is null.
Returns:
The value or null.

mvc\Session.php at line 152

getAccountId

public int getAccountId()

Get the account id.

Returns:
The account id for the currently logged in user or 0.

mvc\Session.php at line 276

getClientAddress

public string getClientAddress()

Get the client ip address.

Returns:
The client IP address or null.

mvc\Session.php at line 285

getClientHostname

public string getClientHostname()

Get the client host name.

Returns:
The client host name or null.

mvc\Session.php at line 294

getCurrencyCode

public string getCurrencyCode()

Get currency code.

Returns:
The session currency code or null.

mvc\Session.php at line 343

getLanguage

public ZMLanguage getLanguage()

Get the language.

Returns:
The language or null.

mvc\Session.php at line 356

getLanguageId

public int getLanguageId()

Get the language id.

Returns:
The current language id.

mvc\Session.php at line 260

getMessages

public void getMessages(array Messages.)

Get all session messages.


mvc\Session.php at line 410

getName

public string getName()

Get the session name.

Returns:
The session name or null.

mvc\Session.php at line 366

getToken

public string getToken(boolean renew)

Get the session security token.

A new token will be created if none exists.

Parameters:
renew - If true a new token will be generated; default is false.
Returns:
The security token.

mvc\Session.php at line 161

getType

public char getType()

Returns the current session type.

This type corresponds with the account type.

Returns:
The session type.

mvc\Session.php at line 87

getValue

public void getValue(mixed name, mixed namespace)


mvc\Session.php at line 145

getZCShoppingCart

public mixed getZCShoppingCart()

Get the current shopping cart.

Returns:
The current zen-cart shopping cart (may be empty).

mvc\Session.php at line 170

isAnonymous

public boolean isAnonymous()

Returns true if the user is not logged in at all.

This is the lowest level of identity.

Returns:
true if the current user is anonymous, false if not.

mvc\Session.php at line 179

isGuest

public boolean isGuest()

Returns true if the user is a guest user.

This status level is in the middle between registered and anonymous.

Returns:
true if the current user is an guest, false if not.

mvc\Session.php at line 315

isOpen

public boolean isOpen()

Check if a proper session has been started yet.

NOTE: Since this method calls session_start() internally as part of its logic, right now it can't be called twice...

Returns:
true if a session is open, false if not.

mvc\Session.php at line 188

isRegistered

public boolean isRegistered()

Returns true if the user is a registered user.

This si the highest status level.

Returns:
true if the current user is registered, false if not.

mvc\Session.php at line 69

isStarted

public boolean isStarted()

Check if this session is started.

Returns:
true if the session is started, false if not.

mvc\Session.php at line 57

isValid

public boolean isValid()

Check if the current session is valid and open.

Returns:
true if a valid session exists, false if not.

mvc\Session.php at line 129

recreate

public void recreate(boolean force)

Recreate session.

Parameters:
force - If true, force recreation of the session, even if this is disabled.

mvc\Session.php at line 383

registerAccount

public boolean registerAccount(ZMAccount account, ZMRequest request, mixed source)

Register an account as user for this session.

This operation will fail, for example, if the account is blocked/disabled.

Parameters:
account - The account.
request - The current request.
source - The event source; default is null.
Returns:
true if ok, false if not.

mvc\Session.php at line 118

removeValue

public void removeValue(string name)

Remove a session value.

Parameters:
name - The field name.

mvc\Session.php at line 222

restoreCart

public void restoreCart()

Restore the shopping cart contents.


mvc\Session.php at line 100

set

public void set(string name, mixed value)

Support to set property values by name.

Alias for setValue().

Parameters:
name - The property name.
value - The value.

mvc\Session.php at line 195

setAccount

public void setAccount(ZMAccount account)

Set the account for the current session.

Parameters:
account - The account.

mvc\Session.php at line 303

setCurrencyCode

public void setCurrencyCode(string currencyCode)

Set currency code.

Parameters:
currencyCode - The session currency code.

mvc\Session.php at line 332

setLanguage

public void setLanguage(ZMLanguage language)

Set the language.

Parameters:
language - The language.

mvc\Session.php at line 234

setMessages

public void setMessages(array messages)

Save the given messages in the session.

Parameters:
messages - A list of ZMMessage objects.

mvc\Session.php at line 76

setValue

public void setValue(mixed name, mixed value, mixed namespace)


ZenMagick 0.9.10