CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

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

List of all members
Folder Class Reference

Folder object used to create and manage groups of items. More...

Inheritance diagram for Folder:
[legend]

## Setup/Initialization
| Folder ($FolderId)
| Object constructor – load an existing folder.
| Delete ()
| Delete folder.

## Attribute Setting/Retrieval
| 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.
static | NormalizeFolderName ($Name)
| Convert folder name to normalized form (lower-case alphanumeric only).

## Item Operations
const | MIXEDCONTENT = -1
| 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.

## Detailed Description

Folder object used to create and manage groups of items.

Items are identified and manipulated within folders by a positive integer "ID" value. For folders intended to contain multiple types of item types, item types are arbitrary string values.

Definition at line 18 of file Folder.php.

## Member Function Documentation

Folder::AppendItem | ( |  | $ItemOrItemId,
|  |  | $ItemType = `NULL`
| ) |  |

Add item to folder as the last item.

If the item is already present in the folder, it is moved to be the last item.

Parameters

  ItemOrItemId | Item to add.
  ItemType | Type of item to add. (OPTIONAL, for mixed-item-type folders)

Definition at line 249 of file Folder.php.

Referenced by MetadataFieldOrder\CreateGroup().

Here is the caller graph for this function:

Folder::ContainsItem | ( |  | $ItemId,
|  |  | $ItemType = `NULL`
| ) |  |

Check whether specified item is contained in folder.

Parameters

  ItemId | ID of item.
  ItemType | Type of item. (OPTIONAL, for use with mixed-item-type folders)

Returns
  TRUE if item is in folder, otherwise FALSE.

Definition at line 342 of file Folder.php.

Referenced by MetadataFieldOrder\DeleteGroup(), MetadataFieldOrder\GetEnclosure(), MetadataFieldOrder\GetSiblingItem(), MetadataFieldOrder\ItemInOrder(), MetadataFieldOrder\MoveFieldToGroup(), MetadataFieldOrder\MoveFieldToOrder(), and RemoveItem().

Here is the caller graph for this function:

Folder::Delete | ( |  | ) |

Delete folder.

(Object is no longer usable after calling this method.)

Definition at line 85 of file Folder.php.

References Id().

Folder::Folder | ( |  | $FolderId | ) |

Object constructor – load an existing folder.

New folders must be created with FolderFactory::CreateFolder() or FolderFactory::CreateMixedFolder().

Parameters

  FolderId | ID of folder.

Definition at line 29 of file Folder.php.

References Id(), IsShared(), NormalizedName(), and OwnerId().

Folder::GetItemIds | ( |  | ) |

Retrieve array of IDs of items in folder, in the order that they appear in the folder.

Returns
  Array of item IDs or (if mixed-item-type list) item IDs and types. When returning IDs and types, each element in the returned array is an associative array, with the indexes "ID" and "Type".

Definition at line 262 of file Folder.php.

Referenced by MetadataFieldGroup\GetFieldCount(), MetadataFieldGroup\GetFields(), MetadataFieldOrder\GetGroups(), MetadataFieldOrder\GetItems(), and MetadataFieldOrder\MoveFieldsToOrder().

Here is the caller graph for this function:

Folder::Id | ( |  | ) |

Get folder ID.

Returns
  Numerical folder ID.

Definition at line 106 of file Folder.php.

Referenced by Delete(), MetadataFieldOrder\DeleteGroup(), Folder(), MetadataFieldOrder\MoveFieldsToOrder(), NoteForItem(), and RemoveItem().

Here is the caller graph for this function:

Folder::InsertItemAfter | ( |  | $TargetItemOrItemId,
|  |  | $NewItemOrItemId,
|  |  | $TargetItemType = `NULL`,
|  |  | $NewItemType = `NULL`
| ) |  |

Insert item into folder after specified item.

If the item is already present in the folder, it is moved to the new location. If the target item is not found, the new item is added to the folder as the last item.

Parameters

  TargetItemOrItemId | Item to insert after.
  NewItemOrItemId | Item to insert.
  TargetItemType | Type of item to insert after. (OPTIONAL, for mixed-item-type folders)
  NewItemType | Type of item to insert. (OPTIONAL, for mixed-item-type folders)

Definition at line 222 of file Folder.php.

Referenced by MetadataFieldOrder\MoveFieldsToOrder().

Here is the caller graph for this function:

Folder::InsertItemBefore | ( |  | $TargetItemOrItemId,
|  |  | $NewItemOrItemId,
|  |  | $TargetItemType = `NULL`,
|  |  | $NewItemType = `NULL`
| ) |  |

Insert item into folder before specified item.

If the item is already present in the folder, it is moved to the new location. If the target item is not found in the folder, the new item is added to the folder as the first item.

Parameters

  TargetItemOrItemId | Item to insert before.
  NewItemOrItemId | Item to insert.
  TargetItemType | Type of item to insert before. (OPTIONAL, for mixed-item-type folders)
  NewItemType | Type of item to insert. (OPTIONAL, for mixed-item-type folders)

Definition at line 202 of file Folder.php.

Folder::IsShared | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set whether folder is publically-viewable.

(This flag is not used at all by the Folder object, but rather provided for use in interface code.)

Parameters

  NewValue | Boolean value. (OPTIONAL)

Returns
  Boolean flag indicating whether or not folder is publically-viewable

Definition at line 160 of file Folder.php.

Referenced by Folder().

Here is the caller graph for this function:

Folder::Name | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set folder name.

When used to set the folder name this also generates and sets a new normalized folder name.

Returns
  String containing folder name.

Definition at line 116 of file Folder.php.

References DB_NOVALUE, and NormalizedName().

Referenced by NormalizedName().

Here is the caller graph for this function:

Folder::NormalizedName | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set normalized version of folder name.

This method can be used to override the normalized name autogenerated when the folder name is set with Folder::Name().

Parameters

  NewValue | New normalized version of folder name. (OPTIONAL)

Returns
  Current normalized version of folder name.

Definition at line 132 of file Folder.php.

References Name().

Referenced by Folder(), and Name().

Here is the caller graph for this function:

static Folder::NormalizeFolderName | ( |  | $Name | ) |
| static

Convert folder name to normalized form (lower-case alphanumeric only).

Parameters

  Name | Folder name to normalize.

Returns
  String containing normalized name.

Definition at line 149 of file Folder.php.

Folder::Note | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set note text for folder.

Parameters

  NewValue | New note text. (OPTIONAL)

Returns
  String containing current note for folder.

Definition at line 181 of file Folder.php.

Folder::NoteForItem | ( |  | $ItemId,
|  |  | $NewValue = `DB_NOVALUE`,
|  |  | $ItemType = `NULL`
| ) |  |

Get/set note text for specific item within folder.

Parameters

  ItemId | ID of item.
  NewValue | New note text for item. (OPTIONAL)
  ItemType | Type of item. (OPTIONAL, for mixed-item-type folders)

Returns
  String containing current note text for specified item.

Definition at line 319 of file Folder.php.

References Id().

Folder::OwnerId | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set user ID of folder owner.

Parameters

  NewValue | Numerical user ID. (OPTIONAL)

Returns
  ID of current folder owner.

Definition at line 170 of file Folder.php.

References DB_NOVALUE.

Referenced by Folder().

Here is the caller graph for this function:

Folder::PrependItem | ( |  | $ItemOrItemId,
|  |  | $ItemType = `NULL`
| ) |  |

Add item to folder as the first item.

If the item is already present in the folder, it is moved to be the first item.

Parameters

  ItemOrItemId | Item to add.
  ItemType | Type of item to add. (OPTIONAL, for mixed-item-type folders)

Definition at line 237 of file Folder.php.

Referenced by MetadataFieldOrder\MoveFieldToTopOfGroup(), and MetadataFieldOrder\MoveItemToTop().

Here is the caller graph for this function:

Folder::RemoveItem | ( |  | $ItemId,
|  |  | $ItemType = `NULL`
| ) |  |

Remove item from folder, if present.

Parameters

  ItemId | ID of item to remove.
  ItemType | Type of item to be removed. (OPTIONAL, for mixed-item-type folders)

Definition at line 292 of file Folder.php.

References ContainsItem(), and Id().

Referenced by MetadataFieldOrder\DeleteGroup(), MetadataFieldOrder\MoveFieldToGroup(), and MetadataFieldOrder\MoveFieldToOrder().

Here is the caller graph for this function:

## Member Data Documentation

const Folder::MIXEDCONTENT = -1

Definition at line 375 of file Folder.php.

Referenced by FolderFactory\CreateFolder(), FolderFactory\CreateMixedFolder(), FolderFactory\GetFolders(), and FolderFactory\GetFoldersContainingItem().

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

- objects/Folder.php