Welcompose
[ class tree: Welcompose ] [ index: Welcompose ] [ all elements ]

Class: User_User

Source Location: /user_classes/user.class.php

Class Overview




Variables

Methods



Class Details

[line 50]


[ Top ]


Class Variables

static $instance =  null

[line 57]

Singleton



Tags:

access:  public

Type:   object


[ Top ]

$base =  null

[line 64]

Reference to base class



Tags:

access:  public

Type:   object


[ Top ]



Class Methods


constructor __construct [line 71]

User_User __construct( )

Start instance of base class, load configuration and establish database connection. Please don't call the constructor direcly, use the singleton pattern instead.



Tags:

access:  public


[ Top ]

method addUser [line 97]

int addUser( array $sqlData)

Adds user to the user table. Takes a field=>value array with user data as first argument. Returns insert id.



Tags:

return:  User id
throws:  User_UserException
access:  public


Parameters:

array   $sqlData   Row data

[ Top ]

method deleteUser [line 159]

int deleteUser( int $id)

Removes user from the user table. Takes the user id as first argument.

Returns amount of affected rows




Tags:

return:  Amount of affected rows
throws:  User_UserException
access:  public


Parameters:

int   $id   User id

[ Top ]

method detachUserFromProject [line 724]

int detachUserFromProject( int $user)

Detaches user from current project. Takes user id as first argument. Returns amount of affected rows.



Tags:

return:  Amount of affected rows
throws:  User_UserException
access:  public


Parameters:

int   $user   User id

[ Top ]

method initUserAdmin [line 864]

int initUserAdmin( )

Sets WCOM_CURRENT_USER constant using the user id saved in the open session. Returns user id.



Tags:

return:  User id
throws:  User_UserException
access:  public


[ Top ]

method initUserPublicArea [line 894]

int initUserPublicArea( )

Initialises "user environment" for the public area. Sets the WCOM_CURRENT_USER and the WCOM_CURRENT_USER_ANONYMOUS constants using the saved user id in the open session or the anonymous user configured for the current project. Returns user id.



Tags:

return:  User id
access:  public


[ Top ]

method isDeletable [line 816]

bool isDeletable( int $user)

Finds out, whether a user is deletable or not. Takes the user id as first argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   User id

[ Top ]

method mapUserToGroup [line 505]

int mapUserToGroup( int $user, [int $group = null])

Maps user to one group. Takes user id as first argument, group id as second argument. Returns the id of the new link.

If the second parameter is omitted, the user will be detached from all groups and the function returns boolean true.




Tags:

return:  Link id
throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $group   Group id

[ Top ]

method mapUserToProject [line 650]

int mapUserToProject( int $user, [int $active = 1], [ $author = 0])

Maps user to the current project. Takes user id as first argument, activity and author switch as second and third argument. Returns link id. To detach a user from a project, see User_User::detachUserFromProject().



Tags:

return:  Link id
throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $active   Group id
   $author  

[ Top ]

method mapUserToTargetGroup [line 580]

int mapUserToTargetGroup( int $user, int $project, [int $group = null])

Maps user to one group. Takes user id as first argument, group id as second argument. Returns the id of the new link.

If the second parameter is omitted, the user will be detached from all groups and the function returns boolean true.




Tags:

return:  Link id
throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $project   Project id
int   $group   Group id

[ Top ]

method mapUserToTargetProject [line 688]

int mapUserToTargetProject( int $user, int $project, [ $active = 1], [ $author = 0])

Maps user to the target project. Takes user id as first argument, activity and author switch as second and third argument. Returns link id. To detach a user from a project, see User_User::detachUserFromProject().



Tags:

return:  Link id
throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $project   Group id
   $active  
   $author  

[ Top ]

method selectAnonymousUser [line 448]

array selectAnonymousUser( )

Returns anonymous user of the current project. Throws exception if no anonymous user can be found.



Tags:

throws:  User_UserException
access:  public


[ Top ]

method selectUser [line 191]

array selectUser( int $id)

Selects one user. Takes the user id as first argument.

Returns array with user information.




Tags:

throws:  User_UserException
access:  public


Parameters:

int   $id   User id

[ Top ]

method selectUsers [line 297]

array selectUsers( [array $params = array()])

Method to select one or more users. Takes key=>value array with select params as first argument. Returns array.

List of supported params:

  • group, int, optional: User group id
  • exclude, int, optional: Bit to exclude skeleton user set and the current user
  • email, string, optional: E-mail address
  • author, int, optional: Author bit (either 0 or 1)
  • start, int, optional: row offset
  • limit, int, optional: amount of rows to return
  • order_marco, string, otpional: How to sort the result set. Supported macros:
    • DATE_ADDED: sort by date added
    • NAME: sort by name




Tags:

throws:  User_UserException
access:  public


Parameters:

array   $params   Select params

[ Top ]

method testForUniqueEmail [line 761]

bool testForUniqueEmail( string $email, [int $id = null])

Tests given email address for uniqueness. Takes the email address as

first argument and an optional user id as second argument. If the user id is given, this user won't be considered when checking for uniqueness (useful for updates). Returns boolean true if the email address is unique.




Tags:

throws:  User_UserException
access:  public


Parameters:

string   $email   User's email address
int   $id   User id

[ Top ]

method updateUser [line 123]

int updateUser( int $id, array $sqlData)

Updates user. Takes the user id as first argument, a field=>value array with the new user data as second argument. Returns amount of affected rows.



Tags:

return:  Affected rows
throws:  User_UserException
access:  public


Parameters:

int   $id   User id
array   $sqlData   Row data

[ Top ]

method userBelongsToCurrentProject [line 1180]

bool userBelongsToCurrentProject( int $user)

Tests whether user belongs to current project. Takes user id as first argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   User id

[ Top ]

method userBelongsToCurrentUser [line 1232]

bool userBelongsToCurrentUser( int $user)

Tests whether user belongs to current user or not. Takes the user id as first argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   Group id

[ Top ]

method userCheckAccess [line 1118]

bool userCheckAccess( [string $area = null], [string $component = null], [string $action = null])

Test if user has access to given area/component/action. Takes the area name as first argument, the component name as second argument and the action name as third argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

string   $area   Area name
string   $component   Component name
string   $action   Action name

[ Top ]

method userExists [line 945]

bool userExists( int $user, [int $project = null])

Finds out whether user exists or nut. Takes the user id as first argument, the project id as second argument.

Returns bool.




Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $project   Project id

[ Top ]

method userIsActive [line 1060]

bool userIsActive( int $user, int $project)

Test if user is an active user of the given project. Takes the user id as first argument, the project id as second argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $project   Project id

[ Top ]

method userIsAuthor [line 1003]

bool userIsAuthor( int $user, int $project)

Tests if given user is an author of the given project. Takes the user id as first argument, the project id as second argument. Returns bool.



Tags:

throws:  User_UserException
access:  public


Parameters:

int   $user   User id
int   $project   Project id

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:52:06 +0100 by phpDocumentor 1.4.3