Class: I2CE User Form: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 31: Line 31:
==Methods==
==Methods==
===__construct()===
===__construct()===
Create a new instance of a user.
Create a new instance of a user. If the id isn't given then it will be determined from the session array.
 
If the id isn't given then it will be determined from the session array.
*Signature: public function __construct($form,$id)
*Signature: public function __construct($form,$id)
Parameters:
*Parameters:
*$form  
*$form  
**Default Value: 'user'
***Default Value: 'user'
* integer $id<br/>The id of the user in the database.
** integer $id <br/>The id of the user in the database.
**Default Value: '0'
***Default Value: '0'
===__get()===
===__get()===
*Signature: public function __get($key)
*Signature: public function __get($key)
Parameters:
*Parameters:
*$key  
*$key  
===__set()===
===__set()===
Set the member variable in the {@link $data} array.
Set the member variable in the {@link $data} array.
*Signature: protected function __set($key,$value)
*Signature: protected function __set($key,$value)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $key
** [http://www.php.net/manual/en/language.types.string.php string ] $key
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $value
===__unset()===
===__unset()===
Unset a member variable.
Unset a member variable.
*Signature: protected function __unset($key)
*Signature: protected function __unset($key)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $key
** [http://www.php.net/manual/en/language.types.string.php string ] $key
===changePassword()===
===changePassword()===
Change the password for this user.
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.
 
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)
*Signature: public function changePassword($post)
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] The message to display back to the user signifying success or failure.
*Parameters:
@global array
** [http://www.php.net/manual/en/language.types.array.php array ] &$post
Parameters:
*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
* [http://www.php.net/manual/en/language.types.array.php array ] &$post
===clearFields()===
===clearFields()===
Remove fields from the form.
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.
 
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)
*Signature: public function clearFields($fields,$keep)
Parameters:
*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.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.
** [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  
***Default Value: true  
===displayName()===
===displayName()===
*Signature: public function displayName()
*Signature: public function displayName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] 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
*Signature: static public function getRoleNameFromShortName($name)
*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 ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string ] $name<br/>the shortname of the role
===getTrickleUpFromShortName()===
===getTrickleUpFromShortName()===
Returns the role trickle up from the shortname
Returns the role trickle up from the shortname
*Signature: static public function getTrickleUpFromShortName($name)
*Signature: static public function getTrickleUpFromShortName($name)
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] (an empty array if there is no such tag name)
*Parameters:
Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $name <br/>the role shortname
* [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()===
Load the member variables from an array
Load the member variables from an array
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
*Signature: public function load($post,$loadID,$populate_on_set_id)
*Signature: public function load($post,$loadID,$populate_on_set_id)
Parameters:
*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.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
** [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
***Default Value: true
*$populate_on_set_id  
*$populate_on_set_id  
**Default Value: true
***Default Value: true
===populate()===
===populate()===
Populate the member variables of this object.
Populate the member variables of this object. This will also update the user log to show the latest activity for this login.
 
This will also update the user log to show the latest activity for this login.
@global array
*Signature: public function populate($update_log)
*Signature: public function populate($update_log)
Parameters:
*Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $update_log
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $update_log @global array
**Default Value: true  
***Default Value: true  
===save()===
===save()===
Saves the user to the database.
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
 
This method saves all the user data and updates the access the user has for this system.
@global array
*Signature: public function save()
*Signature: public function save()
===tryGeneratePassword()===
===tryGeneratePassword()===
Line 122: Line 103:
*Signature: public function tryGeneratePassword()
*Signature: public function tryGeneratePassword()
===validate()===
===validate()===
Checks to make sure all the required fields are valid.
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 the username is unique in the system and that the password matches the confirmed password.
 
@global array
*Signature: public function validate()
*Signature: public function validate()
==Inherited Variables==
==Inherited Variables==

Revision as of 22:41, 16 October 2009

This article desrcibes the class I2CE_User_Form.

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

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 y $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 {@link $data} 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()

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

populate()

This method is inherited from I2CE_Form->populate()

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

save()

This method is inherited from I2CE_Form->save()

setChangeType()

This method is inherited from I2CE_Form->setChangeType()

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()