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 | 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
| __construct ($Id)
| Load an existing metadata field order. More...
| SchemaId ()
| Get the ID of the metadata schema with which the metadata field order is associated. More...
| OrderName ()
| Get the name of the metadata field order. More...
| Delete ()
| Delete the metadata field order. More...
| MendIssues ()
| Fix any issues found in case an unfound bug causes something to go awry. More...
| GetItems ()
| Transform the item IDs of the metadata field order object into objects. More...
| CreateGroup ($Name)
| Create a new metadata field group with the given name. More...
| DeleteGroup (MetadataFieldGroup $Group)
| Move the metadata fields out of the given metadata group to the metadata field order and then delete it. More...
| GetFields ()
| Get all the fields in this metadata field ordering in order. More...
| GetGroups ()
| Get all the groups in this metadata field ordering in order. More...
| MoveItemUp ($Item, $Filter=NULL)
| Move the given item up in the order. More...
| MoveItemDown ($Item, $Filter=NULL)
| Move the given item down in the order. More...
| MoveItemToTop ($Item)
| Move the given item to the top of the order. More...
| MoveFieldToTopOfGroup (MetadataFieldGroup $Group, MetadataField $Field)
| Move the given item to the top of the order. More...
| MoveItemAfter ($Target, $Item)
| Move the given item after the given target item. More...
| ItemInOrder ($Item)
| Determine whether the given item is a member of this order. More...
Public Member Functions inherited from Folder
| __construct ($FolderId)
| Object constructor – load an existing folder. More...
| Delete ()
| Delete folder. More...
| Id ()
| Get folder ID. More...
| Name ($NewValue=DB_NOVALUE)
| Get/set folder name. More...
| NormalizedName ($NewValue=DB_NOVALUE)
| Get/set normalized version of folder name. More...
| IsShared ($NewValue=DB_NOVALUE)
| Get/set whether folder is publically-viewable. More...
| OwnerId ($NewValue=DB_NOVALUE)
| Get/set user ID of folder owner. More...
| Note ($NewValue=DB_NOVALUE)
| Get/set note text for folder. More...
| InsertItemBefore ($TargetItemOrItemId, $NewItemOrItemId, $TargetItemType=NULL, $NewItemType=NULL)
| Insert item into folder before specified item. More...
| InsertItemAfter ($TargetItemOrItemId, $NewItemOrItemId, $TargetItemType=NULL, $NewItemType=NULL)
| Insert item into folder after specified item. More...
| PrependItem ($ItemOrItemId, $ItemType=NULL)
| Add item to folder as the first item. More...
| AppendItem ($ItemOrItemId, $ItemType=NULL)
| Add item to folder as the last item. More...
| AppendItems ($ItemsOrItemIds, $ItemTypes=NULL)
| Add multiple items to the folder at the end. More...
| GetItemIds ($Offset=NULL, $Length=NULL)
| Retrieve array of IDs of items in folder, in the order that they appear in the folder. More...
| GetItemCount ()
| Get number of items in folder. More...
| RemoveItem ($ItemId, $ItemType=NULL)
| Remove item from folder, if present. More...
| NoteForItem ($ItemId, $NewValue=DB_NOVALUE, $ItemType=NULL)
| Get/set note text for specific item within folder. More...
| ContainsItem ($ItemId, $ItemType=NULL)
| Check whether specified item is contained in folder. More...

## Static Public Member Functions
static | Create (MetadataSchema $Schema, $Name, array $FieldOrder=array())
| Create a new metadata field order, optionally specifying the order of the fields. More...
static | GetOrderForSchema (MetadataSchema $Schema, $Name)
| Get a metadata field order with a specific name for a given metadata schema. More...
static | GetOrderForSchemaId ($SchemaId, $Name)
| Get a metadata field order with a specific name for a given metadata schema ID. More...
static | GetOrdersForSchema (MetadataSchema $Schema)
| Get all of the orders associated with a schema. More...
static | GetOrdersForSchemaId ($SchemaId)
| Get all of the orders associated with a schema ID. More...
Static Public Member Functions inherited from Folder
static | NormalizeFolderName ($Name)
| Convert folder name to normalized form (lower-case alphanumeric only). More...
static | GetItemTypeId ($TypeName)

## Public Attributes
const | DEFAULT_FOLDER_NAME = "FieldOrder"
| The default name given to the folders that are really metadata field orders. More...
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. More...
| GetItemId ($Item)
| Get the ID of the given item. More...
| GetItemType ($Item)
| Get the type of the given item. More...
| GroupFilterCallback ($Item)
| Callback for the filter to retrieve groups only from the metadata field order. More...
| GetEnclosure ($Item)
| Get the metadata field order or metadata field group that encloses the given item. More...
| GetSiblingItem ($Item, $Offset, $Filter=NULL)
| Get the item object of the item that is the given distance from the item. More...
| FindSiblingItem ($Enclosure, $Item, $Offset, $Filter=NULL)
| Attempt to find the item that is the given distance from the item within the given enclosure. More...
| 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. More...
| 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. More...
| MoveFieldsToOrder (MetadataFieldGroup $Group)
| Move all the metadata fields out of the given metadata field group and into the main order. More...

## Protected Attributes
| $Database
| Database object with which to query the database. More...
| $SchemaId
| The ID of the metadata schema this metadata field order is associated with. More...
| $OrderName
| The name of the metadata field order. More...

## Detailed Description

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

Definition at line 14 of file MetadataFieldOrder.php.

## Constructor & Destructor Documentation

MetadataFieldOrder::__construct | ( |  | $Id | ) |

Load an existing metadata field order.

Parameters

  int | $Id | The ID of the metadata field order to load.

Exceptions

  Exception | if the ID is invalid or the order does not exist.

Definition at line 28 of file MetadataFieldOrder.php.

References Database\FetchRow(), Database\NumRowsSelected(), OrderName(), Database\Query(), and SchemaId().

## Member Function Documentation

static MetadataFieldOrder::Create | ( | MetadataSchema | $Schema,
|  |  | $Name,
|  | array | $FieldOrder = `array()`
| ) |  |
| static

Create a new metadata field order, optionally specifying the order of the fields.

The array values for the order should be ordered field IDs. This will overwrite any existing orders associated with the schema that have the same name as the one given.

Parameters

  MetadataSchema | $Schema | Schema with which to associate the order.
  string | $Name | Name for the metadata field order.
  array | $FieldOrder | Optional ordered array of field IDs.

Returns
  Returns a new MetadataFieldOrder object.

Definition at line 547 of file MetadataFieldOrder.php.

References $Database, MetadataSchema\GetFields(), and MetadataSchema\Id().

Referenced by MetadataSchema\Create().

Here is the caller graph for this function:

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 142 of file MetadataFieldOrder.php.

References Folder\AppendItem().

MetadataFieldOrder::Delete | ( |  | ) |

Delete the metadata field order.

This removes the association of the order with any schemas and deletes the folder it uses. The object should not be used after calling this method.

Definition at line 80 of file MetadataFieldOrder.php.

References Folder\Id(), and Database\Query().

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 162 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 828 of file MetadataFieldOrder.php.

References GetItemId(), and GetItemType().

Referenced by GetSiblingItem().

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 745 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 175 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 204 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 712 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 115 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 722 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::GetOrderForSchema | ( | MetadataSchema | $Schema,
|  |  | $Name
| ) |  |
| static

Get a metadata field order with a specific name for a given metadata schema.

Parameters

  MetadataSchema | $Schema | Schema of which to get the order.
  string | $Name | Name of the metadata field order to get.

Returns
  Returns a MetadataFieldOrder or NULL if it doesn't exist.

See also
  GetOrderForSchemaId()

Definition at line 612 of file MetadataFieldOrder.php.

References MetadataSchema\Id().

Referenced by MetadataSchema\GetDisplayOrder(), and MetadataSchema\GetEditOrder().

Here is the caller graph for this function:

static MetadataFieldOrder::GetOrderForSchemaId | ( |  | $SchemaId,
|  |  | $Name
| ) |  |
| static

Get a metadata field order with a specific name for a given metadata schema ID.

Parameters

  int | $SchemaId | Schema ID of which to get the order.
  string | $Name | Name of the metadata field order to get.

Returns
  Returns a MetadataFieldOrder or NULL if it doesn't exist.

See also
  GetOrderForSchema()

Definition at line 625 of file MetadataFieldOrder.php.

References $SchemaId.

static MetadataFieldOrder::GetOrdersForSchema | ( | MetadataSchema | $Schema | ) |
| static

Get all of the orders associated with a schema.

Parameters

  MetadataSchema | $Schema | Schema of which to get the orders.

Returns
  Returns an array of orders associated with the schema.

See also
  GetOrdersForSchemaId()

Definition at line 645 of file MetadataFieldOrder.php.

References MetadataSchema\Id().

Referenced by MetadataSchema\Delete(), and MetadataField\Drop().

Here is the caller graph for this function:

static MetadataFieldOrder::GetOrdersForSchemaId | ( |  | $SchemaId | ) |
| static

Get all of the orders associated with a schema ID.

Parameters

  int | $SchemaId | ID of the schema of which to get the orders.

Returns
  Returns an array of orders associated with the schema.

See also
  GetOrdersForSchema()

Definition at line 656 of file MetadataFieldOrder.php.

References $Database, and $SchemaId.

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 776 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 733 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 692 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 507 of file MetadataFieldOrder.php.

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

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

Here is the caller graph for this function:

MetadataFieldOrder::MendIssues | ( |  | ) |

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

Definition at line 94 of file MetadataFieldOrder.php.

References Folder\AppendItem(), ItemInOrder(), and SchemaId().

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 924 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

  MetadataFieldGroup | $Group | metadata field group
  MetadataField | $Field | metadata field
  string | $Placement | where to place the field ("prepend" or "append")

Definition at line 862 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

  MetadataFieldGroup | $Group | metadata field group
  MetadataField | $Field | metadata field
  string | $Placement | where to place the field ("before" or "after")

Returns
  void

Definition at line 892 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

  MetadataFieldGroup | $Group | the group within which to move the field
  MetadataField | $Field | the field to move

Exceptions

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

Definition at line 411 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 451 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 305 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 370 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 237 of file MetadataFieldOrder.php.

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

MetadataFieldOrder::OrderName | ( |  | ) |

Get the name of the metadata field order.

Returns
  Returns the name of the metadata field order.

Definition at line 70 of file MetadataFieldOrder.php.

References $OrderName.

Referenced by __construct().

Here is the caller graph for this function:

MetadataFieldOrder::SchemaId | ( |  | ) |

Get the ID of the metadata schema with which the metadata field order is associated.

Returns
  Returns the ID of the metadata schema with which the metadata field order is associated.

Definition at line 61 of file MetadataFieldOrder.php.

References $SchemaId.

Referenced by __construct(), and MendIssues().

Here is the caller graph for this function:

## Member Data Documentation

MetadataFieldOrder::$Database
| protected

Database object with which to query the database.

Definition at line 949 of file MetadataFieldOrder.php.

Referenced by Create(), and GetOrdersForSchemaId().

MetadataFieldOrder::$OrderName
| protected

The name of the metadata field order.

Definition at line 960 of file MetadataFieldOrder.php.

Referenced by OrderName().

MetadataFieldOrder::$SchemaId
| protected

The ID of the metadata schema this metadata field order is associated with.

Definition at line 955 of file MetadataFieldOrder.php.

Referenced by GetOrderForSchemaId(), GetOrdersForSchemaId(), and SchemaId().

const MetadataFieldOrder::DEFAULT_FOLDER_NAME = "FieldOrder"

The default name given to the folders that are really metadata field orders.

Definition at line 21 of file MetadataFieldOrder.php.

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

- objects/MetadataFieldOrder.php