Class: DpUser
SOURCE LOCATION: /dpuniverse/std/DpUser.php
Class Overview
|
A user object, the object representing a real user
Currently the only differerence with a NPC (which shares the same DpLiving class) is the passing of the user's last HTTP request's server, request and cookie variables, and the tell method (NPCs don't have a browser). See the DpLiving class for most functionality. Creates the following DutchPIPE properties:
- boolean isUser - Set to TRUE
- boolean isRegistered - TRUE if this is a registered user, FALSE
otherwise
- boolean isAdmin - TRUE if this user is an administrator, FALSE
otherwise
- boolean noCookies - TRUE if the user's browser didn't accept our
cookie
- boolean isKnownBot - TRUE if this is a known search engine bot,
FALSE otherwise
- boolean isAjaxCapable - TRUE if the user's browser is AJAX-capable,
FALSE otherwise
- string age - Descriptive age of the user
- string inactive - Descriptive inactive time of the user, empty
string for active
- boolean isInactive - TRUE if the user in inactive, FALSE otherwise
- integer avatarNr - Avatar image number, 0 for custom avatar
- string avatarCustom - File name of custom avatar, if any
- status browseAvatarCustom - TRUE if the user is browsing on his
computer for an image to upload (which causes scripts to halt), unset
otherwise
- mixed status - FALSE for no special status, otherwise a descriptive
string, 'away'
- string inputMode - Input field mode, "say" or "cmd"
- string inputEnabled - Is input field visibile? Either "on" or "off"
- string inputPersistent - Input field options
DpProperties
|
--DpObject
|
--DpLiving
|
--DpUser
|
PROPERTIES:
|
METHODS:
|
Property Summary
| array |
$mActionHistory |
History of input field actions, can be accesed by up and down arrow keys |
| array |
$mAlertEvents |
Events this user will be alerted of, such as people entering the site |
| array |
$_COOKIE |
Variables provided via HTTP cookies |
| array |
$_FILES |
Variables provided via HTTP post file uploads |
| array |
$_GET |
Variables provided via URL query string |
| array |
$_POST |
Variables provided via HTTP POST |
| array |
$_SERVER |
Variables set by the web server of related to dpclient.php's environment |
| array |
$_SESSION |
Variables which are currently registered to a script's session |
Methods Summary
| boolean |
actionAvatar() |
Shows this user a window with avatar settings |
| boolean |
actionEmote() |
Makes this user communicate a custom message to its environment |
| boolean |
actionForce() |
Makes this administrator force another user to perform an action |
| boolean |
actionHelp() |
Shows this user a window with help information |
| boolean |
actionLinks() |
Shows this living a list of links in its environment or in another object |
| boolean |
actionMove() |
Makes this administrator move an object to another environment |
| string |
actionMoveOperant() |
Completes the move action performed by clicking on an object |
| boolean |
actionMyhome() |
Moves to or sets personal home location |
| boolean |
actionOblist() |
Shows a list of all objects in this DutchPIPE universe in a window |
| boolean |
actionShout() |
Makes this user shout something to everyone on the site |
| boolean |
actionSource() |
Shows this user source code of environment or of another object |
| boolean |
actionSvars() |
Shows this administrator various PHP/server information about a user |
| boolean |
actionTell() |
Makes this user object tell something to another user object |
| boolean |
actionWho() |
Shows this user a list of users on the site |
| string |
getAge() |
Gets the user's age in a string |
| string |
getInactive() |
Gets inactive time of the user in a string |
| string |
getStatus() |
Gets a descriptive user status string |
| boolean |
performAction() |
Tries to perform the action given by the user object |
| void |
setAvatar() |
Switches to another avatar when clicking on one using actionAvatar() |
| void |
setSettings() |
Applies settings from the settings menu obtained with actionSettings() |
| void |
setVars() |
Sets various PHP global variables passed on from the DutchPIPE server |
| void |
tell() |
Sends something to dpclient-js.php running on the user's browser |
Properties
array
$mActionHistory
= array() [line 149]
History of input field actions, can be accesed by up and down arrow keys
array
$mAlertEvents
= array() [line 142]
Events this user will be alerted of, such as people entering the site
array
$_COOKIE
[line 100]
Variables provided via HTTP cookies
array
$_FILES
[line 121]
Variables provided via HTTP post file uploads
array
$_GET
[line 107]
Variables provided via URL query string
array
$_POST
[line 114]
Variables provided via HTTP POST
array
$_SERVER
[line 86]
Variables set by the web server of related to dpclient.php's environment
This environment is the execution environment of the current dpclient.php script.
array
$_SESSION
[line 93]
Variables which are currently registered to a script's session
Methods
boolean actionAvatar(
string
$verb , string
$noun
)
Shows this user a window with avatar settings
actionDestroy [line 1275]
boolean actionDestroy(
string
$verb , string
$noun
)
Destroys an object
| PARAMETERS: |
string |
$verb |
the action, "destroy" |
| string |
$noun |
the object to destroy, for example "rose" |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| SINCE: | DutchPIPE 0.4.0 |
boolean actionEmote(
string
$verb , string
$noun
)
Makes this user communicate a custom message to its environment
| PARAMETERS: |
string |
$verb |
the action, "emote" |
| string |
$noun |
string to "emote" |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINITION OF: |
DpLiving::actionEmote(): Makes this living object communicate a custom message to its environment |
boolean actionForce(
string
$verb , string
$noun
)
Makes this administrator force another user to perform an action
| PARAMETERS: |
string |
$verb |
the action, "force" |
| string |
$noun |
who and what to force |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionGoto(
string
$verb , string
$noun
)
Go to a given location
| PARAMETERS: |
string |
$verb |
the action, "goto" |
| string |
$noun |
the location, for example "/page/about.php" |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionHelp(
string
$verb , string
$noun
)
Shows this user a window with help information
| PARAMETERS: |
string |
$verb |
the action, "help" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
boolean actionLinks(
string
$verb , string
$noun
)
Shows this living a list of links in its environment or in another object
| PARAMETERS: |
string |
$verb |
the action, "links" |
| string |
$noun |
what to take, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
actionLoginOut [line 1543]
boolean actionLoginOut(
)
Go to the login page, logout if logon on.
boolean actionMode(
string
$verb , string
$noun
)
Sets the input field mode
Without an argument, switches between the two modes "cmd" and "say". Otherwise switches to the given mode (if it is valid). The input field stays visible between page changes with mode "pin".
| PARAMETERS: |
string |
$verb |
the action, "mode" |
| string |
$noun |
empty or a mode |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionMove(
string
$verb , string
$noun
)
Makes this administrator move an object to another environment
| PARAMETERS: |
string |
$verb |
the action, "move" |
| string |
$noun |
what and where to move |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
actionMoveOperant [line 1410]
string actionMoveOperant(
string
$verb ,
&$menuobj
)
Completes the move action performed by clicking on an object
| PARAMETERS: |
string |
$verb |
the action, "move" |
| |
&$menuobj |
|
| RETURNS: | string | a string such as "beer " |
| SEE: | DpUser::actionMove() |
boolean actionMyhome(
string
$verb , string
$noun
)
Moves to or sets personal home location
| PARAMETERS: |
string |
$verb |
the action, "myhome" |
| string |
$noun |
empty to go home, "set" to set home |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionOblist(
string
$verb , string
$noun
)
Shows a list of all objects in this DutchPIPE universe in a window
| PARAMETERS: |
string |
$verb |
the action, "oblist" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| SEE: | DpUniverse::gteObjectList() |
| SINCE: | DutchPIPE 0.4.0 |
boolean actionReset(
)
Resets the environment.
actionSettings [line 1130]
boolean actionSettings(
string
$verb , string
$noun
)
Shows this user a window with settings
| PARAMETERS: |
string |
$verb |
the action, "settings" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| SEE: | DpUser::setSettings() |
boolean actionShout(
string
$verb , string
$noun
)
Makes this user shout something to everyone on the site
| PARAMETERS: |
string |
$verb |
the action, "shout" |
| string |
$noun |
what to shout, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINITION OF: |
DpLiving::actionShout(): Makes this living object shout something to everyone on the site |
boolean actionSource(
string
$verb , string
$noun
)
Shows this user source code of environment or of another object
| PARAMETERS: |
string |
$verb |
the action, "source" |
| string |
$noun |
what to show source of, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionSvars(
string
$verb , string
$noun
)
Shows this administrator various PHP/server information about a user
| PARAMETERS: |
string |
$verb |
the action, "svars" |
| string |
$noun |
who to show info of, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionTell(
string
$verb , string
$noun
)
Makes this user object tell something to another user object
| PARAMETERS: |
string |
$verb |
the action, "tell" |
| string |
$noun |
who and what to tell, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINITION OF: |
DpLiving::actionTell(): Makes this living object tell something to another user object |
boolean actionWho(
string
$verb , string
$noun
)
Shows this user a list of users on the site
| PARAMETERS: |
string |
$verb |
the action, "who" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
createDpLiving [line 154]
void createDpLiving(
)
Initializes the user
void eventDpLiving(
object
$name , mixed
$args
)
Reports an event
Called when certain events occur, given with $name.
| PARAMETERS: |
object |
$name |
Name of event |
| mixed |
$args |
One or more arguments, depends on event |
| SINCE: | DutchPIPE 0.2.0 |
| REDEFINITION OF: |
DpLiving::eventDpLiving(): Reports an event |
string getAge(
)
Gets the user's age in a string
Returns the user's age in a format like "1 day, 6 hours and 14 minutes".
string getInactive(
)
Gets inactive time of the user in a string
Returns how long the user is inactive in a format like "2 hours and 14 minutes".
getModeChecked [line 1660]
void getModeChecked(
)
string getStatus(
)
Gets a descriptive user status string
If the user has a special status like inactive, returns a string like "away", to use in user titles and such. If there is no special status, returns an empty string.
status isInactive(
)
Is this user inactive?
Inactive is defined as a user who hasn't shown activity in the last 5 minutes.
boolean performAction(
string
$action
)
Tries to perform the action given by the user object
Handles input area input mode and history. Uses DpLiving::performAction() for the real stuff. See DpLiving::performAction() for more information.
| PARAMETERS: |
string |
$action |
the action given by the user object |
| RETURNS: | boolean | TRUE for success, FALSE for unsuccessful action |
| ACCESS: | public |
| SEE: | DpLiving::performAction() |
| REDEFINITION OF: |
DpLiving::performAction(): Tries to perform the action given by the living object |
void setAvatar(
)
Switches to another avatar when clicking on one using actionAvatar()
Sets the avatarNr property to the given stock avatar number, or to 0 in case a custom avatar is used. Updates database for registered users. Sends messages.
setBrowseAvatarCustom [line 906]
void setBrowseAvatarCustom(
[boolean
$browseAvatarCustom = TRUE]
)
Sets this user as busy browing for a file
Sets the browseAvatarCustom property to TRUE, or unsets it otherwise. Called from the JavaScript client when the user clicks on "Browse..." to look for a file to upload. This causes browsers to halt execution of scripts while the file dialog is visible. DpCurrentRequest uses this property to users are not thrown out while browsing for a file.
void setSettings(
)
Applies settings from the settings menu obtained with actionSettings()
Called from the Javascript that goes with the menu that pops up after the settings action has been performed. Applies avatar and dispay mode settings, based on the DpUser::_GET variable in this user.
void setVars(
array
&$rServerVars , array
&$rSessionVars , array
&$rCookieVars , array
&$rGetVars , array
&$rPostVars , array
&$rFilesVars
)
Sets various PHP global variables passed on from the DutchPIPE server
Called each time a user's browser does a normal page or AJAX request. Several variables are passed which represent their corresponding PHP global arrays: $_SERVER, $_COOKIE, etc.
| PARAMETERS: |
array |
&$rServerVars |
User server variables |
| array |
&$rSessionVars |
User session variables |
| array |
&$rCookieVars |
User cookie variables |
| array |
&$rGetVars |
User get variables |
| array |
&$rPostVars |
User post variables |
| array |
&$rFilesVars |
User files variables |
void tell(
string
$data , [object
&$binded_env = NULL]
)
Sends something to dpclient-js.php running on the user's browser
Sends the given data to the user's browser. It's up the user's DutchPIPE Javascript client, dpclient-js.php by default, what to do with the received content. dpclient-js.php can be send data like '<message>hello world</message>' and '<window>hello world</window>', to show something in the message area and pop up a window respectively. Can be binded to an environment. This is useful for locations producing messages: the user could be moving to another location before the client catches the new message with AJAX, in which case the user should not get the message.
| PARAMETERS: |
string |
$data |
message string |
| object |
&$binded_env |
optional binded environment |
| REDEFINITION OF: |
DpObject::tell(): Tells data (message, window, location, ...) to this object |
timeoutHeartBeat [line 304]
void timeoutHeartBeat(
)
Calls itself every "heartbeat"
Redefine this method to make timed stuff happen.
uploadAvatarCustom [line 932]
void uploadAvatarCustom(
)
Attempts to upload a file to be used as our avatar image
|
|