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 | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
MetadataFieldOrder Class Reference

Class to build metadata field ordering functionality on top of the foldering functionality. More...

Inheritance diagram for MetadataFieldOrder:
[legend]
Collaboration diagram for MetadataFieldOrder:
[legend]

## Public Member Functions
| GetItems ()
| Transform the item IDs of the metadata field order object into objects.
| CreateGroup ($Name)
| Create a new metadata field group with the given name.
| DeleteGroup (MetadataFieldGroup $Group)
| Move the metadata fields out of the given metadata group to the metadata field order and then delete it.
| GetFields ()
| Get all the fields in this metadata field ordering in order.
| GetGroups ()
| Get all the groups in this metadata field ordering in order.
| MoveItemUp ($Item, $Filter=NULL)
| Move the given item up in the order.
| MoveItemDown ($Item, $Filter=NULL)
| Move the given item down in the order.
| MoveItemToTop ($Item)
| Move the given item to the top of the order.
| MoveFieldToTopOfGroup (MetadataFieldGroup $Group, MetadataField $Field)
| Move the given item to the top of the order.
| MoveItemAfter ($Target, $Item)
| Move the given item after the given target item.
| ItemInOrder ($Item)
| Determine whether the given item is a member of this order.
Public Member Functions inherited from Folder
| Folder ($FolderId)
| Object constructor – load an existing folder.
| Delete ()
| Delete folder.
| Id ()
| Get folder ID.
| Name ($NewValue=DB_NOVALUE)
| Get/set folder name.
| NormalizedName ($NewValue=DB_NOVALUE)
| Get/set normalized version of folder name.
| IsShared ($NewValue=DB_NOVALUE)
| Get/set whether folder is publically-viewable.
| OwnerId ($NewValue=DB_NOVALUE)
| Get/set user ID of folder owner.
| Note ($NewValue=DB_NOVALUE)
| Get/set note text for folder.
| InsertItemBefore ($TargetItemOrItemId, $NewItemOrItemId, $TargetItemType=NULL, $NewItemType=NULL)
| Insert item into folder before specified item.
| InsertItemAfter ($TargetItemOrItemId, $NewItemOrItemId, $TargetItemType=NULL, $NewItemType=NULL)
| Insert item into folder after specified item.
| PrependItem ($ItemOrItemId, $ItemType=NULL)
| Add item to folder as the first item.
| AppendItem ($ItemOrItemId, $ItemType=NULL)
| Add item to folder as the last item.
| GetItemIds ()
| Retrieve array of IDs of items in folder, in the order that they appear in the folder.
| RemoveItem ($ItemId, $ItemType=NULL)
| Remove item from folder, if present.
| NoteForItem ($ItemId, $NewValue=DB_NOVALUE, $ItemType=NULL)
| Get/set note text for specific item within folder.
| ContainsItem ($ItemId, $ItemType=NULL)
| Check whether specified item is contained in folder.

## Static Public Member Functions
static | SetConfiguration (SystemConfiguration $SysConfig)
| Extract the metadata field display and edit folder IDs from the given system configuration.
static | GetDisplayOrderObject ()
| Get the metadata field display order object.
static | GetEditOrderObject ()
| Get the metadata field edit order object.
static | MendIssues ()
| Fix any issues found in case an unfound bug causes something to go awry.
Static Public Member Functions inherited from Folder
static | NormalizeFolderName ($Name)
| Convert folder name to normalized form (lower-case alphanumeric only).

## Public Attributes
const | DISPLAY_FOLDER_NAME = "FieldDisplayFolder"
| string DISPLAY_FOLDER_NAME name given to the root display folder
const | EDIT_FOLDER_NAME = "FieldEditFolder"
| string EDIT_FOLDER_NAME name given to the root edit folder
Public Attributes inherited from Folder
const | MIXEDCONTENT = -1

## Protected Member Functions
| IsFieldOrGroup ($Item)
| Determine if the given item is a metadata field or metadata field group.
| GetItemId ($Item)
| Get the ID of the given item.
| GetItemType ($Item)
| Get the type of the given item.
| GroupFilterCallback ($Item)
| Callback for the filter to retrieve groups only from the metadata field order.
| GetEnclosure ($Item)
| Get the metadata field order or metadata field group that encloses the given item.
| GetSiblingItem ($Item, $Offset, $Filter=NULL)
| Get the item object of the item that is the given distance from the item.
| FindSiblingItem ($Enclosure, $Item, $Offset, $Filter=NULL)
| Attempt to find the item that is the given distance from the item within the given enclosure.
| MoveFieldToGroup (MetadataFieldGroup $Group, MetadataField $Field, $Placement)
| Move the field with the given ID to the group with the given ID, optionally specifying the place where the should be placed.
| MoveFieldToOrder (MetadataFieldGroup $Group, MetadataField $Field, $Placement)
| Move the field with the given ID from the group with the given ID to the order, optionally specifying where the field should be placed.
| MoveFieldsToOrder (MetadataFieldGroup $Group)
| Move all the metadata fields out of the given metadata field group and into the main order.

## Static Protected Member Functions
static | CheckOrderingConfiguration ()
| Check the ordering configuration, throwing an exception if it's invalid or not set.
static | CreateOrderingObject ($NewFolderName, $Type)
| Create an ordering object and its folder with the given folder name.
static | GetRowsForUpgrade ($Type)
| Get rows for upgrading purposes.

## Static Protected Attributes
static | $DisplayFolderId
static | $EditFolderId
static | $DefaultDisplayOrder
static | $DefaultEditOrder

## Detailed Description

Class to build metadata field ordering functionality on top of the foldering functionality.

Definition at line 7 of file MetadataFieldOrder.php.

## Member Function Documentation

static MetadataFieldOrder::CheckOrderingConfiguration | ( |  | ) |
| static protected

Check the ordering configuration, throwing an exception if it's invalid or not set.

Returns
  void

Exceptions

  Exception | if the ordering configuration is invalid or not set

Definition at line 781 of file MetadataFieldOrder.php.

MetadataFieldOrder::CreateGroup | ( |  | $Name | ) |

Create a new metadata field group with the given name.

Parameters

  string | $Name | group name

Returns
  MetadataFieldGroup new metadata field group

Definition at line 42 of file MetadataFieldOrder.php.

References Folder\AppendItem().

static MetadataFieldOrder::CreateOrderingObject | ( |  | $NewFolderName,
|  |  | $Type
| ) |  |
| static protected

Create an ordering object and its folder with the given folder name.

Parameters

  string | $NewFolderName | name to use when creating a folder
  int | $Type | ordering type from MetadataSchema::MDFORDER_...

Returns
  MetadataFieldOrdering field ordering object

Definition at line 795 of file MetadataFieldOrder.php.

References MetadataSchema\MDFORDER_DISPLAY.

MetadataFieldOrder::DeleteGroup | ( | MetadataFieldGroup | $Group | ) |

Move the metadata fields out of the given metadata group to the metadata field order and then delete it.

Parameters

  MetadataFieldGroup | $Group | metadata field group

Returns
  void

Definition at line 62 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), Folder\Id(), MoveFieldsToOrder(), and Folder\RemoveItem().

MetadataFieldOrder::FindSiblingItem | ( |  | $Enclosure,
|  |  | $Item,
|  |  | $Offset,
|  |  | $Filter = `NULL`
| ) |  |
| protected

Attempt to find the item that is the given distance from the item within the given enclosure.

Parameters

  MetadataFieldGroup | MetadataFieldOrder | $Enclosure | item enclosure
  MetadataField | MetadataFieldGroup | $Item | item
  int | $Offset | distance from the item, negative values are allowed
  callback | $Filter | callback to filter out items

Returns
  array item info, i.e., item ID and type, or NULL if not found

Definition at line 656 of file MetadataFieldOrder.php.

References GetItemId(), and GetItemType().

Referenced by GetSiblingItem().

Here is the caller graph for this function:

static MetadataFieldOrder::GetDisplayOrderObject | ( |  | ) |
| static

Get the metadata field display order object.

Returns
  MetadataFieldOrder metadata field display order object

Exceptions

  Exception | if the ordering configuration is invalid or not set

Definition at line 473 of file MetadataFieldOrder.php.

Referenced by MetadataField\Drop(), MetadataField\IsTempItem(), and MetadataSchema\UpdateFieldCompareOrders().

Here is the caller graph for this function:

static MetadataFieldOrder::GetEditOrderObject | ( |  | ) |
| static

Get the metadata field edit order object.

Returns
  MetadataFieldOrder metadata field edit order object

Exceptions

  Exception | if the ordering configuration is invalid or not set

Definition at line 485 of file MetadataFieldOrder.php.

Referenced by MetadataField\Drop(), MetadataField\IsTempItem(), and MetadataSchema\UpdateFieldCompareOrders().

Here is the caller graph for this function:

MetadataFieldOrder::GetEnclosure | ( |  | $Item | ) |
| protected

Get the metadata field order or metadata field group that encloses the given item.

Parameters

  MetadataField | MetadataFieldGroup | $Item | item

Returns
  MetadataFieldGroup|MetadataFieldOrder|null the metadata field order or metadata field group that encloses the item, or NULL otherwise

Definition at line 578 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), GetGroups(), GetItemId(), and GetItemType().

Referenced by MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::GetFields | ( |  | ) |

Get all the fields in this metadata field ordering in order.

Returns
  array array of MetadataField objects

Definition at line 75 of file MetadataFieldOrder.php.

References GetItems().

MetadataFieldOrder::GetGroups | ( |  | ) |

Get all the groups in this metadata field ordering in order.

Returns
  array array of MetadataFieldGroup objects

Definition at line 104 of file MetadataFieldOrder.php.

References Folder\GetItemIds().

Referenced by GetEnclosure(), GetSiblingItem(), and ItemInOrder().

Here is the caller graph for this function:

MetadataFieldOrder::GetItemId | ( |  | $Item | ) |
| protected

Get the ID of the given item.

Parameters

  MetadataField | MetadataFieldGroup | MetadataFieldOrder | $Item | item

Returns
  int|null the ID of the item or NULL if the item is invalid

Definition at line 545 of file MetadataFieldOrder.php.

Referenced by FindSiblingItem(), GetEnclosure(), GetSiblingItem(), ItemInOrder(), MoveFieldToGroup(), MoveFieldToOrder(), MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::GetItems | ( |  | ) |

Transform the item IDs of the metadata field order object into objects.

Returns
  array an array of metadata field order object items

Definition at line 24 of file MetadataFieldOrder.php.

References $Items, and Folder\GetItemIds().

Referenced by GetFields().

Here is the caller graph for this function:

MetadataFieldOrder::GetItemType | ( |  | $Item | ) |
| protected

Get the type of the given item.

Parameters

  MetadataField | MetadataFieldGroup | MetadataFieldOrder | $Item | item

Returns
  string|null the type of the item or NULL if the item is invalid

Definition at line 555 of file MetadataFieldOrder.php.

Referenced by FindSiblingItem(), GetEnclosure(), GetSiblingItem(), ItemInOrder(), MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().

Here is the caller graph for this function:

static MetadataFieldOrder::GetRowsForUpgrade | ( |  | $Type | ) |
| static protected

Get rows for upgrading purposes.

This should only be run if an upgrade should be performed.

Parameters

  int | $Type | ordering type from MetadataSchema::MDFORDER_...

Returns
  array rows of field IDs in the correct order for the type

See Also
  MetadataFieldOrdering::ShouldPerformOrderingUpgrade()

Definition at line 840 of file MetadataFieldOrder.php.

References Database\DisplayQueryErrors(), and MetadataSchema\MDFORDER_EDITING.

MetadataFieldOrder::GetSiblingItem | ( |  | $Item,
|  |  | $Offset,
|  |  | $Filter = `NULL`
| ) |  |
| protected

Get the item object of the item that is the given distance from the item.

Parameters

  MetadataField | MetadataFieldGroup | $Item | item
  int | $Offset | distance from the item, negative values are allowed
  callback | $Filter | callback to filter out items

Returns
  array item info, i.e., item ID and type, or NULL if not found

Definition at line 609 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), FindSiblingItem(), GetGroups(), GetItemId(), and GetItemType().

Referenced by MoveItemDown(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::GroupFilterCallback | ( |  | $Item | ) |
| protected

Callback for the filter to retrieve groups only from the metadata field order.

Parameters

  array | $Item | array of item info, i.e., item ID and type

Returns
  bool TRUE if the item is a group or FALSE otherwise

Definition at line 566 of file MetadataFieldOrder.php.

MetadataFieldOrder::IsFieldOrGroup | ( |  | $Item | ) |
| protected

Determine if the given item is a metadata field or metadata field group.

Parameters

  mixed | $Item | item

Returns
  TRUE if the item is a metadata field or group, FALSE otherwise

Definition at line 525 of file MetadataFieldOrder.php.

Referenced by ItemInOrder(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::ItemInOrder | ( |  | $Item | ) |

Determine whether the given item is a member of this order.

Parameters

  MetadataField | MetadataFieldGroup | $Item | item

Returns
  bool TRUE if the item belongs to the order or FALSE otherwise

Definition at line 401 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), GetGroups(), GetItemId(), GetItemType(), and IsFieldOrGroup().

Referenced by MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().

Here is the caller graph for this function:

static MetadataFieldOrder::MendIssues | ( |  | ) |
| static

Fix any issues found in case an unfound bug causes something to go awry.

Returns
  void

Definition at line 496 of file MetadataFieldOrder.php.

MetadataFieldOrder::MoveFieldsToOrder | ( | MetadataFieldGroup | $Group | ) |
| protected

Move all the metadata fields out of the given metadata field group and into the main order.

Parameters

  MetadataFieldGroup | $Group | metadata field group

Returns
  void

Definition at line 753 of file MetadataFieldOrder.php.

References Folder\GetItemIds(), Folder\Id(), and Folder\InsertItemAfter().

Referenced by DeleteGroup().

Here is the caller graph for this function:

MetadataFieldOrder::MoveFieldToGroup | ( | MetadataFieldGroup | $Group,
|  | MetadataField | $Field,
|  |  | $Placement
| ) |  |
| protected

Move the field with the given ID to the group with the given ID, optionally specifying the place where the should be placed.

Parameters

  int | $GroupId | metadata field group ID
  int | $FieldId | metadata field ID
  string | $Placement | where to place the field ("prepend" or "append")

Returns
  void

Definition at line 691 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), GetItemId(), and Folder\RemoveItem().

Referenced by MoveItemDown(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::MoveFieldToOrder | ( | MetadataFieldGroup | $Group,
|  | MetadataField | $Field,
|  |  | $Placement
| ) |  |
| protected

Move the field with the given ID from the group with the given ID to the order, optionally specifying where the field should be placed.

Parameters

  int | $GroupId | metadata field group ID
  int | $FieldId | metadata field ID
  string | $Placement | where to place the field ("before" or "after")

Returns
  void

Definition at line 721 of file MetadataFieldOrder.php.

References Folder\ContainsItem(), GetItemId(), and Folder\RemoveItem().

Referenced by MoveItemDown(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::MoveFieldToTopOfGroup | ( | MetadataFieldGroup | $Group,
|  | MetadataField | $Field
| ) |  |

Move the given item to the top of the order.

Parameters

  MetadataField | MetadataFieldGroup | $Item | the item to move

Exceptions

  Exception | if the group or field aren't in the order

Definition at line 305 of file MetadataFieldOrder.php.

References GetEnclosure(), GetItemId(), GetItemType(), ItemInOrder(), and Folder\PrependItem().

MetadataFieldOrder::MoveItemAfter | ( |  | $Target,
|  |  | $Item
| ) |  |

Move the given item after the given target item.

Parameters

  MetadataField | MetadataFieldGroup | $Target | the item to move after
  MetadataField | MetadataFieldGroup | $Item | the item to move

Returns
  void

Exceptions

  Exception | if the items aren't a metadata field or metadata group
  Exception | if the items aren't in the order
  Exception | if attempting to put a group into another one

Definition at line 345 of file MetadataFieldOrder.php.

References GetEnclosure(), GetItemId(), GetItemType(), IsFieldOrGroup(), and ItemInOrder().

Referenced by MoveItemDown(), and MoveItemUp().

Here is the caller graph for this function:

MetadataFieldOrder::MoveItemDown | ( |  | $Item,
|  |  | $Filter = `NULL`
| ) |  |

Move the given item down in the order.

Parameters

  MetadataField | MetadataFieldGroup | $Item |
  callback | $Filter | callback to filter out items before moving

Returns
  void

Exceptions

  Exception | if the item isn't a metadata field or metadata group
  Exception | if the item isn't in the order
  Exception | if a callback is given and it isn't callable

Definition at line 200 of file MetadataFieldOrder.php.

References GetEnclosure(), GetItemId(), GetItemType(), GetSiblingItem(), IsFieldOrGroup(), ItemInOrder(), MoveFieldToGroup(), MoveFieldToOrder(), and MoveItemAfter().

MetadataFieldOrder::MoveItemToTop | ( |  | $Item | ) |

Move the given item to the top of the order.

Parameters

  MetadataField | MetadataFieldGroup | $Item | the item to move

Exceptions

  Exception | if the item isn't a metadata field or metadata group
  Exception | if the item isn't in the order

Definition at line 265 of file MetadataFieldOrder.php.

References GetEnclosure(), GetItemId(), GetItemType(), IsFieldOrGroup(), ItemInOrder(), and Folder\PrependItem().

MetadataFieldOrder::MoveItemUp | ( |  | $Item,
|  |  | $Filter = `NULL`
| ) |  |

Move the given item up in the order.

Parameters

  MetadataField | MetadataFieldGroup | $Item | item
  callback | $Filter | callback to filter out items before moving

Returns
  void

Exceptions

  Exception | if the item isn't a metadata field or metadata group
  Exception | if the item isn't in the order
  Exception | if a callback is given and it isn't callable

Definition at line 132 of file MetadataFieldOrder.php.

References GetEnclosure(), GetItemId(), GetItemType(), GetSiblingItem(), IsFieldOrGroup(), ItemInOrder(), MoveFieldToGroup(), MoveFieldToOrder(), and MoveItemAfter().

static MetadataFieldOrder::SetConfiguration | ( | SystemConfiguration | $SysConfig | ) |
| static

Extract the metadata field display and edit folder IDs from the given system configuration.

Parameters

  SystemConfiguration | $SysConfig | system configuration

Returns
  void

Definition at line 437 of file MetadataFieldOrder.php.

References $DisplayFolderId, $EditFolderId, SystemConfiguration\FieldDisplayFolder(), SystemConfiguration\FieldEditFolder(), MetadataSchema\MDFORDER_DISPLAY, and MetadataSchema\MDFORDER_EDITING.

## Member Data Documentation

MetadataFieldOrder::$DefaultDisplayOrder
| static protected

Definition at line 892 of file MetadataFieldOrder.php.

MetadataFieldOrder::$DefaultEditOrder
| static protected

Definition at line 963 of file MetadataFieldOrder.php.

MetadataFieldOrder::$DisplayFolderId
| static protected

Definition at line 881 of file MetadataFieldOrder.php.

Referenced by SetConfiguration().

MetadataFieldOrder::$EditFolderId
| static protected

Definition at line 886 of file MetadataFieldOrder.php.

Referenced by SetConfiguration().

const MetadataFieldOrder::DISPLAY_FOLDER_NAME = "FieldDisplayFolder"

string DISPLAY_FOLDER_NAME name given to the root display folder

Definition at line 13 of file MetadataFieldOrder.php.

const MetadataFieldOrder::EDIT_FOLDER_NAME = "FieldEditFolder"

string EDIT_FOLDER_NAME name given to the root edit folder

Definition at line 18 of file MetadataFieldOrder.php.

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

- objects/MetadataFieldOrder.php