|
|
(16 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| This article describes the class ''I2CE_User_Form''.
| | #REDIRECT [[Class: I2CE_User_Form (4.1.7)]] |
| *Extends the class: [[Class: I2CE_Form | I2CE_Form]].
| |
| *Location: Part 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==
| |
| This class is a [[Class: I2CE_Form |form class]] and provides the following [[Class: I2CE_FormField |form fields]]
| |
| ==username==
| |
| The form field ''username'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
| |
| ==password==
| |
| The form field ''password'' is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
| |
| ==confirm==
| |
| The form field ''confirm'' is implemented by [[Class: I2CE_FormField_STRING_PASS |STRING_PASS ]]
| |
| ==firstname==
| |
| The form field ''firstname'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
| |
| ==lastname==
| |
| The form field ''lastname'' is implemented by [[Class: I2CE_FormField_STRING_LINE |STRING_LINE ]]
| |
| ==email==
| |
| 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
| |
| | |
| ===$user_fields===
| |
| 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
| |
| | |
| ===$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 <br/>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:
| |
| ** [http://www.php.net/manual/en/language.types.string.php string ] $key
| |
| ** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
| |
| ===__unset()===
| |
| Unset a member variable.
| |
| *Signature: protected function __unset($key)
| |
| *Parameters:
| |
| ** [http://www.php.net/manual/en/language.types.string.php string ] $key
| |
| ===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:
| |
| ** [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
| |
| ===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:
| |
| ** [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.
| |
| ***Default Value: true
| |
| ===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.
| |
| ===getRoleNameFromShortName()===
| |
| Get the display name associated to a role's shortname
| |
| *Signature: static public function getRoleNameFromShortName($name)
| |
| *Parameters:
| |
| ** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>the shortname of the role
| |
| *Returns: [http://www.php.net/manual/en/language.types.string.php string ]
| |
| ===getTrickleUpFromShortName()===
| |
| Returns the role trickle up from the shortname
| |
| *Signature: static public function getTrickleUpFromShortName($name)
| |
| *Parameters:
| |
| ** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>the role shortname
| |
| *Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>(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:
| |
| ** [http://www.php.net/manual/en/language.types.array.php array ] $post <br/>The Post vairables. Usually from an http request.
| |
| ** [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
| |
| ***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:
| |
| ** [http://www.php.net/manual/en/language.types.boolean.php 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()
| |
| | |
| | |
| [[Category:Class Documentation]]
| |