Class: I2CE User: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 2: Line 2:
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
*Location: Part of the module [[I2CE Module List#user|user]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#user|user]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.1-release/annotate/head:/modules/User/lib/I2CE_User.php modules/User/lib/I2CE_User.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L34 modules/User/lib/I2CE_User.php] on line 34
==Variables==
==Variables==
===$userDB===
===$userDB===
The user database -- may be empty to use the database that is currently being used set base on the value of I2CE::getConfig()->database->user
The user database -- may be empty to use the database that is currently being used set base on the value of I2CE::getConfig()->database->user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L114 i2ce/modules/User/lib/I2CE_User.php] on line 114
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $userDB
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $userDB


===$id===
===$id===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L347 i2ce/modules/User/lib/I2CE_User.php] on line 347
*Type: public $id
*Type: public $id


===$username===
===$username===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L348 i2ce/modules/User/lib/I2CE_User.php] on line 348
*Type: public $username
*Type: public $username


===$password===
===$password===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L349 i2ce/modules/User/lib/I2CE_User.php] on line 349
*Type: public $password
*Type: public $password


===$firstname===
===$firstname===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L350 i2ce/modules/User/lib/I2CE_User.php] on line 350
*Type: public $firstname
*Type: public $firstname


===$lastname===
===$lastname===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L351 i2ce/modules/User/lib/I2CE_User.php] on line 351
*Type: public $lastname
*Type: public $lastname


===$email===
===$email===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L352 i2ce/modules/User/lib/I2CE_User.php] on line 352
*Type: public $email
*Type: public $email


===$role===
===$role===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L353 i2ce/modules/User/lib/I2CE_User.php] on line 353
*Type: public $role
*Type: public $role


===$creator===
===$creator===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L354 i2ce/modules/User/lib/I2CE_User.php] on line 354
*Type: public $creator
*Type: public $creator


===$md5password===
===$md5password===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L355 i2ce/modules/User/lib/I2CE_User.php] on line 355
*Type: public $md5password
*Type: public $md5password


Line 38: Line 48:
===__construct()===
===__construct()===
Create a new instance of a user. If the id isn't given then it will be determined from the session array.
Create a new instance of a user. If the id isn't given then it will be determined from the session array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L147 i2ce/modules/User/lib/I2CE_User.php] on line 147
*Signature: public function __construct($id,$populate,$checkSession,$log)
*Signature: public function __construct($id,$populate,$checkSession,$log)
*Parameters:
*Parameters:
Line 50: Line 61:
===addUserLog()===
===addUserLog()===
Add a new record to the user log for this user showing they have logged in. @global array
Add a new record to the user log for this user showing they have logged in. @global array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L245 i2ce/modules/User/lib/I2CE_User.php] on line 245
*Signature: private function addUserLog()
*Signature: private function addUserLog()
===changePassword()===
===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.
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.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L48 i2ce/modules/User/lib/I2CE_User.php] on line 48
*Signature: public function changePassword($old_password,$new_password)
*Signature: public function changePassword($old_password,$new_password)
*Parameters:
*Parameters:
Line 59: Line 72:
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>keys are 'sucess'  and 'message' the message to display back to the user signifying success or failure. @global array
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>keys are 'sucess'  and 'message' the message to display back to the user signifying success or failure. @global array
===displayName()===
===displayName()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L269 i2ce/modules/User/lib/I2CE_User.php] on line 269
*Signature: public function displayName()
*Signature: public function displayName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The first initial and last name of this user.
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The first initial and last name of this user.
===findUser()===
===findUser()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L361 i2ce/modules/User/lib/I2CE_User.php] on line 361
*Signature: static public function findUser($field,$value,$log)
*Signature: static public function findUser($field,$value,$log)
*Parameters:
*Parameters:
Line 70: Line 85:
===getId()===
===getId()===
Get the ID of the user
Get the ID of the user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L222 i2ce/modules/User/lib/I2CE_User.php] on line 222
*Signature: public function getId()
*Signature: public function getId()
*Returns: integer
*Returns: integer
===getPreferredLocale()===
===getPreferredLocale()===
Gets the prefered locales for the user
Gets the prefered locales for the user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L68 i2ce/modules/User/lib/I2CE_User.php] on line 68
*Signature: public function getPreferredLocale()
*Signature: public function getPreferredLocale()
*Returns: $string
*Returns: $string
===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.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L178 i2ce/modules/User/lib/I2CE_User.php] on line 178
*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 ]
===getUserDB()===
===getUserDB()===
Returns the database where the user table can be found.  This will add the trailing period if it isn't already there.
Returns the database where the user table can be found.  This will add the trailing period if it isn't already there.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L123 i2ce/modules/User/lib/I2CE_User.php] on line 123
*Signature: static public function getUserDB()
*Signature: static public function getUserDB()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===logged_in()===
===logged_in()===
Checks to see if the user is logged in.
Checks to see if the user is logged in.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L314 i2ce/modules/User/lib/I2CE_User.php] on line 314
*Signature: public function logged_in()
*Signature: public function logged_in()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===login()===
===login()===
Login the user. Check the login and password of the user and log them in.  If the password is incorrect then an error message will be set on the [[Class: I2CE_Template | template]].
Login the user. Check the login and password of the user and log them in.  If the password is incorrect then an error message will be set on the [[Class: I2CE_Template | template]].
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L283 i2ce/modules/User/lib/I2CE_User.php] on line 283
*Signature: public function login($username,$password,$template)
*Signature: public function login($username,$password,$template)
*Parameters:
*Parameters:
Line 97: Line 118:
===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.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L230 i2ce/modules/User/lib/I2CE_User.php] on line 230
*Signature: public function logout()
*Signature: public function logout()
===mailPassword()===
===mailPassword()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L378 i2ce/modules/User/lib/I2CE_User.php] on line 378
*Signature: protected function mailPassword()
*Signature: protected function mailPassword()
===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.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L191 i2ce/modules/User/lib/I2CE_User.php] on line 191
*Signature: public function populate($update_log)
*Signature: public function populate($update_log)
*Parameters:
*Parameters:
Line 108: Line 132:
===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. @global array
Saves the user to the database. This method saves all the user data and updates the access the user has for this system. @global array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L394 i2ce/modules/User/lib/I2CE_User.php] on line 394
*Signature: public function save($transact)
*Signature: public function save($transact)
*Parameters:
*Parameters:
Line 114: Line 139:
===setCreator()===
===setCreator()===
Set the creator id of this user.
Set the creator id of this user.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L322 i2ce/modules/User/lib/I2CE_User.php] on line 322
*Signature: public function setCreator($creator)
*Signature: public function setCreator($creator)
*Parameters:
*Parameters:
Line 119: Line 145:
===setId()===
===setId()===
Sets the id of the user if not known at creation.
Sets the id of the user if not known at creation.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L169 i2ce/modules/User/lib/I2CE_User.php] on line 169
*Signature: public function setId($id)
*Signature: public function setId($id)
*Parameters:
*Parameters:
** integer $id
** integer $id
===setPassword()===
===setPassword()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L326 i2ce/modules/User/lib/I2CE_User.php] on line 326
*Signature: public function setPassword($password,$do_email)
*Signature: public function setPassword($password,$do_email)
*Parameters:
*Parameters:
Line 130: Line 158:
===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.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L93 i2ce/modules/User/lib/I2CE_User.php] on line 93
*Signature: public function setPreferredLocale($locale)
*Signature: public function setPreferredLocale($locale)
*Parameters:
*Parameters:
Line 136: Line 165:
===username()===
===username()===
Get the username
Get the username
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/User/lib/I2CE_User.php#L262 i2ce/modules/User/lib/I2CE_User.php] on line 262
*Signature: public function username()
*Signature: public function username()
==Inherited Methods==
==Inherited Methods==

Revision as of 09:19, 10 November 2009

This article describes the class I2CE_User.

Variables

$userDB

The user database -- may be empty to use the database that is currently being used set base on the value of I2CE::getConfig()->database->user

$id

$username

$password

$firstname

$lastname

$email

$role

$creator

$md5password

Methods

__construct()

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

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 147
  • Signature: public function __construct($id,$populate,$checkSession,$log)
  • Parameters:
    • integer $id
      The id of the user in the database.
      • 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['userid'] for a user id. Defaults to true
      • Default Value: true
    • boolean $log
      Defaults to true which means we dot record this in the login table
      • Default Value: true

addUserLog()

Add a new record to the user log for this user showing they have logged in. @global array

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.

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 48
  • Signature: public function changePassword($old_password,$new_password)
  • Parameters:
  • Returns: array
    keys are 'sucess' and 'message' the message to display back to the user signifying success or failure. @global array

displayName()

findUser()

  • Defined in i2ce/modules/User/lib/I2CE_User.php on line 361
  • Signature: static public function findUser($field,$value,$log)
  • Parameters:
    • $field
    • $value
    • boolean $log
      Defaults to false whch means we do not record this in the login table
      • Default Value: false

getId()

Get the ID of the user

getPreferredLocale()

Gets the prefered locales for the user

getRole()

Get's the role associated with a user.

getUserDB()

Returns the database where the user table can be found. This will add the trailing period if it isn't already there.

logged_in()

Checks to see if the user is logged in.

login()

Login the user. Check the login and password of the user and log them in. If the password is incorrect then an error message will be set on the template.

logout()

Log the user out of the system. @global array

mailPassword()

populate()

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

save()

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

setCreator()

Set the creator id of this user.

setId()

Sets the id of the user if not known at creation.

setPassword()

setPreferredLocale()

Sets the prefered locales for the user

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()