CWIS Developer Documentation
|
Class to build metadata field ordering functionality on top of the foldering functionality. More...
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... | |
![]() | |
Folder ($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 () | |
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 | 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... | |
![]() | |
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... | |
Class to build metadata field ordering functionality on top of the foldering functionality.
Definition at line 14 of file MetadataFieldOrder.php.
MetadataFieldOrder::__construct | ( | $Id | ) |
Load an existing metadata field order.
int | $Id | The ID of the metadata field order to load. |
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().
|
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.
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. |
Definition at line 542 of file MetadataFieldOrder.php.
References $Database, MetadataSchema\GetFields(), and MetadataSchema\Id().
Referenced by MetadataSchema\Create().
MetadataFieldOrder::CreateGroup | ( | $Name | ) |
Create a new metadata field group with the given name.
string | $Name | group name |
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.
MetadataFieldGroup | $Group | metadata field group |
Definition at line 162 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), Folder\Id(), MoveFieldsToOrder(), and Folder\RemoveItem().
|
protected |
Attempt to find the item that is the given distance from the item within the given enclosure.
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 |
Definition at line 818 of file MetadataFieldOrder.php.
References GetItemId(), and GetItemType().
Referenced by GetSiblingItem().
|
protected |
Get the metadata field order or metadata field group that encloses the given item.
MetadataField | MetadataFieldGroup | $Item | item |
Definition at line 740 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), GetGroups(), GetItemId(), and GetItemType().
Referenced by MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().
MetadataFieldOrder::GetFields | ( | ) |
Get all the fields in this metadata field ordering in order.
Definition at line 175 of file MetadataFieldOrder.php.
References GetItems().
MetadataFieldOrder::GetGroups | ( | ) |
Get all the groups in this metadata field ordering in order.
Definition at line 204 of file MetadataFieldOrder.php.
References Folder\GetItemIds().
Referenced by GetEnclosure(), GetSiblingItem(), and ItemInOrder().
|
protected |
Get the ID of the given item.
MetadataField | MetadataFieldGroup | MetadataFieldOrder | $Item | item |
Definition at line 707 of file MetadataFieldOrder.php.
Referenced by FindSiblingItem(), GetEnclosure(), GetSiblingItem(), ItemInOrder(), MoveFieldToGroup(), MoveFieldToOrder(), MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().
MetadataFieldOrder::GetItems | ( | ) |
Transform the item IDs of the metadata field order object into objects.
Definition at line 115 of file MetadataFieldOrder.php.
References $Items, and Folder\GetItemIds().
Referenced by GetFields().
|
protected |
Get the type of the given item.
MetadataField | MetadataFieldGroup | MetadataFieldOrder | $Item | item |
Definition at line 717 of file MetadataFieldOrder.php.
Referenced by FindSiblingItem(), GetEnclosure(), GetSiblingItem(), ItemInOrder(), MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().
|
static |
Get a metadata field order with a specific name for a given metadata schema.
MetadataSchema | $Schema | Schema of which to get the order. |
string | $Name | Name of the metadata field order to get. |
Definition at line 607 of file MetadataFieldOrder.php.
References MetadataSchema\Id().
Referenced by MetadataSchema\GetDisplayOrder(), and MetadataSchema\GetEditOrder().
|
static |
Get a metadata field order with a specific name for a given metadata schema ID.
int | $SchemaId | Schema ID of which to get the order. |
string | $Name | Name of the metadata field order to get. |
Definition at line 620 of file MetadataFieldOrder.php.
References $SchemaId.
|
static |
Get all of the orders associated with a schema.
MetadataSchema | $Schema | Schema of which to get the orders. |
Definition at line 640 of file MetadataFieldOrder.php.
References MetadataSchema\Id().
Referenced by MetadataSchema\Delete(), and MetadataField\Drop().
|
static |
Get all of the orders associated with a schema ID.
int | $SchemaId | ID of the schema of which to get the orders. |
Definition at line 651 of file MetadataFieldOrder.php.
|
protected |
Get the item object of the item that is the given distance from the item.
MetadataField | MetadataFieldGroup | $Item | item |
int | $Offset | distance from the item, negative values are allowed |
callback | $Filter | callback to filter out items |
Definition at line 771 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), FindSiblingItem(), GetGroups(), GetItemId(), and GetItemType().
Referenced by MoveItemDown(), and MoveItemUp().
|
protected |
Callback for the filter to retrieve groups only from the metadata field order.
array | $Item | array of item info, i.e., item ID and type |
Definition at line 728 of file MetadataFieldOrder.php.
|
protected |
Determine if the given item is a metadata field or metadata field group.
mixed | $Item | item |
Definition at line 687 of file MetadataFieldOrder.php.
Referenced by ItemInOrder(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().
MetadataFieldOrder::ItemInOrder | ( | $Item | ) |
Determine whether the given item is a member of this order.
MetadataField | MetadataFieldGroup | $Item | item |
Definition at line 502 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), GetGroups(), GetItemId(), GetItemType(), and IsFieldOrGroup().
Referenced by MendIssues(), MoveFieldToTopOfGroup(), MoveItemAfter(), MoveItemDown(), MoveItemToTop(), and MoveItemUp().
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().
|
protected |
Move all the metadata fields out of the given metadata field group and into the main order.
MetadataFieldGroup | $Group | metadata field group |
Definition at line 914 of file MetadataFieldOrder.php.
References Folder\GetItemIds(), Folder\Id(), and Folder\InsertItemAfter().
Referenced by DeleteGroup().
|
protected |
Move the field with the given ID to the group with the given ID, optionally specifying the place where the should be placed.
MetadataFieldGroup | $Group | metadata field group |
MetadataField | $Field | metadata field |
string | $Placement | where to place the field ("prepend" or "append") |
Definition at line 852 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), GetItemId(), and Folder\RemoveItem().
Referenced by MoveItemDown(), and MoveItemUp().
|
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.
MetadataFieldGroup | $Group | metadata field group |
MetadataField | $Field | metadata field |
string | $Placement | where to place the field ("before" or "after") |
Definition at line 882 of file MetadataFieldOrder.php.
References Folder\ContainsItem(), GetItemId(), and Folder\RemoveItem().
Referenced by MoveItemDown(), and MoveItemUp().
MetadataFieldOrder::MoveFieldToTopOfGroup | ( | MetadataFieldGroup | $Group, |
MetadataField | $Field | ||
) |
Move the given item to the top of the order.
MetadataFieldGroup | $Group | the group within which to move the field |
MetadataField | $Field | the field to move |
Exception | if the group or field aren't in the order |
Definition at line 406 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.
MetadataField | MetadataFieldGroup | $Target | the item to move after |
MetadataField | MetadataFieldGroup | $Item | the item to move |
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 446 of file MetadataFieldOrder.php.
References GetEnclosure(), GetItemId(), GetItemType(), IsFieldOrGroup(), and ItemInOrder().
Referenced by MoveItemDown(), and MoveItemUp().
MetadataFieldOrder::MoveItemDown | ( | $Item, | |
$Filter = NULL |
|||
) |
Move the given item down in the order.
MetadataField | MetadataFieldGroup | $Item | |
callback | $Filter | callback to filter out items before moving |
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 300 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.
MetadataField | MetadataFieldGroup | $Item | the item to move |
Exception | if the item isn't a metadata field or metadata group |
Exception | if the item isn't in the order |
Definition at line 365 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.
MetadataField | MetadataFieldGroup | $Item | item |
callback | $Filter | callback to filter out items before moving |
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 232 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.
Definition at line 70 of file MetadataFieldOrder.php.
References $OrderName.
Referenced by __construct().
MetadataFieldOrder::SchemaId | ( | ) |
Get 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().
|
protected |
Database object with which to query the database.
Definition at line 939 of file MetadataFieldOrder.php.
Referenced by Create(), and GetOrdersForSchemaId().
|
protected |
The name of the metadata field order.
Definition at line 950 of file MetadataFieldOrder.php.
Referenced by OrderName().
|
protected |
The ID of the metadata schema this metadata field order is associated with.
Definition at line 945 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.