CWIS Developer Documentation
List of all members
Folder Class Reference

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

Inheritance diagram for Folder:
Inheritance graph
[legend]

Setup/Initialization

 __construct ($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 ($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 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.

Constructor & Destructor Documentation

Folder::__construct (   $FolderId)

Object constructor – load an existing folder.

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

Parameters
int$FolderIdID of folder.

Definition at line 29 of file Folder.php.

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

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$ItemOrItemIdItem to add.
mixed$ItemTypeType of item to add. (OPTIONAL, for mixed-item-type folders)

Definition at line 255 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
array$ItemsOrItemIdsItemIds or Item objects to add.
mixed$ItemTypesItem types corresponding to the Items, or a single item type that applies to all Items.

Definition at line 267 of file Folder.php.

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

Check whether specified item is contained in folder.

Parameters
int$ItemIdID of item.
mixed$ItemTypeType of item. (OPTIONAL, for use with mixed-item-type folders)
Returns
TRUE if item is in folder, otherwise FALSE.

Definition at line 429 of file Folder.php.

Referenced by MetadataFieldOrder\DeleteGroup(), MetadataFieldOrder\GetEnclosure(), GetItemTypeId(), 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 88 of file Folder.php.

References Id().

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 365 of file Folder.php.

Folder::GetItemIds (   $Offset = NULL,
  $Length = NULL 
)

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

Parameters
int$OffsetOffset into results, to request a subset. If negative, the subset will start that far from the end. (OPTIONAL)
int$LengthNumber of results to return, when requesting a subset. If negative, the subset will stop that many elements from the end. (OPTIONAL - if not specified, all results to end are returned)
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 322 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$TypeNameItem type name.
Returns
int Item type ID or NULL if TypeName was NULL.

Definition at line 470 of file Folder.php.

References ContainsItem(), and Id().

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 109 of file Folder.php.

Referenced by __construct(), MetadataFieldOrder\Delete(), Delete(), MetadataFieldOrder\DeleteGroup(), GetItemTypeId(), 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$TargetItemOrItemIdItem to insert after.
mixed$NewItemOrItemIdItem to insert.
mixed$TargetItemTypeType of item to insert after. (OPTIONAL, for mixed-item-type folders)
mixed$NewItemTypeType of item to insert. (OPTIONAL, for mixed-item-type folders)

Definition at line 226 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$TargetItemOrItemIdItem to insert before.
mixed$NewItemOrItemIdItem to insert.
mixed$TargetItemTypeType of item to insert before. (OPTIONAL, for mixed-item-type folders)
mixed$NewItemTypeType of item to insert. (OPTIONAL, for mixed-item-type folders)

Definition at line 206 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$NewValueBoolean value. (OPTIONAL)
Returns
Boolean flag indicating whether or not folder is publically-viewable

Definition at line 164 of file Folder.php.

Referenced by __construct().

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.

Parameters
string$NewValueNew name. (OPTIONAL)
Returns
String containing folder name.

Definition at line 120 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$NewValueNew normalized version of folder name. (OPTIONAL)
Returns
Current normalized version of folder name.

Definition at line 136 of file Folder.php.

References Name().

Referenced by __construct(), 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$NameFolder name to normalize.
Returns
String containing normalized name.

Definition at line 153 of file Folder.php.

Folder::Note (   $NewValue = DB_NOVALUE)

Get/set note text for folder.

Parameters
string$NewValueNew note text. (OPTIONAL)
Returns
String containing current note for folder.

Definition at line 185 of file Folder.php.

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

Get/set note text for specific item within folder.

Parameters
int$ItemIdID of item.
string$NewValueNew note text for item. (OPTIONAL)
mixed$ItemTypeType of item. (OPTIONAL, for mixed-item-type folders)
Returns
String containing current note text for specified item.

Definition at line 404 of file Folder.php.

References Id().

Folder::OwnerId (   $NewValue = DB_NOVALUE)

Get/set user ID of folder owner.

Parameters
int$NewValueNumerical user ID. (OPTIONAL)
Returns
ID of current folder owner.

Definition at line 174 of file Folder.php.

References DB_NOVALUE.

Referenced by __construct().

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$ItemOrItemIdItem to add.
mixed$ItemTypeType of item to add. (OPTIONAL, for mixed-item-type folders)

Definition at line 242 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$ItemIdID of item to remove.
mixed$ItemTypeType of item to be removed. (OPTIONAL, for mixed-item-type folders)

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

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