Class: I2CE User (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_User}} This article describes the class ''I2CE_User'' . *Extends the class: I2CE_Fuzzy. *Location: Part of the m…')
 
No edit summary
Line 31: Line 31:
===$id===
===$id===
.  False or int, the id for this user.
.  False or int, the id for this user.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L232 i2ce/modules/User/lib/I2CE_User.php] on line 232
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L250 i2ce/modules/User/lib/I2CE_User.php] on line 250
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $id
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $id


Line 37: Line 37:
===__construct()===
===__construct()===
Create a new instance of a user. If the username isn't given then it will be determined from the session array.
Create a new instance of a user. If the username isn't given then it will be determined from the session array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L268 i2ce/modules/User/lib/I2CE_User.php] on line 268
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L286 i2ce/modules/User/lib/I2CE_User.php] on line 286
*Signature: public function __construct($username,$populate,$checkSession,$log)
*Signature: public function __construct($username,$populate,$checkSession,$log)
*Parameters:
*Parameters:
Line 50: Line 50:
===__get()===
===__get()===
Magic method to get user details
Magic method to get user details
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L426 i2ce/modules/User/lib/I2CE_User.php] on line 426
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L444 i2ce/modules/User/lib/I2CE_User.php] on line 444
*Signature: public function __get($detail)
*Signature: public function __get($detail)
*Parameters:
*Parameters:
Line 57: Line 57:
===__set()===
===__set()===
Magic method to set user details
Magic method to set user details
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L402 i2ce/modules/User/lib/I2CE_User.php] on line 402
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L420 i2ce/modules/User/lib/I2CE_User.php] on line 420
*Signature: public function __set($detail,$value)
*Signature: public function __set($detail,$value)
*Parameters:
*Parameters:
Line 64: Line 64:
===__unset()===
===__unset()===
Magic method to unset user details
Magic method to unset user details
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L417 i2ce/modules/User/lib/I2CE_User.php] on line 417
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L435 i2ce/modules/User/lib/I2CE_User.php] on line 435
*Signature: public function __unset($detail)
*Signature: public function __unset($detail)
*Parameters:
*Parameters:
Line 77: Line 77:
*Returns: boolean.<br/>true on success
*Returns: boolean.<br/>true on success
===displayName()===
===displayName()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L487 i2ce/modules/User/lib/I2CE_User.php] on line 487
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L505 i2ce/modules/User/lib/I2CE_User.php] on line 505
*Signature: public function displayName()
*Signature: public function displayName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The display name of this user.
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The display name of this user.
===findUsersByInfo()===
===findUsersByInfo()===
Gets the userss by the indicated  details as well as the  role. @oaram boolean $role Defaults to false
Gets the userss by the indicated  details as well as the  role. @oaram boolean $role Defaults to false
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L506 i2ce/modules/User/lib/I2CE_User.php] on line 506
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L524 i2ce/modules/User/lib/I2CE_User.php] on line 524
*Signature: static public function findUsersByInfo($role,$details,$include_internal)
*Signature: static public function findUsersByInfo($role,$details,$include_internal)
*Parameters:
*Parameters:
Line 106: Line 106:
===getId()===
===getId()===
Gets the user id from the username
Gets the user id from the username
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L239 i2ce/modules/User/lib/I2CE_User.php] on line 239
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L257 i2ce/modules/User/lib/I2CE_User.php] on line 257
*Signature: public function getId()
*Signature: public function getId()
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]<br/>or false on failure
*Returns: [http://www.php.net/manual/en/language.types.integer.php int ]<br/>or false on failure
Line 116: Line 116:
===getRole()===
===getRole()===
Get's the role associated with a user.
Get's the role associated with a user.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L444 i2ce/modules/User/lib/I2CE_User.php] on line 444
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L462 i2ce/modules/User/lib/I2CE_User.php] on line 462
*Signature: public function getRole()
*Signature: public function getRole()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
Line 125: Line 125:
*Parameters:
*Parameters:
**$detail  
**$detail  
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===hasPreferredLocale()===
Checks if  the prefered locale for the user has been saved
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L202 i2ce/modules/User/lib/I2CE_User.php] on line 202
*Signature: public function hasPreferredLocale()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===isRequired()===
===isRequired()===
Line 134: Line 139:
===logged_in()===
===logged_in()===
Checks to see if this user has been logged in
Checks to see if this user has been logged in
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L317 i2ce/modules/User/lib/I2CE_User.php] on line 317
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L335 i2ce/modules/User/lib/I2CE_User.php] on line 335
*Signature: public function logged_in()
*Signature: public function logged_in()
===login()===
===login()===
Login the user and populate their details then an error message will be set on the [[Class: I2CE_Template (Development) | template]].
Login the user and populate their details then an error message will be set on the [[Class: I2CE_Template (Development) | template]].
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L331 i2ce/modules/User/lib/I2CE_User.php] on line 331
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L349 i2ce/modules/User/lib/I2CE_User.php] on line 349
*Signature: public function login($username,$password)
*Signature: public function login($username,$password)
*Parameters:
*Parameters:
Line 146: Line 151:
===logout()===
===logout()===
Log the user out of the system. @global array
Log the user out of the system. @global array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L462 i2ce/modules/User/lib/I2CE_User.php] on line 462
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L480 i2ce/modules/User/lib/I2CE_User.php] on line 480
*Signature: public function logout()
*Signature: public function logout()
===populate()===
===populate()===
Populate the member variables of this object. This will also update the user log to show the latest activity for this login.
Populate the member variables of this object. This will also update the user log to show the latest activity for this login.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L365 i2ce/modules/User/lib/I2CE_User.php] on line 365
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L383 i2ce/modules/User/lib/I2CE_User.php] on line 383
*Signature: public function populate($details,$role,$id)
*Signature: public function populate($details,$role,$id)
*Parameters:
*Parameters:
Line 162: Line 167:
===save()===
===save()===
Saves the user to the database. This method saves all the user data and updates the access the user has for this system.
Saves the user to the database. This method saves all the user data and updates the access the user has for this system.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L522 i2ce/modules/User/lib/I2CE_User.php] on line 522
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L540 i2ce/modules/User/lib/I2CE_User.php] on line 540
*Signature: public function save($password)
*Signature: public function save($password)
*Parameters:
*Parameters:
Line 176: Line 181:
===setPreferredLocale()===
===setPreferredLocale()===
Sets the prefered locales for the user
Sets the prefered locales for the user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L204 i2ce/modules/User/lib/I2CE_User.php] on line 204
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L222 i2ce/modules/User/lib/I2CE_User.php] on line 222
*Signature: public function setPreferredLocale($locale,$save)
*Signature: public function setPreferredLocale($locale,$save)
*Parameters:
*Parameters:
Line 185: Line 190:
===setRole()===
===setRole()===
Get's the role associated with a user. @param string $ole
Get's the role associated with a user. @param string $ole
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L453 i2ce/modules/User/lib/I2CE_User.php] on line 453
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L471 i2ce/modules/User/lib/I2CE_User.php] on line 471
*Signature: public function setRole($role)
*Signature: public function setRole($role)
*Parameters:
*Parameters:
Line 199: Line 204:
===userHasPassword()===
===userHasPassword()===
Checks to see if the specified user has the given password
Checks to see if the specified user has the given password
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L250 i2ce/modules/User/lib/I2CE_User.php] on line 250
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L268 i2ce/modules/User/lib/I2CE_User.php] on line 268
*Signature: static public function userHasPassword($username,$password)
*Signature: static public function userHasPassword($username,$password)
*Parameters:
*Parameters:
Line 207: Line 212:
===username()===
===username()===
Get the username
Get the username
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L480 i2ce/modules/User/lib/I2CE_User.php] on line 480
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/User/lib/I2CE_User.php#L498 i2ce/modules/User/lib/I2CE_User.php] on line 498
*Signature: public function username()
*Signature: public function username()
==Inherited Methods==
==Inherited Methods==

Revision as of 08:59, 3 August 2010


This article describes the class I2CE_User .

Variables

$role

$username

the username

$details

@var public string $role the role associated to the user . An array of user details

$logged_in

flags the user as logged in

$locale

@var protected string $localeThe preferred locale for the user

$id

. False or int, the id for this user.

Methods

__construct()

Create a new instance of a user. If the username isn't given then it will be determined from the session array.

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 286
  • Signature: public function __construct($username,$populate,$checkSession,$log)
  • Parameters:
    • integer $username
      The id of the user in the database. or '0' (the detauls) to get it from the session
      • Default Value: '0'
    • boolean $populate
      A flag to determine if the user should be automatically populated at creation. Defaults to true
      • Default Value: true
    • boolean $checkSession
      A flag to determine if we should check the $_SESSION for user information Defaults to true
      • Default Value: true
    • boolean $log
      Defaults to true which means we log the activity
      • Default Value: false

__get()

Magic method to get user details

__set()

Magic method to set user details

__unset()

Magic method to unset user details

changePassword()

Change the password for this user. This will update a user's record to change the password in the database. It checks to make sure the new password matches the confirmation.

displayName()

findUsersByInfo()

Gets the userss by the indicated details as well as the role. @oaram boolean $role Defaults to false

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 524
  • Signature: static public function findUsersByInfo($role,$details,$include_internal)
  • Parameters:
    • $role
      • Default Value: false
    • array $details
      of string. The details we wish on the user. Defaults to empty array
      • Default Value: array()
    • boolean $include_internal
      Defaults to true in which case we include the internal administator user if it matches the given details/role
      • Default Value: true
  • Returns: mixed.
    I2CE_User on success, false on failure.

generatePassword()

Generate a password

getDetailName()

Returns the display name of the given detail

getId()

Gets the user id from the username

getPreferredLocale()

Gets the prefered locales for the user

getRole()

Get's the role associated with a user.

hasDetail()

check if the specified detail can be set @params string $detail

hasPreferredLocale()

Checks if the prefered locale for the user has been saved

isRequired()

Checks to see if the indicated detail is required $param string $detail returns boolean

logged_in()

Checks to see if this user has been logged in

login()

Login the user and populate their details then an error message will be set on the template.

logout()

Log the user out of the system. @global array

populate()

Populate the member variables of this object. This will also update the user log to show the latest activity for this login.

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 383
  • Signature: public function populate($details,$role,$id)
  • Parameters:
    • mixed $details
      If null, we try to get the details and rolefrom the access mechanism if an array, it is the array of details with key the name of details. Defaults to null. @param mixed role. Default to null otherwise it should be a string, the role.
      • Default Value: null
    • $role
      • Default Value: null
    • mixed $id
      Defaults to false otherwise it should be an int the id.
      • Default Value: false
  • Returns: true
    on success

save()

Saves the user to the database. This method saves all the user data and updates the access the user has for this system.

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 540
  • Signature: public function save($password)
  • Parameters:
    • mixed $password
      If it is a string, it is the password to set for the user. detaulst to false in which case we do not set the password
      • Default Value: false

setPassword()

Set the password for the user

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 117
  • Signature: public function setPassword($password)
  • Parameters:
  • Returns: mixed.
    true on success. on failure it is false or a the message to display back to the user signifying why it failed.

setPreferredLocale()

Sets the prefered locales for the user

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 222
  • Signature: public function setPreferredLocale($locale,$save)
  • Parameters:
  • Returns: string
    $locales. false on failure string or array of strings, the locales on success

setRole()

Get's the role associated with a user. @param string $ole

userExists()

See if a user is in the system

userHasPassword()

Checks to see if the specified user has the given password

username()

Get the username

Inherited Methods

_hasMethod()

This public method is inherited from I2CE_Fuzzy->_hasMethod()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()