CWIS Developer Documentation

- Home
- Main Page
- 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. More...
| Delete ()
| Delete folder. More...

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

## Item Operations
const | MIXEDCONTENT = -1
| 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 | GetItemTypeId ($TypeName)

## 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 17 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

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

Definition at line 250 of file Folder.php.

Referenced by MetadataFieldOrder\CreateGroup(), and MetadataFieldOrder\MendIssues().

Here is the caller graph for this function:

Folder::AppendItems | ( |  | $ItemsOrItemIds,
|  |  | $ItemTypes = `NULL`
| ) |  |

Add multiple items to the folder at the end.

Parameters

  ItemsOrItemIds | array of ItemIds or Item objects to add.
  ItemTypes | array of item types corresponding to the Items, or a single item type that applies to all Items.

Definition at line 262 of file Folder.php.

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

Check whether specified item is contained in folder.

Parameters

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

Returns
  TRUE if item is in folder, otherwise FALSE.

Definition at line 390 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 84 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

  int | $FolderId | ID of folder.

Definition at line 28 of file Folder.php.

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

Folder::GetItemCount | ( |  | ) |

Get number of items in folder.

This does not included nested items, so if a folder contains another folder that contains items, the inner folder is counted as only one item.

Returns
  int Number of items.

Definition at line 329 of file Folder.php.

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 299 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:

static Folder::GetItemTypeId | ( |  | $TypeName | ) |
| static

Map item type string to numerical value. (This method is not private because FolderFactory needs it.)

Parameters

  string | $TypeName | Item type name.

Returns
  int Item type ID.

Definition at line 431 of file Folder.php.

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

Here is the caller graph for this function:

Folder::Id | ( |  | ) |

Get folder ID.

Returns
  Numerical folder ID.

Definition at line 105 of file Folder.php.

Referenced by MetadataFieldOrder\Delete(), 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

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

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

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

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

  bool | $NewValue | Boolean value. (OPTIONAL)

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

Definition at line 159 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 115 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

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

Returns
  Current normalized version of folder name.

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

  string | $Name | Folder name to normalize.

Returns
  String containing normalized name.

Definition at line 148 of file Folder.php.

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

Get/set note text for folder.

Parameters

  string | $NewValue | New note text. (OPTIONAL)

Returns
  String containing current note for folder.

Definition at line 180 of file Folder.php.

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

Get/set note text for specific item within folder.

Parameters

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

Returns
  String containing current note text for specified item.

Definition at line 367 of file Folder.php.

References Id().

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

Get/set user ID of folder owner.

Parameters

  int | $NewValue | Numerical user ID. (OPTIONAL)

Returns
  ID of current folder owner.

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

  mixed | $ItemOrItemId | Item to add.
  mixed | $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

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

Definition at line 340 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 422 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