ZMObject
└─Session
public class Session
extends ZMObject
| Fields inherited from org.zenmagick.core.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
Session() Create new instance. |
|
| Method Summary | |
|---|---|
| void | clear() Clear the session. |
| void | Clear all session messages. |
| mixed | get(string name, mixed default) Temp. |
| int | Get the account id. |
| string | Get the client ip address. |
| string | Get the client host name. |
| string | Get currency code. |
| ZMLanguage | Get the language. |
| int | 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 | Get the current shopping cart. |
| boolean | 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 | Returns true if the user is a registered user. |
| void | |
| 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 | 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 | |
public Session()
Create new instance.
public void clear()
Clear the session.
This will effectively logoff the curent account.
public void clearMessages()
Clear all session messages.
public mixed get(string name, mixed default)
Temp. alias.
null.null.public int getAccountId()
Get the account id.
0.public string getClientAddress()
Get the client ip address.
null.public string getClientHostname()
Get the client host name.
null.public string getCurrencyCode()
Get currency code.
null.public ZMLanguage getLanguage()
Get the language.
null.public int getLanguageId()
Get the language id.
public void getMessages(array Messages.)
Get all session messages.
public string getName()
Get the session name.
null.public string getToken(boolean renew)
Get the session security token.
A new token will be created if none exists.
true a new token will be generated; default is false.public char getType()
Returns the current session type.
This type corresponds with the account type.
public mixed getValue(string name)
Get a session value.
null.public mixed getZCShoppingCart()
Get the current shopping cart.
public boolean isAnonymous()
Returns true if the user is not logged in at all.
This is the lowest level of identity.
true if the current user is anonymous, false if not.public boolean isGuest()
Returns true if the user is a guest user.
This status level is in the middle between registered and anonymous.
true if the current user is an guest, false if not.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...
false if not.public boolean isRegistered()
Returns true if the user is a registered user.
This si the highest status level.
true if the current user is registered, false if not.public void isStarted()
public boolean isValid()
Check if the current session is valid and open.
true if a valid session exists, false if not.public void recreate(boolean force)
Recreate session.
true, force recreation of the session, even if this is disabled.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.
null.true if ok, false if not.public void removeValue(string name)
Remove a session value.
public void restoreCart()
Restore the shopping cart contents.
public void set(string name, mixed value)
Temp. alias.
public void setAccount(ZMAccount account)
Set the account for the current session.
public void setCurrencyCode(string currencyCode)
Set currency code.
public void setLanguage(ZMLanguage language)
Set the language.
public void setMessages(array messages)
Save the given messages in the session.
ZMMessage objects.public void setValue(string name, mixed value)
Create a session value.
Simple wrapper around
$_SESSIONto centralise access.PLEASE NOTE THAT THIS CLASS CURRENTLY DOES **NOT** EXTEND FROM
ZMSession.