ZenMagick 0.9.8


org.zenmagick.store.mvc.Session
\store\mvc\Session.php at line 36

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
Version:
$Id: Session.php 2694 2009-12-03 22:32:18Z dermanomann $

Fields inherited from org.zenmagick.core.ZMObject
properties_
Constructor Summary

Session()

Create new instance.

Method Summary
void

clear()

Clear the session.

void

clearMessages()

Clear all session messages.

mixed

get(string name, mixed default)

Temp.

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.

mixed

getValue(string name)

Get a session value.

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.

void

isStarted()

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)

Temp.

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(string name, mixed value)

Create a session value.

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

Constructor Detail

\store\mvc\Session.php at line 41

Session

public Session()

Create new instance.


Method Detail

\store\mvc\Session.php at line 204

clear

public void clear()

Clear the session.

This will effectively logoff the curent account.


\store\mvc\Session.php at line 242

clearMessages

public void clearMessages()

Clear all session messages.


\store\mvc\Session.php at line 103

get

public mixed get(string name, mixed default)

Temp. alias.

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

\store\mvc\Session.php at line 143

getAccountId

public int getAccountId()

Get the account id.

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

\store\mvc\Session.php at line 267

getClientAddress

public string getClientAddress()

Get the client ip address.

Returns:
The client IP address or null.

\store\mvc\Session.php at line 276

getClientHostname

public string getClientHostname()

Get the client host name.

Returns:
The client host name or null.

\store\mvc\Session.php at line 285

getCurrencyCode

public string getCurrencyCode()

Get currency code.

Returns:
The session currency code or null.

\store\mvc\Session.php at line 334

getLanguage

public ZMLanguage getLanguage()

Get the language.

Returns:
The language or null.

\store\mvc\Session.php at line 343

getLanguageId

public int getLanguageId()

Get the language id.

Returns:
The current language id.

\store\mvc\Session.php at line 251

getMessages

public void getMessages(array Messages.)

Get all session messages.


\store\mvc\Session.php at line 397

getName

public string getName()

Get the session name.

Returns:
The session name or null.

\store\mvc\Session.php at line 353

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.

\store\mvc\Session.php at line 152

getType

public char getType()

Returns the current session type.

This type corresponds with the account type.

Returns:
The session type.

\store\mvc\Session.php at line 85

getValue

public mixed getValue(string name)

Get a session value.

Parameters:
name - The field name.
Returns:
The value or null.

\store\mvc\Session.php at line 136

getZCShoppingCart

public mixed getZCShoppingCart()

Get the current shopping cart.

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

\store\mvc\Session.php at line 161

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.

\store\mvc\Session.php at line 170

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.

\store\mvc\Session.php at line 306

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.

\store\mvc\Session.php at line 179

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.

\store\mvc\Session.php at line 65

isStarted

public void isStarted()

\store\mvc\Session.php at line 58

isValid

public boolean isValid()

Check if the current session is valid and open.

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

\store\mvc\Session.php at line 123

recreate

public void recreate(boolean force)

Recreate session.

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

\store\mvc\Session.php at line 370

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.

\store\mvc\Session.php at line 112

removeValue

public void removeValue(string name)

Remove a session value.

Parameters:
name - The field name.

\store\mvc\Session.php at line 213

restoreCart

public void restoreCart()

Restore the shopping cart contents.


\store\mvc\Session.php at line 96

set

public void set(string name, mixed value)

Temp. alias.

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

\store\mvc\Session.php at line 186

setAccount

public void setAccount(ZMAccount account)

Set the account for the current session.

Parameters:
account - The account.

\store\mvc\Session.php at line 294

setCurrencyCode

public void setCurrencyCode(string currencyCode)

Set currency code.

Parameters:
currencyCode - The session currency code.

\store\mvc\Session.php at line 323

setLanguage

public void setLanguage(ZMLanguage language)

Set the language.

Parameters:
language - The language.

\store\mvc\Session.php at line 225

setMessages

public void setMessages(array messages)

Save the given messages in the session.

Parameters:
messages - A list of ZMMessage objects.

\store\mvc\Session.php at line 75

setValue

public void setValue(string name, mixed value)

Create a session value.

Parameters:
name - The field name.
value - The value.

ZenMagick 0.9.8