Class: I2CE User Form: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 2: Line 2:
*Extends the class: [[Class: I2CE_Form | I2CE_Form]].
*Extends the class: [[Class: I2CE_Form | I2CE_Form]].
*Location: Part of the module [[I2CE Module List#UserForm|UserForm]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#UserForm|UserForm]] 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/Forms/modules/UserForm/lib/I2CE_User_Form.php modules/Forms/modules/UserForm/lib/I2CE_User_Form.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L33 modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 33
*Author: Luke Duncan <lduncan@intrahealth.org>
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v2.0.0
*Since: v2.0.0
Line 28: Line 28:
==Variables==
==Variables==
===$db===
===$db===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L105 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 105
*Type: protected $db
*Type: protected $db


===$user_fields===
===$user_fields===
an array of the fields which are handled by I2CE_User rather than by the form mechanism
an array of the fields which are handled by I2CE_User rather than by the form mechanism
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L111 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 111
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $user_fields
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $user_fields


===$user_form_fields===
===$user_form_fields===
an array of the fields which are handled by I2CE_User rather than by the form mechanism and are also form fields @var protected array $user_fields
an array of the fields which are handled by I2CE_User rather than by the form mechanism and are also form fields @var protected array $user_fields
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L117 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 117
*Type: protected $user_form_fields
*Type: protected $user_form_fields


===$user===
===$user===
The I2CE_User which makes up this form protected I2CE_User $user
The I2CE_User which makes up this form protected I2CE_User $user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L163 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 163
*Type: protected $user
*Type: protected $user


===$userDB===
===$userDB===
The user database protected string $userDB
The user database protected string $userDB
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L170 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 170
*Type: protected $userDB
*Type: protected $userDB


Line 49: Line 54:
===__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/Forms/modules/UserForm/lib/I2CE_User_Form.php#L87 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 87
*Signature: public function __construct($form,$id)
*Signature: public function __construct($form,$id)
*Parameters:
*Parameters:
Line 56: Line 62:
***Default Value: '0'
***Default Value: '0'
===__get()===
===__get()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L204 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 204
*Signature: public function __get($key)
*Signature: public function __get($key)
*Parameters:
*Parameters:
Line 61: Line 68:
===__set()===
===__set()===
Set the member variable in the  array.
Set the member variable in the  array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L222 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 222
*Signature: protected function __set($key,$value)
*Signature: protected function __set($key,$value)
*Parameters:
*Parameters:
Line 67: Line 75:
===__unset()===
===__unset()===
Unset a member variable.
Unset a member variable.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L233 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 233
*Signature: protected function __unset($key)
*Signature: protected function __unset($key)
*Parameters:
*Parameters:
Line 72: Line 81:
===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/Forms/modules/UserForm/lib/I2CE_User_Form.php#L141 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 141
*Signature: public function changePassword($post)
*Signature: public function changePassword($post)
*Parameters:
*Parameters:
Line 78: Line 88:
===clearFields()===
===clearFields()===
Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.
Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L330 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 330
*Signature: public function clearFields($fields,$keep)
*Signature: public function clearFields($fields,$keep)
*Parameters:
*Parameters:
Line 84: Line 95:
***Default Value: true  
***Default Value: true  
===displayName()===
===displayName()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L126 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 126
*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.
===getRoleNameFromShortName()===
===getRoleNameFromShortName()===
Get the display name associated to a role's shortname
Get the display name associated to a role's shortname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L69 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 69
*Signature: static public function getRoleNameFromShortName($name)
*Signature: static public function getRoleNameFromShortName($name)
*Parameters:
*Parameters:
Line 94: Line 107:
===getTrickleUpFromShortName()===
===getTrickleUpFromShortName()===
Returns the role trickle up from the shortname
Returns the role trickle up from the shortname
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L42 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 42
*Signature: static public function getTrickleUpFromShortName($name)
*Signature: static public function getTrickleUpFromShortName($name)
*Parameters:
*Parameters:
Line 100: Line 114:
===load()===
===load()===
Load the member variables from an array
Load the member variables from an array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L183 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 183
*Signature: public function load($post,$loadID,$populate_on_set_id)
*Signature: public function load($post,$loadID,$populate_on_set_id)
*Parameters:
*Parameters:
Line 109: Line 124:
===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/Forms/modules/UserForm/lib/I2CE_User_Form.php#L248 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 248
*Signature: public function populate($update_log)
*Signature: public function populate($update_log)
*Parameters:
*Parameters:
Line 115: Line 131:
===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/Forms/modules/UserForm/lib/I2CE_User_Form.php#L303 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 303
*Signature: public function save()
*Signature: public function save()
===tryGeneratePassword()===
===tryGeneratePassword()===
Try to generate a new password and assign it to the password and confirm variables.
Try to generate a new password and assign it to the password and confirm variables.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L264 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 264
*Signature: public function tryGeneratePassword()
*Signature: public function tryGeneratePassword()
===validate()===
===validate()===
Checks to make sure all the required fields are valid. Checks to make sure the username is unique in the system and that the password matches the confirmed password. @global array
Checks to make sure all the required fields are valid. Checks to make sure the username is unique in the system and that the password matches the confirmed password. @global array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php#L282 i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php] on line 282
*Signature: public function validate()
*Signature: public function validate()
==Inherited Methods==
==Inherited Methods==

Revision as of 10:19, 10 November 2009

This article describes the class I2CE_User_Form.

Object for dealing with system users. This class uses the interface to handle editing of users from within the system as well as handles role access for pages.

Form Fields

This class is a form class and provides the following form fields

username

The form field username is implemented by STRING_LINE

password

The form field password is implemented by STRING_PASS

confirm

The form field confirm is implemented by STRING_PASS

firstname

The form field firstname is implemented by STRING_LINE

lastname

The form field lastname is implemented by STRING_LINE

email

The form field email is implemented by STRING_LINE

role

The form field role is implemented by MAP

creator

The form field creator is implemented by INT

generate_password

The form field generate_password is implemented by YESNO

Variables

$db

$user_fields

an array of the fields which are handled by I2CE_User rather than by the form mechanism

$user_form_fields

an array of the fields which are handled by I2CE_User rather than by the form mechanism and are also form fields @var protected array $user_fields

$user

The I2CE_User which makes up this form protected I2CE_User $user

$userDB

The user database protected string $userDB

Methods

__construct()

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

__get()

__set()

Set the member variable in the array.

__unset()

Unset a member variable.

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.

clearFields()

Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.

displayName()

getRoleNameFromShortName()

Get the display name associated to a role's shortname

getTrickleUpFromShortName()

Returns the role trickle up from the shortname

load()

Load the member variables from an array

  • Defined in i2ce/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php on line 183
  • Signature: public function load($post,$loadID,$populate_on_set_id)
  • Parameters:
    • array $post
      The Post vairables. Usually from an http request.
    • boolean $loadID
      Defaults to true. If true, and there is exactly one of entry in the array $post['forms'][$this->form_name], we set the values of the form's field, id and parent from that entry. If false, we set the values from $post['forms'][$this->form_name][$this->getID()] if it is present
      • Default Value: true
    • $populate_on_set_id
      • Default Value: true

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

tryGeneratePassword()

Try to generate a new password and assign it to the password and confirm variables.

validate()

Checks to make sure all the required fields are valid. Checks to make sure the username is unique in the system and that the password matches the confirmed password. @global array

Inherited Methods

addChildForm()

This public method is inherited from I2CE_Form->addChildForm()

addField()

This public method is inherited from I2CE_Form->addField()

cleanup()

This public method is inherited from I2CE_Form->cleanup()

current()

This public method is inherited from I2CE_Form->current()

displayField()

This public method is inherited from I2CE_Form->displayField()

form()

This public method is inherited from I2CE_Form->form()

getAllowedParentForms()

This public method is inherited from I2CE_Form->getAllowedParentForms()

getAttribute()

This public method is inherited from I2CE_Form->getAttribute()

getChildForms()

This public method is inherited from I2CE_Form->getChildForms()

getChildFormsByForm()

This public method is inherited from I2CE_Form->getChildFormsByForm()

getChildren()

This public method is inherited from I2CE_Form->getChildren()

getDisplayName()

This public method is inherited from I2CE_Form->getDisplayName()

getField()

This public method is inherited from I2CE_Form->getField()

getFieldNames()

This public method is inherited from I2CE_Form->getFieldNames()

getFormId()

This public method is inherited from I2CE_Form->getFormId()

getHTMLName()

This public method is inherited from I2CE_Form->getHTMLName()

getId()

This public method is inherited from I2CE_Form->getId()

getParent()

This public method is inherited from I2CE_Form->getParent()

getParentForm()

This public method is inherited from I2CE_Form->getParentForm()

getParentID()

This public method is inherited from I2CE_Form->getParentID()

getQueryDisplay()

This public method is inherited from I2CE_Form->getQueryDisplay()

getQueryFields()

This public method is inherited from I2CE_Form->getQueryFields()

getQueryString()

This public method is inherited from I2CE_Form->getQueryString()

hasAttribute()

This public method is inherited from I2CE_Form->hasAttribute()

hasInvalid()

This public method is inherited from I2CE_Form->hasInvalid()

key()

This public method is inherited from I2CE_Form->key()

listFields()

This public method is inherited from I2CE_Form->listFields()

next()

This public method is inherited from I2CE_Form->next()

processDOM()

This public method is inherited from I2CE_Form->processDOM()

removeField()

This public method is inherited from I2CE_Form->removeField()

reset()

This public method is inherited from I2CE_Form->reset()

rewind()

This public method is inherited from I2CE_Form->rewind()

search()

This public method is inherited from I2CE_Form->search()

setAttribute()

This public method is inherited from I2CE_Form->setAttribute()

setDisplayName()

This public method is inherited from I2CE_Form->setDisplayName()

setForm()

This public method is inherited from I2CE_Form->setForm()

setFromPost()

This public method is inherited from I2CE_Form->setFromPost()

setId()

This public method is inherited from I2CE_Form->setId()

setParent()

This public method is inherited from I2CE_Form->setParent()

valid()

This public method is inherited from I2CE_Form->valid()

__isset()

This protected method is inherited from I2CE_Form->__isset()

addFormFields()

This protected method is inherited from I2CE_Form->addFormFields()

getFormFieldsData()

This protected method is inherited from I2CE_Form->getFormFieldsData()

lookupArray()

This protected method is inherited from I2CE_Form->lookupArray()

_hasMethod()

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

Inherited Variables

$children

Theis public variable is inherited from I2CE_Form->$children

$fields

Theis protected variable is inherited from I2CE_Form->$fields

$parent

Theis protected variable is inherited from I2CE_Form->$parent

$id

Theis protected variable is inherited from I2CE_Form->$id

$attributes

Theis protected variable is inherited from I2CE_Form->$attributes

$parent_forms

Theis protected variable is inherited from I2CE_Form->$parent_forms

Inherited Fuzzy Methods

isNumeric()

This method is inherited from I2CE_Form->isNumeric()

getLimitStyles()

This method is inherited from I2CE_Form->getLimitStyles()

checkLimit()

This method is inherited from I2CE_Form->checkLimit()

checkWhereClause()

This method is inherited from I2CE_Form->checkWhereClause()

createCheckFunction()

This method is inherited from I2CE_Form->createCheckFunction()

createCheckLimitString()

This method is inherited from I2CE_Form->createCheckLimitString()

generateLimit()

This method is inherited from I2CE_Form->generateLimit()

generateWhereClause()

This method is inherited from I2CE_Form->generateWhereClause()

processLimit()

This method is inherited from I2CE_Form->processLimit()

getDisplayedExistingLimit()

This method is inherited from I2CE_Form->getDisplayedExistingLimit()

isComponentized()

This method is inherited from I2CE_Form->isComponentized()

addChild()

This method is inherited from I2CE_Form->addChild()

getChildIds()

This method is inherited from I2CE_Form->getChildIds()

getStorage()

This method is inherited from I2CE_Form->getStorage()

isWritable()

This method is inherited from I2CE_Form->isWritable()

populateChild()

This method is inherited from I2CE_Form->populateChild()

populateChildren()

This method is inherited from I2CE_Form->populateChildren()

populateFirst()

This method is inherited from I2CE_Form->populateFirst()

populateHistory()

This method is inherited from I2CE_Form->populateHistory()

populateLast()

This method is inherited from I2CE_Form->populateLast()

delete()

This method is inherited from I2CE_Form->delete()

setChangeType()

This method is inherited from I2CE_Form->setChangeType()

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()