CWIS Developer Documentation
Public Member Functions | Protected Attributes | List of all members
UserFactory Class Reference
Inheritance diagram for UserFactory:
Inheritance graph
[legend]

Public Member Functions

 __construct ()
 Object constructor. More...
 
 CreateNewUser ($UserName, $Password, $PasswordAgain, $EMail, $EMailAgain, $IgnoreErrorCodes=NULL)
 Create new user. More...
 
 TestNewUserValues ($UserName, $Password, $PasswordAgain, $EMail, $EMailAgain)
 Test new user values (usually used before creating new user). More...
 
 GetUserCount ($Condition=NULL)
 Return number of users in the system. More...
 
 GetMatchingUserCount ()
 Get total number of user that matched last GetMatchingUsers() call. More...
 
 GetUserIds ()
 Get IDs for all users. More...
 
 GetLoggedInUsers ($InactivityTimeout=60)
 Get users who are currently logged in (i.e. More...
 
 GetRecentlyLoggedInUsers ($Since=NULL, $Limit=10)
 Get users recently logged in. More...
 
 GetUsersWithPrivileges ()
 Return array of user names who have the specified privileges. More...
 
 FindUsers ($SearchString, $FieldName="UserName", $SortFieldName="UserName", $Offset=0, $Count=9999999)
 Get users who have values matching specified string in specified field. More...
 
 FindUserNames ($SearchString, $FieldName="UserName", $SortFieldName="UserName", $Offset=0, $Count=9999999, $IdExclusions=array(), $ValueExclusions=array())
 Get users who have values matching specified string in specified field. More...
 
 GetMatchingUsers ($SearchString, $FieldName=NULL, $SortFieldName="UserName", $ResultsStartAt=0, $ReturnNumber=NULL)
 Return array of users who have values matching search string (in specific field if requested). More...
 
 UserExists ($UserId)
 Check whether user currently exists with specified ID. More...
 
 UserNameExists ($UserName)
 Check whether user name currently exists. More...
 
 EMailAddressIsInUse ($Address)
 Check whether e-mail address currently has account associated with it. More...
 
 GetNewestUsers ($Limit=5)
 Get the users sorted by when they signed up, starting with those who signed up most recently. More...
 

Protected Attributes

 $DB
 
 $SortFieldName
 
 $MatchingUserCount
 

Detailed Description

Definition at line 18 of file UserFactory.php.

Constructor & Destructor Documentation

UserFactory::__construct ( )

Object constructor.

Definition at line 26 of file UserFactory.php.

Member Function Documentation

UserFactory::CreateNewUser (   $UserName,
  $Password,
  $PasswordAgain,
  $EMail,
  $EMailAgain,
  $IgnoreErrorCodes = NULL 
)

Create new user.

The second password and e-mail address parameters are intended for second copies of each entered by the user.

Parameters
string$UserNameLogin name for new user.
string$PasswordPassword for new user.
string$PasswordAgainSecond copy of password entered by user.
string$EMailE-mail address for new user.
string$EMailAgainSecond copy of e-mail address entered by user.
bool$IgnoreErrorCodesArray containing any error codes that should be ignored. (OPTIONAL)
Returns
User object or array of error codes.

Definition at line 48 of file UserFactory.php.

References TestNewUserValues(), and U_OKAY.

UserFactory::EMailAddressIsInUse (   $Address)

Check whether e-mail address currently has account associated with it.

Parameters
string$AddressAddress to check.
Returns
bool TRUE if address is in use, otherwise FALSE.

Definition at line 568 of file UserFactory.php.

Referenced by TestNewUserValues().

Here is the caller graph for this function:

UserFactory::FindUserNames (   $SearchString,
  $FieldName = "UserName",
  $SortFieldName = "UserName",
  $Offset = 0,
  $Count = 9999999,
  $IdExclusions = array(),
  $ValueExclusions = array() 
)

Get users who have values matching specified string in specified field.

Parameters
string$SearchStringString to match.
string$FieldNameDatabase column name to search. (OPTIONAL, defaults to "UserName")
string$SortFieldNameDatabase column name to sort results by. (OPTIONAL, defaults to "UserName")
int$OffsetStarting index for results. (OPTIONAL)
int$CountMaximum number of results to return. (OPTIONAL)
array$IdExclusionsUser IDs to exclude. (OPTIONAL)
array$ValueExclusionsUser names to exclude. (OPTIONAL)
Returns
array Array with user IDs for the index and user names for the values.

Definition at line 382 of file UserFactory.php.

Referenced by FindUsers().

Here is the caller graph for this function:

UserFactory::FindUsers (   $SearchString,
  $FieldName = "UserName",
  $SortFieldName = "UserName",
  $Offset = 0,
  $Count = 9999999 
)

Get users who have values matching specified string in specified field.

Parameters
string$SearchStringString to match.
string$FieldNameDatabase column name to search. (OPTIONAL, defaults to "UserName")
string$SortFieldNameDatabase column name to sort results by. (OPTIONAL, defaults to "UserName")
int$OffsetStarting index for results. (OPTIONAL)
int$CountMaximum number of results to return. (OPTIONAL)
Returns
array Array with user IDs for the index and User objects for the values.

Definition at line 350 of file UserFactory.php.

References $SortFieldName, and FindUserNames().

UserFactory::GetLoggedInUsers (   $InactivityTimeout = 60)

Get users who are currently logged in (i.e.

recently active and not logged out).

Parameters
int$InactivityTimeoutNumber of minutes after which an inactive user is considered to be no longer logged in. (OPTIONAL, defaults to 60)
Returns
Array of User objects.

Definition at line 226 of file UserFactory.php.

UserFactory::GetMatchingUserCount ( )

Get total number of user that matched last GetMatchingUsers() call.

Returns
int Number of users.
See also
UserFactory::GetMatchingUser()

Definition at line 205 of file UserFactory.php.

References $MatchingUserCount.

UserFactory::GetMatchingUsers (   $SearchString,
  $FieldName = NULL,
  $SortFieldName = "UserName",
  $ResultsStartAt = 0,
  $ReturnNumber = NULL 
)

Return array of users who have values matching search string (in specific field if requested).

(Search string respects POSIX-compatible regular expressions.) Optimization: $SearchString = ".*." and $FieldName = NULL will return all users ordered by $SortFieldName.

Parameters
string$SearchStringSearch pattern.
string$FieldNameDatabase column name to search. (OPTIONAL)
string$SortFieldNameDatabase column name to sort results by. (OPTIONAL, defaults to "UserName")
int$ResultsStartAtStarting index for results. (OPTIONAL)
int$ReturnNumberMaximum number of results to return. (OPTIONAL)
Returns
array Array with user IDs for the index and associative arrays of database columns for the values.
See also
UserFactory::GetMatchingUserCount()

Definition at line 439 of file UserFactory.php.

References $SortFieldName.

UserFactory::GetNewestUsers (   $Limit = 5)

Get the users sorted by when they signed up, starting with those who signed up most recently.

By default, the number of users returned is five.

Parameters
int$LimitThe maximum number of users to return.

Definition at line 589 of file UserFactory.php.

UserFactory::GetRecentlyLoggedInUsers (   $Since = NULL,
  $Limit = 10 
)

Get users recently logged in.

Parameters
string$SinceUsed to define "recently". (OPTIONAL, defaults to 24 hours)
int$LimitMaximum number of users to return.
Returns
array Array of User objects, with IDs for the index.

Definition at line 254 of file UserFactory.php.

UserFactory::GetUserCount (   $Condition = NULL)

Return number of users in the system.

Parameters
string$ConditionSQL condition (without "WHERE") to limit user count. (OPTIONAL)
Returns
int Count of users.

Definition at line 194 of file UserFactory.php.

UserFactory::GetUserIds ( )

Get IDs for all users.

Returns
array User IDs.

Definition at line 214 of file UserFactory.php.

Referenced by CWUserFactory\FindUsersThatMeetRequirements().

Here is the caller graph for this function:

UserFactory::GetUsersWithPrivileges ( )

Return array of user names who have the specified privileges.

Multiple privileges can be passed in as parameters (rather than in an array), if desired.

Returns
array User names with user IDs for the array index.

Definition at line 291 of file UserFactory.php.

Referenced by CWUserFactory\FindUsersThatMeetRequirements().

Here is the caller graph for this function:

UserFactory::TestNewUserValues (   $UserName,
  $Password,
  $PasswordAgain,
  $EMail,
  $EMailAgain 
)

Test new user values (usually used before creating new user).

Parameters
string$UserNameUser name entered.
string$PasswordPassword entered.
string$PasswordAgainSecond copy of password entered.
string$EMailEmail entered.
string$EMailAgainSecond copy of email entered.
Returns
array Codes (U_* constants) for errors found (if any).

Definition at line 96 of file UserFactory.php.

References EMailAddressIsInUse(), U_DUPLICATEEMAIL, U_DUPLICATEUSERNAME, U_EMAILSDONTMATCH, U_EMPTYEMAIL, U_EMPTYEMAILAGAIN, U_EMPTYPASSWORDAGAIN, U_EMPTYUSERNAME, U_ILLEGALEMAIL, U_ILLEGALEMAILAGAIN, U_ILLEGALUSERNAME, U_PASSWORDSDONTMATCH, and UserNameExists().

Referenced by CreateNewUser().

Here is the caller graph for this function:

UserFactory::UserExists (   $UserId)

Check whether user currently exists with specified ID.

Parameters
int$UserIdID to check.
Returns
bool TRUE if user exists with that ID, otherwise FALSE.

Definition at line 531 of file UserFactory.php.

UserFactory::UserNameExists (   $UserName)

Check whether user name currently exists.

Parameters
string$UserNameName to check.
Returns
bool TRUE if name is already in use, otherwise FALSE.

Definition at line 547 of file UserFactory.php.

Referenced by TestNewUserValues().

Here is the caller graph for this function:

Member Data Documentation

UserFactory::$DB
protected

Definition at line 615 of file UserFactory.php.

UserFactory::$MatchingUserCount
protected

Definition at line 617 of file UserFactory.php.

Referenced by GetMatchingUserCount().

UserFactory::$SortFieldName
protected

Definition at line 616 of file UserFactory.php.

Referenced by FindUsers(), and GetMatchingUsers().


The documentation for this class was generated from the following file: