CWIS Developer Documentation
|
Base class (covering non-presentation elements) supplying a standard user interface for presenting and working with HTML forms. More...
Public Member Functions | |
__construct ($FieldParams, $FieldValues=array(), $UniqueKey=NULL) | |
Class constructor. More... | |
DisplayFormTable ($TableId=NULL, $TableStyle=NULL) | |
Display HTML table with settings parameters. More... | |
ValidateFieldInput () | |
Validate field values on submitted form. More... | |
AddValidationParameters () | |
Add values to be passed to input validation functions, in addition to field name and value. More... | |
GetNewValuesFromForm () | |
Retrieve values set by form. More... | |
GetFieldValue ($FieldName) | |
Get value for form field. More... | |
HandleUploads () | |
Handle image and file uploads. More... | |
HandleDeletes () | |
Handle image and file deletions. More... | |
SetEventToSignalOnChange ($EventName, $EventParams=array()) | |
Set event to signal when retrieving values from form when settings have changed. More... | |
ValidateEmail ($FieldName, $FieldValues) | |
Validate value as valid-appearing email address. More... | |
ValidateUrl ($FieldName, $FieldValues) | |
Validate value as valid-appearing URL. More... | |
ValidateHostName ($FieldName, $FieldValues) | |
Validate value as valid host name (i.e. More... | |
Static Public Member Functions | |
static | LogError ($Msg, $Field=NULL) |
Log error message for later display. More... | |
static | GetLoggedErrors () |
Get logged errors. More... | |
static | ErrorsLogged ($Field=FALSE) |
Report whether errors have been logged. More... | |
static | ClearLoggedErrors ($Field=FALSE) |
Clear logged errors. More... | |
static | DidValueChange ($OldValue, $NewValue) |
Determine if a new form field value is different from an old one. More... | |
static | LoadValue ($Type, $Data) |
Load value of requested type from supplied data. More... | |
Public Attributes | |
const | FTYPE_FILE = "File" |
Supported field types. More... | |
const | FTYPE_FLAG = "Flag" |
const | FTYPE_IMAGE = "Image" |
const | FTYPE_METADATAFIELD = "MetadataField" |
const | FTYPE_NUMBER = "Number" |
const | FTYPE_OPTION = "Option" |
const | FTYPE_PARAGRAPH = "Paragraph" |
const | FTYPE_PASSWORD = "Password" |
const | FTYPE_PRIVILEGES = "Privileges" |
const | FTYPE_SEARCHPARAMS = "Search Parameters" |
const | FTYPE_TEXT = "Text" |
const | FTYPE_URL = "URL" |
const | FTYPE_USER = "User" |
const | FTYPE_HEADING = "Heading" |
Supported field pseudo-types. More... | |
const | NO_VALUE_FOR_FIELD = "NO VALUE" |
Marker used to indicate currently no value for field. More... | |
Protected Member Functions | |
DisplayFormField ($Name, $Value, $Params) | |
Display HTML form field for specified field. More... | |
GetFormFieldName ($FieldName, $IncludePrefix=TRUE) | |
Get HTML form field name for specified field. More... | |
GetHiddenFieldsHtml () | |
Get HTML for hidden form fields associated with form processing. More... | |
Protected Attributes | |
$DeletedFiles = array() | |
$DeletedImages = array() | |
$ExtraValidationParams = array() | |
$ExtraValues = array() | |
$FieldParams | |
$FieldValues | |
$HiddenFields = array() | |
$SettingChangeEventName = NULL | |
$SettingChangeEventParams = array() | |
Static Protected Attributes | |
static | $ErrorMessages = array() |
Base class (covering non-presentation elements) supplying a standard user interface for presenting and working with HTML forms.
Definition at line 14 of file FormUI_Base.php.
FormUI_Base::__construct | ( | $FieldParams, | |
$FieldValues = array() , |
|||
$UniqueKey = NULL |
|||
) |
Class constructor.
array | $FieldParams | Associative array of associative arrays of form field parameters, with field names for the top index. |
array | $FieldValues | Associative array of current values for form fields, with field names for the index. (OPTIONAL, as values may also be supplied via $FieldParams.) |
string | $UniqueKey | Unique string to include in form field names to distinguish them from other fields in the form. (OPTIONAL) |
Definition at line 45 of file FormUI_Base.php.
References $FieldParams, $FieldValues, and DisplayFormTable().
FormUI_Base::AddValidationParameters | ( | ) |
Add values to be passed to input validation functions, in addition to field name and value.
Definition at line 310 of file FormUI_Base.php.
|
static |
Clear logged errors.
string | $Field | Clear only errors for specified field. (OPTIONAL) |
Definition at line 153 of file FormUI_Base.php.
|
static |
Determine if a new form field value is different from an old one.
mixed | $OldValue | Old field value. |
mixed | $NewValue | New field value. |
Definition at line 760 of file FormUI_Base.php.
|
abstractprotected |
Display HTML form field for specified field.
string | $Name | Field name. |
mixed | $Value | Current value for field. |
array | $Params | Field parameters. |
|
abstract |
Display HTML table with settings parameters.
string | $TableId | CSS ID for table element. (OPTIONAL) |
string | $TableStyle | CSS styles for table element. (OPTIONAL) |
Referenced by __construct().
|
static |
Report whether errors have been logged.
string | $Field | Field to check – specify NULL to check for any errors with no field associated. (OPTIONAL) |
Definition at line 137 of file FormUI_Base.php.
FormUI_Base::GetFieldValue | ( | $FieldName | ) |
Get value for form field.
string | $FieldName | Canonical field name. |
Definition at line 487 of file FormUI_Base.php.
References GetFormFieldName().
Referenced by FormUI\DisplayFormTable(), and FormUI\HandleDeletes().
|
protected |
Get HTML form field name for specified field.
string | $FieldName | Field name. |
bool | $IncludePrefix | If TRUE, "F_" prefix is included. (OPTIONAL, defaults to TRUE.) |
Definition at line 1004 of file FormUI_Base.php.
Referenced by FormUI\DisplayFileField(), FormUI\DisplayFormField(), FormUI\DisplayFormTable(), FormUI\DisplayImageField(), GetFieldValue(), GetNewValuesFromForm(), FormUI\HandleDeletes(), HandleDeletes(), HandleUploads(), and FormUI\PrintFieldHidingJavascript().
|
protected |
Get HTML for hidden form fields associated with form processing.
Definition at line 1014 of file FormUI_Base.php.
Referenced by FormUI\DisplayFormTable().
|
static |
Get logged errors.
Definition at line 126 of file FormUI_Base.php.
FormUI_Base::GetNewValuesFromForm | ( | ) |
Retrieve values set by form.
Definition at line 320 of file FormUI_Base.php.
References $SettingChangeEventParams, and GetFormFieldName().
Referenced by ConfigSettingsUI\GetNewSettingsFromForm(), and ValidateFieldInput().
FormUI_Base::HandleDeletes | ( | ) |
Handle image and file deletions.
Definition at line 698 of file FormUI_Base.php.
References GetFormFieldName().
FormUI_Base::HandleUploads | ( | ) |
Handle image and file uploads.
Definition at line 587 of file FormUI_Base.php.
References $FieldParams, AI_OKAY, AI_UNKNOWNTYPE, AI_UNSUPPORTEDFORMAT, File\Create(), File\FILESTAT_ZEROLENGTH, GetFormFieldName(), and LogError().
|
static |
Load value of requested type from supplied data.
string | $Type | Type of value (FTYPE_*). |
mixed | $Data | Data to use in loading value. |
Definition at line 862 of file FormUI_Base.php.
|
static |
Log error message for later display.
string | $Msg | Error message. |
string | $Field | Field associated with error. (OPTIONAL, defaults to no field association) |
Definition at line 115 of file FormUI_Base.php.
Referenced by HandleUploads().
FormUI_Base::SetEventToSignalOnChange | ( | $EventName, | |
$EventParams = array() |
|||
) |
Set event to signal when retrieving values from form when settings have changed.
If the supplied event parameters include parameter names (indexes) of "SettingName", "OldValue", or "NewValue", the parameter value will be replaced with an appropriate value before the event is signaled.
string | $EventName | Name of event to signal. |
array | $EventParams | Array of event parameters, with CamelCase parameter names for index. (OPTIONAL) |
Definition at line 748 of file FormUI_Base.php.
FormUI_Base::ValidateEmail | ( | $FieldName, | |
$FieldValues | |||
) |
Validate value as valid-appearing email address.
This is intended to be used with the "ValidateFunction" capability, like this:
(The "FormUI" part will be replaced by the appropropriate FormUI object before the method is called.)
string | $FieldName | Name of form field. |
array | $FieldValues | Form values being validated. |
Definition at line 901 of file FormUI_Base.php.
References $FieldValues.
FormUI_Base::ValidateFieldInput | ( | ) |
Validate field values on submitted form.
Validation functions (specified via the "ValidateFunction" parameter) should take a field name and value as parameters, and return NULL if the field validates successfully, or an error message if it does not.
Definition at line 172 of file FormUI_Base.php.
References GetNewValuesFromForm().
FormUI_Base::ValidateHostName | ( | $FieldName, | |
$FieldValues | |||
) |
Validate value as valid host name (i.e.
one that can be resolved to an IP address via DNS). This is intended to be used with the "ValidateFunction" capability, like this:
(The "FormUI" part will be replaced by the appropropriate FormUI object before the method is called.)
string | $FieldName | Name of form field. |
array | $FieldValues | Form values being validated. |
Definition at line 956 of file FormUI_Base.php.
References $FieldValues.
FormUI_Base::ValidateUrl | ( | $FieldName, | |
$FieldValues | |||
) |
Validate value as valid-appearing URL.
This is intended to be used with the "ValidateFunction" capability, like this:
(The "FormUI" part will be replaced by the appropropriate FormUI object before the method is called.)
string | $FieldName | Name of form field. |
array | $FieldValues | Form values being validated. |
Definition at line 928 of file FormUI_Base.php.
References $FieldValues.
|
protected |
Definition at line 974 of file FormUI_Base.php.
Referenced by FormUI\DisplayFileField().
|
protected |
Definition at line 975 of file FormUI_Base.php.
Referenced by FormUI\DisplayImageField().
|
staticprotected |
Definition at line 984 of file FormUI_Base.php.
|
protected |
Definition at line 976 of file FormUI_Base.php.
|
protected |
Definition at line 977 of file FormUI_Base.php.
|
protected |
Definition at line 978 of file FormUI_Base.php.
Referenced by __construct(), and HandleUploads().
|
protected |
Definition at line 979 of file FormUI_Base.php.
Referenced by __construct(), ValidateEmail(), ValidateHostName(), and ValidateUrl().
|
protected |
Definition at line 980 of file FormUI_Base.php.
|
protected |
Definition at line 981 of file FormUI_Base.php.
|
protected |
Definition at line 982 of file FormUI_Base.php.
Referenced by GetNewValuesFromForm().
const FormUI_Base::FTYPE_FILE = "File" |
Supported field types.
Definition at line 19 of file FormUI_Base.php.
const FormUI_Base::FTYPE_FLAG = "Flag" |
Definition at line 20 of file FormUI_Base.php.
const FormUI_Base::FTYPE_HEADING = "Heading" |
Supported field pseudo-types.
Definition at line 33 of file FormUI_Base.php.
Referenced by UserEditingUI\GetRequestAccountForm().
const FormUI_Base::FTYPE_IMAGE = "Image" |
Definition at line 21 of file FormUI_Base.php.
const FormUI_Base::FTYPE_METADATAFIELD = "MetadataField" |
Definition at line 22 of file FormUI_Base.php.
const FormUI_Base::FTYPE_NUMBER = "Number" |
Definition at line 23 of file FormUI_Base.php.
const FormUI_Base::FTYPE_OPTION = "Option" |
Definition at line 24 of file FormUI_Base.php.
Referenced by UserEditingUI\GetRequestAccountForm().
const FormUI_Base::FTYPE_PARAGRAPH = "Paragraph" |
Definition at line 25 of file FormUI_Base.php.
const FormUI_Base::FTYPE_PASSWORD = "Password" |
Definition at line 26 of file FormUI_Base.php.
Referenced by UserEditingUI\GetRequestAccountForm().
const FormUI_Base::FTYPE_PRIVILEGES = "Privileges" |
Definition at line 27 of file FormUI_Base.php.
const FormUI_Base::FTYPE_SEARCHPARAMS = "Search Parameters" |
Definition at line 28 of file FormUI_Base.php.
const FormUI_Base::FTYPE_TEXT = "Text" |
Definition at line 29 of file FormUI_Base.php.
Referenced by UserEditingUI\GetRequestAccountForm().
const FormUI_Base::FTYPE_URL = "URL" |
Definition at line 30 of file FormUI_Base.php.
const FormUI_Base::FTYPE_USER = "User" |
Definition at line 31 of file FormUI_Base.php.
Referenced by UserEditingUI\GetRequestAccountForm().
const FormUI_Base::NO_VALUE_FOR_FIELD = "NO VALUE" |
Marker used to indicate currently no value for field.
Definition at line 987 of file FormUI_Base.php.