Class: I2CE User Form: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 1: Line 1:
__PAGE:Class: I2CE_User_Form
This article describes the class ''I2CE_User_Form''.
This article desrcibes the [[Defining Forms#Dynamic Creation|dynamically]] created class ''I2CE_User_Form''.
*Extends the class: [[Class: I2CE_Form | I2CE_Form]].
*Extends the class: [[Class: I2CE_Form | I2CE_Form]].
*Parent Classses:  [[Class: I2CE_Form | I2CE_Form]] [[Class: I2CE_Fuzzy | I2CE_Fuzzy]]
*Location: Part of the module [[iHRIS Module List#UserForm|UserForm]] in the package [https://launchpad.net/i2ce I2CE]
*Location: It is defined in configuration magic data of the module [[iHRIS 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.0-release/annotate/head:/modules/Forms/modules/UserForm/lib/I2CE_User_Form.php modules/Forms/modules/UserForm/lib/I2CE_User_Form.php]
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v2.0.0
Object for dealing with system users.  This class uses the [[Class: I2CE_Form | ]] interface to handle editing of users from within the system as well as handles role access for pages.
==Form Fields==
==Form Fields==
This class is a [[Class: I2CE_Form |form class]] and provides the following [[Class: I2CE_FormField |form fields]]
This class is a [[Class: I2CE_Form |form class]] and provides the following [[Class: I2CE_FormField |form fields]]
*username is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
==username==
*password is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
The form field ''username'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
*confirm is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
==password==
*firstname is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
The form field ''password'' is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
*lastname is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
==confirm==
*email is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
The form field ''confirm'' is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
*role is implemented by [[Class: I2CE_FormField_MAP |MAP ]]
==firstname==
*creator is implemented by [[Class: I2CE_FormField_INT |INT ]]
The form field ''firstname'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
*generate_password is implemented by [[Class: I2CE_FormField_YESNO |YESNO ]]
==lastname==
==Inherited Methods==
The form field ''lastname'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
===addChildForm()===
==email==
This public method is inherited from [[Class: I2CE_Form#addChildForm() | I2CE_Form->addChildForm()]]
The form field ''email'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
==role==
The form field ''role'' is implemented by [[Class: I2CE_FormField_MAP |MAP ]]
==creator==
The form field ''creator'' is implemented by [[Class: I2CE_FormField_INT |INT ]]
==generate_password==
The form field ''generate_password'' is implemented by [[Class: I2CE_FormField_YESNO |YESNO ]]
==Variables==
===$db===
*Type: protected $db


===addField()===
===$user_fields===
This public method is inherited from [[Class: I2CE_Form#addField() | I2CE_Form->addField()]]
an array of the fields which are handled by I2CE_User rather than by the form mechanism
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $user_fields


===cleanup()===
===$user_form_fields===
This public method is inherited from [[Class: I2CE_Form#cleanup() | I2CE_Form->cleanup()]]
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
*Type: protected $user_form_fields


===current()===
===$user===
This public method is inherited from [[Class: I2CE_Form#current() | I2CE_Form->current()]]
The I2CE_User which makes up this form protected I2CE_User $user
*Type: protected $user


===displayField()===
===$userDB===
This public method is inherited from [[Class: I2CE_Form#displayField() | I2CE_Form->displayField()]]
The user database protected string $userDB
*Type: protected $userDB


===form()===
==Methods==
This public method is inherited from [[Class: I2CE_Form#form() | I2CE_Form->form()]]
===__construct()===
 
Create a new instance of a user. If the id isn't given then it will be determined from the session array.
===getAllowedParentForms()===
*Signature: public function __construct($form,$id)
This public method is inherited from [[Class: I2CE_Form#getAllowedParentForms() | I2CE_Form->getAllowedParentForms()]]
*Parameters:
 
**$form
===getAttribute()===
***Default Value: 'user'
This public method is inherited from [[Class: I2CE_Form#getAttribute() | I2CE_Form->getAttribute()]]
** integer $id <br/>The id of the user in the database.
 
***Default Value: '0'
===getChildForms()===
===__get()===
This public method is inherited from [[Class: I2CE_Form#getChildForms() | I2CE_Form->getChildForms()]]
*Signature: public function __get($key)
 
*Parameters:
===getChildFormsByForm()===
**$key
This public method is inherited from [[Class: I2CE_Form#getChildFormsByForm() | I2CE_Form->getChildFormsByForm()]]
===__set()===
 
Set the member variable in the  array.
===getChildren()===
*Signature: protected function __set($key,$value)
This public method is inherited from [[Class: I2CE_Form#getChildren() | I2CE_Form->getChildren()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.string.php string ] $key
===getDisplayName()===
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
This public method is inherited from [[Class: I2CE_Form#getDisplayName() | I2CE_Form->getDisplayName()]]
===__unset()===
 
Unset a member variable.
===getField()===
*Signature: protected function __unset($key)
This public method is inherited from [[Class: I2CE_Form#getField() | I2CE_Form->getField()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.string.php string ] $key
===getFieldNames()===
===changePassword()===
This public method is inherited from [[Class: I2CE_Form#getFieldNames() | I2CE_Form->getFieldNames()]]
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.
 
*Signature: public function changePassword($post)
===getFormId()===
*Parameters:
This public method is inherited from [[Class: I2CE_Form#getFormId() | I2CE_Form->getFormId()]]
** [http://www.php.net/manual/en/language.types.array.php array ] &$post
 
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The message to display back to the user signifying success or failure. @global array
===getHTMLName()===
===clearFields()===
This public method is inherited from [[Class: I2CE_Form#getHTMLName() | I2CE_Form->getHTMLName()]]
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.
 
*Signature: public function clearFields($fields,$keep)
===getId()===
*Parameters:
This public method is inherited from [[Class: I2CE_Form#getId() | I2CE_Form->getId()]]
** [http://www.php.net/manual/en/language.types.array.php array ] $fields <br/>The fields being worked with.
 
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $keep <br/>A flag to determine if the given fields should be removed or all except the given fields.
===getParent()===
***Default Value: true
This public method is inherited from [[Class: I2CE_Form#getParent() | I2CE_Form->getParent()]]
===displayName()===
 
*Signature: public function displayName()
===getParentForm()===
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>The first initial and last name of this user.
This public method is inherited from [[Class: I2CE_Form#getParentForm() | I2CE_Form->getParentForm()]]
===getRoleNameFromShortName()===
 
Get the display name associated to a role's shortname
===getParentID()===
*Signature: static public function getRoleNameFromShortName($name)
This public method is inherited from [[Class: I2CE_Form#getParentID() | I2CE_Form->getParentID()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>the shortname of the role
===getQueryDisplay()===
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
This public method is inherited from [[Class: I2CE_Form#getQueryDisplay() | I2CE_Form->getQueryDisplay()]]
===getTrickleUpFromShortName()===
 
Returns the role trickle up from the shortname
===getQueryFields()===
*Signature: static public function getTrickleUpFromShortName($name)
This public method is inherited from [[Class: I2CE_Form#getQueryFields() | I2CE_Form->getQueryFields()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>the role shortname
===getQueryString()===
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>(an empty array if there is no such tag name)
This public method is inherited from [[Class: I2CE_Form#getQueryString() | I2CE_Form->getQueryString()]]
===load()===
 
Load the member variables from an array
===hasAttribute()===
*Signature: public function load($post,$loadID,$populate_on_set_id)
This public method is inherited from [[Class: I2CE_Form#hasAttribute() | I2CE_Form->hasAttribute()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.array.php array ] $post <br/>The Post vairables.  Usually from an http request.
===hasInvalid()===
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $loadID <br/>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
This public method is inherited from [[Class: I2CE_Form#hasInvalid() | I2CE_Form->hasInvalid()]]
***Default Value: true
 
**$populate_on_set_id
===key()===
***Default Value: true
This public method is inherited from [[Class: I2CE_Form#key() | I2CE_Form->key()]]
===populate()===
 
Populate the member variables of this object. This will also update the user log to show the latest activity for this login.
===listFields()===
*Signature: public function populate($update_log)
This public method is inherited from [[Class: I2CE_Form#listFields() | I2CE_Form->listFields()]]
*Parameters:
 
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $update_log @global array
===next()===
***Default Value: true
This public method is inherited from [[Class: I2CE_Form#next() | I2CE_Form->next()]]
===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
===processDOM()===
*Signature: public function save()
This public method is inherited from [[Class: I2CE_Form#processDOM() | I2CE_Form->processDOM()]]
===tryGeneratePassword()===
 
Try to generate a new password and assign it to the password and confirm variables.
===removeField()===
*Signature: public function tryGeneratePassword()
This public method is inherited from [[Class: I2CE_Form#removeField() | I2CE_Form->removeField()]]
===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
===reset()===
*Signature: public function validate()
This public method is inherited from [[Class: I2CE_Form#reset() | I2CE_Form->reset()]]
 
===rewind()===
This public method is inherited from [[Class: I2CE_Form#rewind() | I2CE_Form->rewind()]]
 
===search()===
This public method is inherited from [[Class: I2CE_Form#search() | I2CE_Form->search()]]
 
===setAttribute()===
This public method is inherited from [[Class: I2CE_Form#setAttribute() | I2CE_Form->setAttribute()]]
 
===setDisplayName()===
This public method is inherited from [[Class: I2CE_Form#setDisplayName() | I2CE_Form->setDisplayName()]]
 
===setForm()===
This public method is inherited from [[Class: I2CE_Form#setForm() | I2CE_Form->setForm()]]
 
===setFromPost()===
This public method is inherited from [[Class: I2CE_Form#setFromPost() | I2CE_Form->setFromPost()]]
 
===setId()===
This public method is inherited from [[Class: I2CE_Form#setId() | I2CE_Form->setId()]]
 
===setParent()===
This public method is inherited from [[Class: I2CE_Form#setParent() | I2CE_Form->setParent()]]
 
===valid()===
This public method is inherited from [[Class: I2CE_Form#valid() | I2CE_Form->valid()]]
 
===__isset()===
This protected method is inherited from [[Class: I2CE_Form#__isset() | I2CE_Form->__isset()]]
 
===addFormFields()===
This protected method is inherited from [[Class: I2CE_Form#addFormFields() | I2CE_Form->addFormFields()]]
 
===getFormFieldsData()===
This protected method is inherited from [[Class: I2CE_Form#getFormFieldsData() | I2CE_Form->getFormFieldsData()]]
 
===lookupArray()===
This protected method is inherited from [[Class: I2CE_Form#lookupArray() | I2CE_Form->lookupArray()]]
 
===_hasMethod()===
This public method is inherited from [[Class: I2CE_Fuzzy#_hasMethod() | I2CE_Fuzzy->_hasMethod()]]
==Inherited Variables==
===$children===
Theis public variable is inherited from [[Class: I2CE_Form#$children | I2CE_Form->$children]]
 
===$fields===
Theis protected variable is inherited from [[Class: I2CE_Form#$fields | I2CE_Form->$fields]]
 
===$parent===
Theis protected variable is inherited from [[Class: I2CE_Form#$parent | I2CE_Form->$parent]]
 
===$id===
Theis protected variable is inherited from [[Class: I2CE_Form#$id | I2CE_Form->$id]]
 
===$attributes===
Theis protected variable is inherited from [[Class: I2CE_Form#$attributes | I2CE_Form->$attributes]]
 
===$parent_forms===
Theis protected variable is inherited from [[Class: I2CE_Form#$parent_forms | I2CE_Form->$parent_forms]]
==Inherited Fuzzy Methods==
===isNumeric()===
This method is inherited from [[Class: I2CE_Form#isNumeric() | I2CE_Form->isNumeric()]]
 
===getLimitStyles()===
This method is inherited from [[Class: I2CE_Form#getLimitStyles() | I2CE_Form->getLimitStyles()]]
 
===checkLimit()===
This method is inherited from [[Class: I2CE_Form#checkLimit() | I2CE_Form->checkLimit()]]
 
===checkWhereClause()===
This method is inherited from [[Class: I2CE_Form#checkWhereClause() | I2CE_Form->checkWhereClause()]]
 
===createCheckFunction()===
This method is inherited from [[Class: I2CE_Form#createCheckFunction() | I2CE_Form->createCheckFunction()]]
 
===createCheckLimitString()===
This method is inherited from [[Class: I2CE_Form#createCheckLimitString() | I2CE_Form->createCheckLimitString()]]
 
===generateLimit()===
This method is inherited from [[Class: I2CE_Form#generateLimit() | I2CE_Form->generateLimit()]]
 
===generateWhereClause()===
This method is inherited from [[Class: I2CE_Form#generateWhereClause() | I2CE_Form->generateWhereClause()]]
 
===processLimit()===
This method is inherited from [[Class: I2CE_Form#processLimit() | I2CE_Form->processLimit()]]
 
===getDisplayedExistingLimit()===
This method is inherited from [[Class: I2CE_Form#getDisplayedExistingLimit() | I2CE_Form->getDisplayedExistingLimit()]]
 
===isComponentized()===
This method is inherited from [[Class: I2CE_Form#isComponentized() | I2CE_Form->isComponentized()]]
 
===addChild()===
This method is inherited from [[Class: I2CE_Form#addChild() | I2CE_Form->addChild()]]
 
===getChildIds()===
This method is inherited from [[Class: I2CE_Form#getChildIds() | I2CE_Form->getChildIds()]]
 
===getStorage()===
This method is inherited from [[Class: I2CE_Form#getStorage() | I2CE_Form->getStorage()]]
 
===isWritable()===
This method is inherited from [[Class: I2CE_Form#isWritable() | I2CE_Form->isWritable()]]
 
===populateChild()===
This method is inherited from [[Class: I2CE_Form#populateChild() | I2CE_Form->populateChild()]]
 
===populateChildren()===
This method is inherited from [[Class: I2CE_Form#populateChildren() | I2CE_Form->populateChildren()]]
 
===populateFirst()===
This method is inherited from [[Class: I2CE_Form#populateFirst() | I2CE_Form->populateFirst()]]
 
===populateHistory()===
This method is inherited from [[Class: I2CE_Form#populateHistory() | I2CE_Form->populateHistory()]]
 
===populateLast()===
This method is inherited from [[Class: I2CE_Form#populateLast() | I2CE_Form->populateLast()]]
 
===delete()===
This method is inherited from [[Class: I2CE_Form#delete() | I2CE_Form->delete()]]
 
===setChangeType()===
This method is inherited from [[Class: I2CE_Form#setChangeType() | I2CE_Form->setChangeType()]]
 
===userMessage()===
This method is inherited from [[Class: I2CE_Fuzzy#userMessage() | I2CE_Fuzzy->userMessage()]]
==Inherited Methods==
===addChildForm()===
This public method is inherited from [[Class: I2CE_Form#addChildForm() | I2CE_Form->addChildForm()]]
 
===addField()===
This public method is inherited from [[Class: I2CE_Form#addField() | I2CE_Form->addField()]]
 
===cleanup()===
This public method is inherited from [[Class: I2CE_Form#cleanup() | I2CE_Form->cleanup()]]
 
===current()===
This public method is inherited from [[Class: I2CE_Form#current() | I2CE_Form->current()]]
 
===displayField()===
This public method is inherited from [[Class: I2CE_Form#displayField() | I2CE_Form->displayField()]]
 
===form()===
This public method is inherited from [[Class: I2CE_Form#form() | I2CE_Form->form()]]
 
===getAllowedParentForms()===
This public method is inherited from [[Class: I2CE_Form#getAllowedParentForms() | I2CE_Form->getAllowedParentForms()]]
 
===getAttribute()===
This public method is inherited from [[Class: I2CE_Form#getAttribute() | I2CE_Form->getAttribute()]]
 
===getChildForms()===
This public method is inherited from [[Class: I2CE_Form#getChildForms() | I2CE_Form->getChildForms()]]
 
===getChildFormsByForm()===
This public method is inherited from [[Class: I2CE_Form#getChildFormsByForm() | I2CE_Form->getChildFormsByForm()]]
 
===getChildren()===
This public method is inherited from [[Class: I2CE_Form#getChildren() | I2CE_Form->getChildren()]]
 
===getDisplayName()===
This public method is inherited from [[Class: I2CE_Form#getDisplayName() | I2CE_Form->getDisplayName()]]
 
===getField()===
This public method is inherited from [[Class: I2CE_Form#getField() | I2CE_Form->getField()]]
 
===getFieldNames()===
This public method is inherited from [[Class: I2CE_Form#getFieldNames() | I2CE_Form->getFieldNames()]]
 
===getFormId()===
This public method is inherited from [[Class: I2CE_Form#getFormId() | I2CE_Form->getFormId()]]
 
===getHTMLName()===
This public method is inherited from [[Class: I2CE_Form#getHTMLName() | I2CE_Form->getHTMLName()]]
 
===getId()===
This public method is inherited from [[Class: I2CE_Form#getId() | I2CE_Form->getId()]]
 
===getParent()===
This public method is inherited from [[Class: I2CE_Form#getParent() | I2CE_Form->getParent()]]
 
===getParentForm()===
This public method is inherited from [[Class: I2CE_Form#getParentForm() | I2CE_Form->getParentForm()]]
 
===getParentID()===
This public method is inherited from [[Class: I2CE_Form#getParentID() | I2CE_Form->getParentID()]]
 
===getQueryDisplay()===
This public method is inherited from [[Class: I2CE_Form#getQueryDisplay() | I2CE_Form->getQueryDisplay()]]
 
===getQueryFields()===
This public method is inherited from [[Class: I2CE_Form#getQueryFields() | I2CE_Form->getQueryFields()]]
 
===getQueryString()===
This public method is inherited from [[Class: I2CE_Form#getQueryString() | I2CE_Form->getQueryString()]]
 
===hasAttribute()===
This public method is inherited from [[Class: I2CE_Form#hasAttribute() | I2CE_Form->hasAttribute()]]
 
===hasInvalid()===
This public method is inherited from [[Class: I2CE_Form#hasInvalid() | I2CE_Form->hasInvalid()]]
 
===key()===
This public method is inherited from [[Class: I2CE_Form#key() | I2CE_Form->key()]]
 
===listFields()===
This public method is inherited from [[Class: I2CE_Form#listFields() | I2CE_Form->listFields()]]
 
===next()===
This public method is inherited from [[Class: I2CE_Form#next() | I2CE_Form->next()]]
 
===processDOM()===
This public method is inherited from [[Class: I2CE_Form#processDOM() | I2CE_Form->processDOM()]]
 
===removeField()===
This public method is inherited from [[Class: I2CE_Form#removeField() | I2CE_Form->removeField()]]
 
===reset()===
This public method is inherited from [[Class: I2CE_Form#reset() | I2CE_Form->reset()]]
 
===rewind()===
This public method is inherited from [[Class: I2CE_Form#rewind() | I2CE_Form->rewind()]]
 
===search()===
This public method is inherited from [[Class: I2CE_Form#search() | I2CE_Form->search()]]
 
===setAttribute()===
This public method is inherited from [[Class: I2CE_Form#setAttribute() | I2CE_Form->setAttribute()]]
 
===setDisplayName()===
This public method is inherited from [[Class: I2CE_Form#setDisplayName() | I2CE_Form->setDisplayName()]]
 
===setForm()===
This public method is inherited from [[Class: I2CE_Form#setForm() | I2CE_Form->setForm()]]
 
===setFromPost()===
This public method is inherited from [[Class: I2CE_Form#setFromPost() | I2CE_Form->setFromPost()]]
 
===setId()===
This public method is inherited from [[Class: I2CE_Form#setId() | I2CE_Form->setId()]]
 
===setParent()===
This public method is inherited from [[Class: I2CE_Form#setParent() | I2CE_Form->setParent()]]
 
===valid()===
This public method is inherited from [[Class: I2CE_Form#valid() | I2CE_Form->valid()]]
 
===__isset()===
This protected method is inherited from [[Class: I2CE_Form#__isset() | I2CE_Form->__isset()]]
 
===addFormFields()===
This protected method is inherited from [[Class: I2CE_Form#addFormFields() | I2CE_Form->addFormFields()]]
 
===getFormFieldsData()===
This protected method is inherited from [[Class: I2CE_Form#getFormFieldsData() | I2CE_Form->getFormFieldsData()]]
 
===lookupArray()===
This protected method is inherited from [[Class: I2CE_Form#lookupArray() | I2CE_Form->lookupArray()]]
 
===_hasMethod()===
This public method is inherited from [[Class: I2CE_Fuzzy#_hasMethod() | I2CE_Fuzzy->_hasMethod()]]
==Inherited Variables==
===$children===
Theis public variable is inherited from [[Class: I2CE_Form#$children | I2CE_Form->$children]]
 
===$fields===
Theis protected variable is inherited from [[Class: I2CE_Form#$fields | I2CE_Form->$fields]]
 
===$parent===
Theis protected variable is inherited from [[Class: I2CE_Form#$parent | I2CE_Form->$parent]]
 
===$id===
Theis protected variable is inherited from [[Class: I2CE_Form#$id | I2CE_Form->$id]]
 
===$attributes===
Theis protected variable is inherited from [[Class: I2CE_Form#$attributes | I2CE_Form->$attributes]]
 
===$parent_forms===
Theis protected variable is inherited from [[Class: I2CE_Form#$parent_forms | I2CE_Form->$parent_forms]]
==Inherited Fuzzy Methods==
===isNumeric()===
This method is inherited from [[Class: I2CE_Form#isNumeric() | I2CE_Form->isNumeric()]]
 
===getLimitStyles()===
This method is inherited from [[Class: I2CE_Form#getLimitStyles() | I2CE_Form->getLimitStyles()]]
 
===checkLimit()===
This method is inherited from [[Class: I2CE_Form#checkLimit() | I2CE_Form->checkLimit()]]
 
===checkWhereClause()===
This method is inherited from [[Class: I2CE_Form#checkWhereClause() | I2CE_Form->checkWhereClause()]]
 
===createCheckFunction()===
This method is inherited from [[Class: I2CE_Form#createCheckFunction() | I2CE_Form->createCheckFunction()]]
 
===createCheckLimitString()===
This method is inherited from [[Class: I2CE_Form#createCheckLimitString() | I2CE_Form->createCheckLimitString()]]
 
===generateLimit()===
This method is inherited from [[Class: I2CE_Form#generateLimit() | I2CE_Form->generateLimit()]]
 
===generateWhereClause()===
This method is inherited from [[Class: I2CE_Form#generateWhereClause() | I2CE_Form->generateWhereClause()]]
 
===processLimit()===
This method is inherited from [[Class: I2CE_Form#processLimit() | I2CE_Form->processLimit()]]
 
===getDisplayedExistingLimit()===
This method is inherited from [[Class: I2CE_Form#getDisplayedExistingLimit() | I2CE_Form->getDisplayedExistingLimit()]]
 
===isComponentized()===
This method is inherited from [[Class: I2CE_Form#isComponentized() | I2CE_Form->isComponentized()]]
 
===addChild()===
This method is inherited from [[Class: I2CE_Form#addChild() | I2CE_Form->addChild()]]
 
===getChildIds()===
This method is inherited from [[Class: I2CE_Form#getChildIds() | I2CE_Form->getChildIds()]]
 
===getStorage()===
This method is inherited from [[Class: I2CE_Form#getStorage() | I2CE_Form->getStorage()]]
 
===isWritable()===
This method is inherited from [[Class: I2CE_Form#isWritable() | I2CE_Form->isWritable()]]
 
===populateChild()===
This method is inherited from [[Class: I2CE_Form#populateChild() | I2CE_Form->populateChild()]]
 
===populateChildren()===
This method is inherited from [[Class: I2CE_Form#populateChildren() | I2CE_Form->populateChildren()]]
 
===populateFirst()===
This method is inherited from [[Class: I2CE_Form#populateFirst() | I2CE_Form->populateFirst()]]
 
===populateHistory()===
This method is inherited from [[Class: I2CE_Form#populateHistory() | I2CE_Form->populateHistory()]]
 
===populateLast()===
This method is inherited from [[Class: I2CE_Form#populateLast() | I2CE_Form->populateLast()]]
 
===delete()===
This method is inherited from [[Class: I2CE_Form#delete() | I2CE_Form->delete()]]
 
===setChangeType()===
This method is inherited from [[Class: I2CE_Form#setChangeType() | I2CE_Form->setChangeType()]]
 
===userMessage()===
This method is inherited from [[Class: I2CE_Fuzzy#userMessage() | I2CE_Fuzzy->userMessage()]]




[[Category:Class Documentation]]
[[Category:Class Documentation]]

Revision as of 11:37, 19 October 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

  • Type: protected $db

$user_fields

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

  • Type: protected array $user_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

  • Type: protected $user_form_fields

$user

The I2CE_User which makes up this form protected I2CE_User $user

  • Type: protected $user

$userDB

The user database protected string $userDB

  • Type: protected $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.

  • Signature: public function __construct($form,$id)
  • Parameters:
    • $form
      • Default Value: 'user'
    • integer $id
      The id of the user in the database.
      • Default Value: '0'

__get()

  • Signature: public function __get($key)
  • Parameters:
    • $key

__set()

Set the member variable in the array.

  • Signature: protected function __set($key,$value)
  • Parameters:

__unset()

Unset a member variable.

  • Signature: protected function __unset($key)
  • Parameters:

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.

  • Signature: public function changePassword($post)
  • Parameters:
  • Returns: string
    The message to display back to the user signifying success or failure. @global array

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.

  • Signature: public function clearFields($fields,$keep)
  • Parameters:
    • array $fields
      The fields being worked with.
    • boolean $keep
      A flag to determine if the given fields should be removed or all except the given fields.
      • Default Value: true

displayName()

  • Signature: public function displayName()
  • Returns: string
    The first initial and last name of this user.

getRoleNameFromShortName()

Get the display name associated to a role's shortname

  • Signature: static public function getRoleNameFromShortName($name)
  • Parameters:
    • string $name
      the shortname of the role
  • Returns: string

getTrickleUpFromShortName()

Returns the role trickle up from the shortname

  • Signature: static public function getTrickleUpFromShortName($name)
  • Parameters:
  • Returns: array
    (an empty array if there is no such tag name)

load()

Load the member variables from an array

  • 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.

  • Signature: public function populate($update_log)
  • Parameters:
    • boolean $update_log @global array
      • Default Value: true

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

  • Signature: public function save()

tryGeneratePassword()

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

  • Signature: public function tryGeneratePassword()

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

  • Signature: public function validate()