CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
FieldEditingUI Class Reference

## Public Member Functions
| __construct ($EditFormName, $SchemaId=MetadataSchema::SCHEMAID_DEFAULT)
| Create a UI for specifing edits to metadata fields. More...
| AddField ($FieldNameOrId, $CurrentValue=NULL, $CurrentOperator=NULL, $AllowRemoval=FALSE)
| Add a field to the list of editable fields. More...
| AddSelectableField ($FieldTypesOrIds=NULL, $CurrentFieldId=NULL, $CurrentValue=NULL, $CurrentOperator=NULL, $AllowRemoval=TRUE)
| Add a selectable field to the list of editable fields. More...
| AddFieldButton ($Label="Add field", $FieldTypesOrIds=NULL)
| Add a button to create more fields above the button. More...
| DisplayAsTable ($TableId=NULL, $TableStyle=NULL)
| Display editing form elements enclosed in a. More...
| DisplayAsRows ()
| Display the table rows for the editing form, without the surrounding. More...
| GetValuesFromFormData ()
| Extract values from a dynamics field edit/modification form. More...
| LoadConfiguration ($Data)
| Load a configured set of fields. More...

## Static Public Member Functions
static | ApplyChangesToResource ($Resource, $User, $ChangesToApply)
| Apply the changes extracted from an editing form to a specified resource. More...

## Public Attributes
const | OP_NOP = 0
const | OP_SET = 1
const | OP_CLEAR = 2
const | OP_CLEARALL = 3
const | OP_APPEND = 4
const | OP_PREPEND = 5
const | OP_REPLACE = 6
const | OP_FIND_REPLACE = 7

## Detailed Description

Definition at line 10 of file FieldEditingUI.php.

## Constructor & Destructor Documentation

FieldEditingUI::__construct | ( |  | $EditFormName,
|  |  | $SchemaId = `MetadataSchema::SCHEMAID_DEFAULT`
| ) |  |

Create a UI for specifing edits to metadata fields.

Parameters

  string | $EditFormName | Name to use for the HTML elements. The form cannot contain any input elements whose names are EditFormName.
  int | $SchemaId | Schema Id (OPTIONAL, default Resource schema).

Definition at line 29 of file FieldEditingUI.php.

References MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, and MetadataSchema\MDFTYPE_URL.

## Member Function Documentation

FieldEditingUI::AddField | ( |  | $FieldNameOrId,
|  |  | $CurrentValue = `NULL`,
|  |  | $CurrentOperator = `NULL`,
|  |  | $AllowRemoval = `FALSE`
| ) |  |

Add a field to the list of editable fields.

Parameters

  int | string | $FieldNameOrId | Field name or id
  string | $CurrentValue | Initial value to display
  mixed | $CurrentOperator | Initial operator (one of the OP_XX class constants)
  bool | $AllowRemoval | TRUE if this field should be removable (OPTIONAL, default FALSE)

Definition at line 60 of file FieldEditingUI.php.

Referenced by LoadConfiguration().

Here is the caller graph for this function:

FieldEditingUI::AddFieldButton | ( |  | $Label = `"Add field"`,
|  |  | $FieldTypesOrIds = `NULL`
| ) |  |

Add a button to create more fields above the button.

Parameters

  string | $Label | Label to display on the button (OPTIONAL, default "Add field")
  mixed | $FieldTypesOrIds | Either an array of FieldIds, or a bitmask of MDFTYPE_ constants specifying allowed fields (OPTIONAL, defaults to all fields in the schema supported by the editing UI)

Definition at line 123 of file FieldEditingUI.php.

FieldEditingUI::AddSelectableField | ( |  | $FieldTypesOrIds = `NULL`,
|  |  | $CurrentFieldId = `NULL`,
|  |  | $CurrentValue = `NULL`,
|  |  | $CurrentOperator = `NULL`,
|  |  | $AllowRemoval = `TRUE`
| ) |  |

Add a selectable field to the list of editable fields.

Parameters

  array | $FieldTypesOrIds | Either an array of FieldIds, or a bitmask of MDFTYPE_ constants specifying allowed fields (OPTIONAL, defaults to all fields in the schema supported by the editing UI)
  int | null | $CurrentFieldId | FieldId giving the field selected by default (OPTIONAL, default NULL)
  string | $CurrentValue | Initial value to display
  mixed | $CurrentOperator | Initial operator to display (one of the OP_XX class constants)
  bool | $AllowRemoval | TRUE if this field should be removable (OPTIONAL, default TRUE)

Definition at line 94 of file FieldEditingUI.php.

static FieldEditingUI::ApplyChangesToResource | ( |  | $Resource,
|  |  | $User,
|  |  | $ChangesToApply
| ) |  |
| static

Apply the changes extracted from an editing form to a specified resource.

Parameters

  Resource | $Resource | Resource to modify.
  CWUser | $User | User for permissions checks, or NULL when checks should be skipped.
  array | $ChangesToApply | Changes in the format from GetValuesFromFormData().

Returns
  TRUE when resource was changed, FALSE otherwise.

Definition at line 590 of file FieldEditingUI.php.

References MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_URL, and MetadataField\UPDATEMETHOD_ONRECORDCHANGE.

FieldEditingUI::DisplayAsRows | ( |  | ) |

Display the table rows for the editing form, without the surrounding.

.

Definition at line 159 of file FieldEditingUI.php.

References MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, and MetadataSchema\MDFTYPE_URL.

Referenced by DisplayAsTable().

Here is the caller graph for this function:

FieldEditingUI::DisplayAsTable | ( |  | $TableId = `NULL`,
|  |  | $TableStyle = `NULL`
| ) |  |

Display editing form elements enclosed in a.

Note that it still must be wrapped in a <form> that has a submit button.

Parameters

  string | $TableId | HTML identifier to use (OPTIONAL, default NULL)
  string | $TableStyle | CSS class to attach for this table (OPTIONAL, default NULL)

Definition at line 147 of file FieldEditingUI.php.

References DisplayAsRows().

FieldEditingUI::GetValuesFromFormData | ( |  | ) |

Extract values from a dynamics field edit/modification form.

Returns
  array of arrays like array("FieldId" => $FieldId, "Op" => $Operator, "Val" => $Value,) ...) extracted from the $_POST data for $EditFormName.

Definition at line 477 of file FieldEditingUI.php.

References MetadataSchema\MDFTYPE_CONTROLLEDNAME, MetadataSchema\MDFTYPE_DATE, MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_PARAGRAPH, MetadataSchema\MDFTYPE_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, and MetadataSchema\MDFTYPE_URL.

FieldEditingUI::LoadConfiguration | ( |  | $Data | ) |

Load a configured set of fields.

Parameters

  array | $Data | Fields to load in the format from GetValuesFromFormData()

See also
  GetValuesFromFormData()

Definition at line 567 of file FieldEditingUI.php.

References AddField().

## Member Data Documentation

const FieldEditingUI::OP_APPEND = 4

Definition at line 17 of file FieldEditingUI.php.

const FieldEditingUI::OP_CLEAR = 2

Definition at line 15 of file FieldEditingUI.php.

const FieldEditingUI::OP_CLEARALL = 3

Definition at line 16 of file FieldEditingUI.php.

const FieldEditingUI::OP_FIND_REPLACE = 7

Definition at line 20 of file FieldEditingUI.php.

const FieldEditingUI::OP_NOP = 0

Definition at line 13 of file FieldEditingUI.php.

const FieldEditingUI::OP_PREPEND = 5

Definition at line 18 of file FieldEditingUI.php.

const FieldEditingUI::OP_REPLACE = 6

Definition at line 19 of file FieldEditingUI.php.

const FieldEditingUI::OP_SET = 1

Definition at line 14 of file FieldEditingUI.php.

The documentation for this class was generated from the following file:

- interface/default/objects/FieldEditingUI.php