CWIS Developer Documentation
|
Common factory class for item manipulation. More...
Public Member Functions | |
__construct ($ItemClassName, $ItemTableName, $ItemIdColumnName, $ItemNameColumnName=NULL, $OrderOpsAllowed=FALSE, $SqlCondition=NULL) | |
Class constructor. More... | |
GetItemClassName () | |
Get class name of items manipulated by factory. More... | |
CleanOutStaleTempItems ($MinutesUntilStale=10080) | |
Clear out (call the Delete() method) for any temp items more than specified number of minutes old. More... | |
GetNextItemId () | |
Retrieve next available (non-temp) item ID. More... | |
GetHighestItemId ($IgnoreSqlCondition=FALSE) | |
Retrieve highest item ID in use. More... | |
GetNextTempItemId () | |
Return next available temporary item ID. More... | |
GetItemCount ($Condition=NULL, $IncludeTempItems=FALSE) | |
Get count of items. More... | |
GetItemIds ($Condition=NULL, $IncludeTempItems=FALSE, $SortField=NULL, $SortAscending=TRUE) | |
Return array of item IDs. More... | |
GetLatestModificationDate ($Condition=NULL) | |
Get newest modification date (based on values in "DateLastModified" column in database table). More... | |
GetItem ($ItemId) | |
Retrieve item by item ID. More... | |
ItemExists ($ItemId, $IgnoreSqlCondition=FALSE) | |
Check that item exists with specified ID. More... | |
GetItemByName ($Name, $IgnoreCase=FALSE) | |
Retrieve item by name. More... | |
GetItemIdByName ($Name, $IgnoreCase=FALSE) | |
Retrieve item ID by name. More... | |
GetItemIdsByNames ($Names) | |
Look up IDs for specified names. More... | |
GetItemNames ($SqlCondition=NULL) | |
Retrieve item names. More... | |
GetItems ($SqlCondition=NULL) | |
Retrieve items. More... | |
GetItemsAsOptionList ($OptionListName, $SelectedItemId=NULL, $SqlCondition=NULL, $DisplaySize=1, $SubmitOnChange=FALSE, $Disabled=FALSE) | |
Retrieve items of specified type as HTML option list with item names as labels and item IDs as value attributes. More... | |
NameIsInUse ($Name, $IgnoreCase=FALSE) | |
Check whether item name is currently in use. More... | |
SearchForItemNames ($SearchString, $NumberOfResults=100, $IncludeVariants=FALSE, $UseBooleanMode=TRUE, $Offset=0, $IdExclusions=array(), $NameExclusions=array()) | |
Retrieve items with names matching search string. More... | |
GetCountForItemNames ($SearchString, $IncludeVariants=FALSE, $UseBooleanMode=TRUE, $IdExclusions=array(), $NameExclusions=array()) | |
Retrieve count of items with names matching search string. More... | |
ReindexByItemIds ($Array) | |
Reindex supplied associative array, by replacing item names with item IDs. More... | |
CachingEnabled ($NewValue=NULL) | |
Enable/disable caching of item information. More... | |
ClearCaches () | |
Clear item information caches. More... | |
SetOrderOpsCondition ($Condition) | |
Set SQL condition (added to WHERE clause) used to select items for ordering operations. More... | |
InsertBefore ($TargetItem, $NewItem) | |
Insert item into order before specified item. More... | |
InsertAfter ($TargetItem, $NewItem) | |
Insert item into order after specified item. More... | |
Prepend ($Item) | |
Add item to beginning of order. More... | |
Append ($Item) | |
Add item to end of order. More... | |
GetItemIdsInOrder () | |
Retrieve list of item IDs in order. More... | |
RemoveItemFromOrder ($ItemId) | |
Remove item from existing order. More... | |
Protected Attributes | |
$DB | |
Common factory class for item manipulation.
Not intended to be used directly, but rather as a parent for factory classes for specific item types. For a derived class to use the temp methods the item record in the database must include a "DateLastModified" column, and the item object must include a "Delete()" method.
Definition at line 17 of file ItemFactory.php.
ItemFactory::__construct | ( | $ItemClassName, | |
$ItemTableName, | |||
$ItemIdColumnName, | |||
$ItemNameColumnName = NULL , |
|||
$OrderOpsAllowed = FALSE , |
|||
$SqlCondition = NULL |
|||
) |
Class constructor.
string | $ItemClassName | Class of items to be manipulated by factory. |
string | $ItemTableName | Name of database table used to store info about items. |
string | $ItemIdColumnName | Name of field in database table used to store item IDs. |
string | $ItemNameColumnName | Name of field in database table used to store item names. (OPTIONAL) |
bool | $OrderOpsAllowed | If TRUE, ordering operations are allowed with items, and the database table must contain "Previous" and "Next" fields as described by the PersistentDoublyLinkedList class. |
string | $SqlCondition | SQL condition clause (without "WHERE") to include when retrieving items from database. (OPTIONAL) |
Definition at line 37 of file ItemFactory.php.
References SetOrderOpsCondition().
ItemFactory::Append | ( | $Item | ) |
Add item to end of order.
If the item is already present in the order, it is moved to the end.
mixed | $Item | Item (object or ID) to add. |
Definition at line 808 of file ItemFactory.php.
ItemFactory::CachingEnabled | ( | $NewValue = NULL | ) |
Enable/disable caching of item information.
bool | $NewValue | TRUE to enable caching, or FALSE to disable. (OPTIONAL) |
Definition at line 706 of file ItemFactory.php.
Referenced by GetItemIdByName().
ItemFactory::CleanOutStaleTempItems | ( | $MinutesUntilStale = 10080 | ) |
Clear out (call the Delete() method) for any temp items more than specified number of minutes old.
int | $MinutesUntilStale | Number of minutes before items are considered stale. (OPTIONAL - defaults to 7 days) |
Definition at line 83 of file ItemFactory.php.
ItemFactory::ClearCaches | ( | ) |
Clear item information caches.
Definition at line 719 of file ItemFactory.php.
Referenced by MetadataSchema\AddField().
ItemFactory::GetCountForItemNames | ( | $SearchString, | |
$IncludeVariants = FALSE , |
|||
$UseBooleanMode = TRUE , |
|||
$IdExclusions = array() , |
|||
$NameExclusions = array() |
|||
) |
Retrieve count of items with names matching search string.
string | $SearchString | String to search for. |
bool | $IncludeVariants | Include Variants ? (NOT YET IMPLEMENTED) (OPTIONAL) |
bool | $UseBooleanMode | If TRUE, perform search using MySQL "Boolean Mode", which among other things supports inclusion and exclusion operators on terms in the search string. (OPTIONAL, defaults to TRUE) |
array | $IdExclusions | List of IDs of items to exclude. |
array | $NameExclusions | List of names of items to exclude. |
Definition at line 655 of file ItemFactory.php.
References $DB.
ItemFactory::GetHighestItemId | ( | $IgnoreSqlCondition = FALSE | ) |
Retrieve highest item ID in use.
bool | $IgnoreSqlCondition | If TRUE, any SQL condition set via the constructor is ignored. (OPTIONAL, defaults to FALSE) |
Definition at line 136 of file ItemFactory.php.
Referenced by MetadataSchema\GetHighestFieldId(), and GetNextItemId().
ItemFactory::GetItem | ( | $ItemId | ) |
Retrieve item by item ID.
This method assumes that an item can be loaded by passing an item ID to the appropriate class constructor.
int | $ItemId | Item ID. |
Definition at line 321 of file ItemFactory.php.
Referenced by GetItemByName(), GetItems(), and OAIServer\GetResponse().
ItemFactory::GetItemByName | ( | $Name, | |
$IgnoreCase = FALSE |
|||
) |
Retrieve item by name.
string | $Name | Name to match. |
bool | $IgnoreCase | If TRUE, ignore case when attempting to match the item name. (OPTIONAL, defaults to FALSE) |
Definition at line 355 of file ItemFactory.php.
References GetItem(), and GetItemIdByName().
ItemFactory::GetItemClassName | ( | ) |
Get class name of items manipulated by factory.
Definition at line 71 of file ItemFactory.php.
ItemFactory::GetItemCount | ( | $Condition = NULL , |
|
$IncludeTempItems = FALSE |
|||
) |
Get count of items.
string | $Condition | SQL condition to include in query to retrieve item count. The condition should not include "WHERE". (OPTIONAL) |
bool | $IncludeTempItems | Whether to include temporary items in count. (OPTIONAL, defaults to FALSE) |
Definition at line 181 of file ItemFactory.php.
Referenced by FolderFactory\GetFolderCount().
ItemFactory::GetItemIdByName | ( | $Name, | |
$IgnoreCase = FALSE |
|||
) |
Retrieve item ID by name.
string | $Name | Name to match. |
bool | $IgnoreCase | If TRUE, ignore case when attempting to match the item name. (OPTIONAL, defaults to FALSE) |
Exception | If item type does not have a name field defined. |
Definition at line 381 of file ItemFactory.php.
References CachingEnabled().
Referenced by MetadataSchema\GetFieldIdByName(), GetItemByName(), GetItemIdsByNames(), and ReindexByItemIds().
ItemFactory::GetItemIds | ( | $Condition = NULL , |
|
$IncludeTempItems = FALSE , |
|||
$SortField = NULL , |
|||
$SortAscending = TRUE |
|||
) |
Return array of item IDs.
string | $Condition | SQL condition clause to restrict selection of items (should not include "WHERE"). |
bool | $IncludeTempItems | Whether to include temporary items in returned set. (OPTIONAL, defaults to FALSE) |
string | $SortField | Database column to use to sort results. (OPTIONAL) |
bool | $SortAscending | If TRUE, sort items in ascending order, otherwise sort items in descending order. (OPTIONAL, and only meaningful if a sort field is specified.) |
Definition at line 238 of file ItemFactory.php.
Referenced by FolderFactory\GetFolders(), GetItems(), and ClassificationFactory\RecalculateAllResourceCounts().
ItemFactory::GetItemIdsByNames | ( | $Names | ) |
Look up IDs for specified names.
array | $Names | Names to look up. |
Definition at line 420 of file ItemFactory.php.
References GetItemIdByName().
ItemFactory::GetItemIdsInOrder | ( | ) |
Retrieve list of item IDs in order.
Definition at line 826 of file ItemFactory.php.
ItemFactory::GetItemNames | ( | $SqlCondition = NULL | ) |
Retrieve item names.
string | $SqlCondition | SQL condition (w/o "WHERE") for name retrieval. (OPTIONAL) |
Definition at line 436 of file ItemFactory.php.
Referenced by GetItemsAsOptionList().
ItemFactory::GetItems | ( | $SqlCondition = NULL | ) |
Retrieve items.
string | $SqlCondition | SQL condition (w/o "WHERE") for name retrieval. (OPTIONAL) |
Definition at line 481 of file ItemFactory.php.
References $Items, GetItem(), and GetItemIds().
Referenced by OAIServer\GetResponse(), SavedSearchFactory\GetSearchesDueToRun(), and SavedSearchFactory\GetSearchesForUser().
ItemFactory::GetItemsAsOptionList | ( | $OptionListName, | |
$SelectedItemId = NULL , |
|||
$SqlCondition = NULL , |
|||
$DisplaySize = 1 , |
|||
$SubmitOnChange = FALSE , |
|||
$Disabled = FALSE |
|||
) |
Retrieve items of specified type as HTML option list with item names as labels and item IDs as value attributes.
The first element on the list will have a label of "--" and an ID of -1 to indicate no item selected.
string | $OptionListName | Value of option list "name" attribute. |
int | $SelectedItemId | ID of currently-selected item or array of IDs of currently-selected items. (OPTIONAL) |
string | $SqlCondition | SQL condition (w/o "WHERE") for item retrieval. (OPTIONAL, defaults to NULL) |
int | $DisplaySize | Display length of option list. (OPTIONAL, defaults to 1) |
bool | $SubmitOnChange | Whether to submit form when option list changes. (OPTIONAL, defaults to FALSE) |
bool | $Disabled | If TRUE, field will not be editable. |
Definition at line 508 of file ItemFactory.php.
References GetItemNames().
ItemFactory::GetLatestModificationDate | ( | $Condition = NULL | ) |
Get newest modification date (based on values in "DateLastModified" column in database table).
string | $Condition | SQL condition clause to restrict selection of items (should not include "WHERE"). |
Definition at line 291 of file ItemFactory.php.
ItemFactory::GetNextItemId | ( | ) |
Retrieve next available (non-temp) item ID.
If there are currently no items, an ID of 1 will be returned.
Definition at line 110 of file ItemFactory.php.
References GetHighestItemId().
ItemFactory::GetNextTempItemId | ( | ) |
Return next available temporary item ID.
Definition at line 155 of file ItemFactory.php.
ItemFactory::InsertAfter | ( | $TargetItem, | |
$NewItem | |||
) |
Insert item into order after specified item.
If the item is already present in the order, it is moved to the new location. If the target item is not found, the new item is added to the end of the order.
Definition at line 770 of file ItemFactory.php.
ItemFactory::InsertBefore | ( | $TargetItem, | |
$NewItem | |||
) |
Insert item into order before specified item.
If the item is already present in the order, it is moved to the new location. If the target item is not found, the new item is added to the beginning of the order.
mixed | $TargetItem | Item (object or ID) to insert before. |
mixed | $NewItem | Item (object or ID) to insert. |
Definition at line 749 of file ItemFactory.php.
ItemFactory::ItemExists | ( | $ItemId, | |
$IgnoreSqlCondition = FALSE |
|||
) |
Check that item exists with specified ID.
int | $ItemId | ID of item. |
bool | $IgnoreSqlCondition | If TRUE, any SQL condition set in the constructor is ignored. (OPTIONAL, defaults to FALSE) |
Definition at line 333 of file ItemFactory.php.
Referenced by MetadataSchema\FieldExists().
ItemFactory::NameIsInUse | ( | $Name, | |
$IgnoreCase = FALSE |
|||
) |
Check whether item name is currently in use.
string | $Name | Name to check. |
bool | $IgnoreCase | If TRUE, ignore case when checking. (Defaults to FALSE) |
Definition at line 538 of file ItemFactory.php.
Referenced by MetadataSchema\AddFieldsFromXmlFile(), and MetadataSchema\FieldExists().
ItemFactory::Prepend | ( | $Item | ) |
Add item to beginning of order.
If the item is already present in the order, it is moved to the beginning.
mixed | $Item | Item (object or ID) to add. |
Definition at line 789 of file ItemFactory.php.
ItemFactory::ReindexByItemIds | ( | $Array | ) |
Reindex supplied associative array, by replacing item names with item IDs.
array | $Array | Array to reindex. |
InvalidArgumentException | If key found that does not match item name. |
Definition at line 684 of file ItemFactory.php.
References GetItemIdByName().
ItemFactory::RemoveItemFromOrder | ( | $ItemId | ) |
Remove item from existing order.
If the item is not currently in the existing order, then the call has no effect. This does not delete or otherwise remove the item from the database.
int | $ItemId | ID of item to be removed from order. |
Definition at line 846 of file ItemFactory.php.
References $DB.
ItemFactory::SearchForItemNames | ( | $SearchString, | |
$NumberOfResults = 100 , |
|||
$IncludeVariants = FALSE , |
|||
$UseBooleanMode = TRUE , |
|||
$Offset = 0 , |
|||
$IdExclusions = array() , |
|||
$NameExclusions = array() |
|||
) |
Retrieve items with names matching search string.
string | $SearchString | String to search for. |
int | $NumberOfResults | Number of results to return. (OPTIONAL, defaults to 100) |
bool | $IncludeVariants | SHould Variants be included? (NOT YET IMPLEMENTED) (OPTIONAL) |
bool | $UseBooleanMode | If TRUE, perform search using MySQL "Boolean Mode", which among other things supports inclusion and exclusion operators on terms in the search string. (OPTIONAL, defaults to TRUE) |
int | $Offset | Beginning offset into results. (OPTIONAL, defaults to 0, which is the first element) |
array | $IdExclusions | List of IDs of items to exclude. |
array | $NameExclusions | List of names of items to exclude. |
Definition at line 570 of file ItemFactory.php.
References $DB.
ItemFactory::SetOrderOpsCondition | ( | $Condition | ) |
Set SQL condition (added to WHERE clause) used to select items for ordering operations.
NULL may be passed in to clear any existing condition.
string | null | $Condition | SQL condition (should not include "WHERE"). |
Definition at line 733 of file ItemFactory.php.
Referenced by FolderFactory\__construct(), and __construct().
|
protected |
Definition at line 1004 of file ItemFactory.php.
Referenced by ResourceFactory\BuildMultiSchemaResourceList(), ResourceFactory\ClearViewingPermsCache(), MetadataSchema\Create(), MetadataSchema\GetAllSchemaNames(), ClassificationFactory\GetChildIds(), GetCountForItemNames(), MetadataSchema\GetSchemaIdForName(), MetadataSchema\GetStandardFieldNames(), RemoveItemFromOrder(), MetadataSchema\SchemaExistsWithId(), and SearchForItemNames().