3 # FILE: ClassificationFactory.php
5 # Part of the Collection Workflow Integration System (CWIS)
6 # Copyright 2004-2013 Edward Almasy and Internet Scout Research Group
7 # http://scout.wisc.edu/cwis/
16 # ---- PUBLIC INTERFACE --------------------------------------------------
24 # set up item factory base class
25 $this->
ItemFactory(
"Classification",
"Classifications",
26 "ClassificationId",
"ClassificationName", FALSE,
27 ($FieldId ?
"FieldId = ".intval($FieldId) : NULL));
39 # retrieve IDs of all children
41 $DB->Query(
"SELECT ClassificationId FROM Classifications"
42 .
" WHERE ParentId = ".intval($ClassId));
43 $ChildIds =
$DB->FetchColumn(
"ClassificationId");
49 # retrieve IDs of any children of child
52 # add retrieved IDs to child ID list
53 $ChildIds = array_merge($ChildIds, $ChildChildIds);
56 # return child ID list to caller
65 # queue a task to recalculate the resource counts for each
69 $GLOBALS[
"AF"]->QueueUniqueTask(
70 array(__CLASS__,
"RecalculateResourceCount"),
73 "Recalculate the resource counts for a classification");
87 # only recalculate the counts if the classification is valid
90 $Classification->RecalcResourceCount();
94 # ---- PRIVATE INTERFACE -------------------------------------------------
static RecalculateResourceCount($Id)
Callback to recalculate the resource count for a single classification by its ID. ...
SQL database abstraction object with smart query caching.
GetChildIds($ClassId)
Get IDs of all children of specified classification.
RecalculateAllResourceCounts()
Queue tasks to recalculate resource counts for all classifications.
ClassificationFactory($FieldId=NULL)
Class constructor.
const CLASSSTAT_OK
Status code indicating operation completed successfully.
Common factory class for item manipulation.
Factory for producing and manipulating Classification objects.
Metadata type representing hierarchical ("Tree") controlled vocabulary values.
GetItemIds($Condition=NULL, $IncludeTempItems=FALSE, $SortField=NULL, $SortAscending=TRUE)
Return array of item IDs.
ItemFactory($ItemClassName, $ItemTableName, $ItemIdFieldName, $ItemNameFieldName=NULL, $OrderOpsAllowed=FALSE, $SqlCondition=NULL)
Class constructor.
const PRIORITY_BACKGROUND
Lowest priority.