CWIS Developer Documentation
|
Metadata type representing hierarchical ("Tree") controlled vocabulary values. More...
Public Member Functions | |
Id () | |
Get Classification ID. More... | |
FullName () | |
Get full classification name (all segments). More... | |
Name () | |
Get name of classification segment. More... | |
VariantName () | |
Get variant name of classification, if any. More... | |
Depth () | |
Get depth of classification in hierarchy. More... | |
ResourceCount () | |
Get number of released resources having this classification assigned to them. More... | |
FullResourceCount () | |
Get number of all resources (minus temporary ones) having this classification assigned to them. More... | |
ParentId () | |
Get ID of parent Classification. More... | |
SegmentName ($NewValue=DB_NOVALUE) | |
Get or set the segment name. More... | |
LinkString ($NewValue=DB_NOVALUE) | |
Get or set the stored link string for the Classification. More... | |
QualifierId ($NewValue=DB_NOVALUE) | |
Get or set the Qualifier associated with the Classification by ID. More... | |
FieldId ($NewValue=DB_NOVALUE) | |
Get or set the ID of the MetadataField for the Classification. More... | |
Qualifier ($NewValue=DB_NOVALUE) | |
Get or set the Qualifier associated with the Classification. More... | |
RecalcDepthAndFullName () | |
Rebuild classification full name and recalculate depth in hierarchy. More... | |
UpdateLastAssigned () | |
Update the LastAssigned timestamp for this classification. More... | |
RecalcResourceCount ($IdsToSkip=NULL) | |
Recalculate number of resources assigned to class and any parent classes. More... | |
ChildCount () | |
Get number of classifications that have this Classification as their direct parent. More... | |
ChildList () | |
Get list of IDs of Classifications that have this class as an "ancestor" (parent, grandparent, great-grandparent, etc). More... | |
Delete ($DeleteParents=FALSE, $DeleteIfHasResources=FALSE, $DeleteIfHasChildren=FALSE) | |
Remove Classification (and accompanying associations) from database. More... | |
![]() | |
__construct ($Id) | |
Constructor, used to load existing items. More... | |
Delete () | |
Destroy item. More... | |
Id () | |
Get item ID. More... | |
Static Public Member Functions | |
static | Create ($Name, $FieldId, $ParentId=NULL) |
Add new classification to the hierarchy. More... | |
static | SegmentsCreated () |
Get number of new segments (Classifications) generated when creating a new Classification with a full name. More... | |
![]() | |
static | GetCanonicalId ($Id) |
Normalize item ID to canonical form. More... | |
static | ItemExists ($Id) |
Check whether an item exists with the specified ID. More... | |
Public Attributes | |
const | NOPARENT = -1 |
Parent value for classifications with no parent. More... | |
Additional Inherited Members | |
![]() | |
UpdateValue ($ColumnName, $NewValue=DB_NOVALUE) | |
Convenience function to supply parameters to Database->UpdateValue(). More... | |
![]() | |
static | CreateWithValues ($Values) |
Create a new item, using specified initial database values. More... | |
static | SetDatabaseAccessValues ($ClassName) |
Set the database access values (table name, ID column name, name column name) for specified class. More... | |
![]() | |
$DB | |
$Id | |
$ItemIdColumnName | |
$ItemNameColumnName | |
$ItemTableName | |
$ValueCache = array() | |
![]() | |
static | $ItemIdColumnNames |
static | $ItemNameColumnNames |
static | $ItemTableNames |
Metadata type representing hierarchical ("Tree") controlled vocabulary values.
Definition at line 13 of file Classification.php.
Classification::ChildCount | ( | ) |
Get number of classifications that have this Classification as their direct parent.
Definition at line 468 of file Classification.php.
References Id().
Referenced by Delete().
Classification::ChildList | ( | ) |
Get list of IDs of Classifications that have this class as an "ancestor" (parent, grandparent, great-grandparent, etc).
Definition at line 482 of file Classification.php.
References Id().
|
static |
Add new classification to the hierarchy.
string | $Name | Full name or segment name for new Classification. Segment name can be used if a parent ID is also supplied, otherwise full name is assumed. |
int | $FieldId | MetadataField ID for new Classification. |
int | $ParentId | ID of parent in hierachy of for new Classification. Use Classification::NOPARENT for new Classification with no parent (i.e. at top level of hierarchy). (OPTIONAL - only required if full classification name is not supplied) |
Definition at line 31 of file Classification.php.
References Item\$DB.
Referenced by Resource_Test\testGetandSet().
Classification::Delete | ( | $DeleteParents = FALSE , |
|
$DeleteIfHasResources = FALSE , |
|||
$DeleteIfHasChildren = FALSE |
|||
) |
Remove Classification (and accompanying associations) from database.
bool | $DeleteParents | Flag indicating whether to also delete Classification entries above this one in the hierarchy. (OPTIONAL
|
bool | $DeleteIfHasResources | Flag indicating whether to delete the Classification if it still has Resources associated with it. (OPTIONAL - defaults to FALSE) |
bool | $DeleteIfHasChildren | Flag indicating whether to delete the Classification if others have it as a parent. (OPTIONAL - defaults to FALSE) |
Definition at line 516 of file Classification.php.
References ChildCount(), Id(), RecalcResourceCount(), and ResourceCount().
Classification::Depth | ( | ) |
Get depth of classification in hierarchy.
Top level is depth of 0.
Definition at line 216 of file Classification.php.
Classification::FieldId | ( | $NewValue = DB_NOVALUE | ) |
Get or set the ID of the MetadataField for the Classification.
int | $NewValue | ID of new MetadataField. |
Definition at line 298 of file Classification.php.
References Item\UpdateValue().
Classification::FullName | ( | ) |
Get full classification name (all segments).
Definition at line 189 of file Classification.php.
Referenced by Name().
Classification::FullResourceCount | ( | ) |
Get number of all resources (minus temporary ones) having this classification assigned to them.
This is only updated by RecalcResourceCount() and Delete().
Definition at line 237 of file Classification.php.
Classification::Id | ( | ) |
Get Classification ID.
Definition at line 180 of file Classification.php.
References Item\$Id.
Referenced by ChildCount(), ChildList(), Delete(), RecalcDepthAndFullName(), RecalcResourceCount(), and UpdateLastAssigned().
Classification::LinkString | ( | $NewValue = DB_NOVALUE | ) |
Get or set the stored link string for the Classification.
(This value is not used, updated, or manipulated in any way by Classification, and is only being stored as a UI optimization.)
string | $NewValue | New link string. |
Definition at line 277 of file Classification.php.
References Item\UpdateValue().
Classification::Name | ( | ) |
Get name of classification segment.
Definition at line 198 of file Classification.php.
References FullName().
Classification::ParentId | ( | ) |
Get ID of parent Classification.
Returns Classification::NOPARENT if no parent (i.e. Classification is at top level of hierarchy).
Definition at line 255 of file Classification.php.
Classification::Qualifier | ( | $NewValue = DB_NOVALUE | ) |
Get or set the Qualifier associated with the Classification.
Definition at line 309 of file Classification.php.
References DB_NOVALUE, and QualifierId().
Classification::QualifierId | ( | $NewValue = DB_NOVALUE | ) |
Get or set the Qualifier associated with the Classification by ID.
int | $NewValue | ID of new Qualifier. |
Definition at line 288 of file Classification.php.
References Item\UpdateValue().
Referenced by Qualifier().
Classification::RecalcDepthAndFullName | ( | ) |
Rebuild classification full name and recalculate depth in hierarchy.
This is a DB-intensive and recursive function, and so should not be called without some forethought.
Definition at line 344 of file Classification.php.
References Id(), and Item\UpdateValue().
Classification::RecalcResourceCount | ( | $IdsToSkip = NULL | ) |
Recalculate number of resources assigned to class and any parent classes.
This is a DB-intensive and recursive function, and so should not be called without some forethought.
array | $IdsToSkip | Classification IDs to skip during recalculation. (OPTIONAL) |
Definition at line 403 of file Classification.php.
References Item\$Id, Id(), and Item\UpdateValue().
Referenced by Delete().
Classification::ResourceCount | ( | ) |
Get number of released resources having this classification assigned to them.
This is only updated by RecalcResourceCount() and Delete().
Definition at line 226 of file Classification.php.
Referenced by Delete().
Classification::SegmentName | ( | $NewValue = DB_NOVALUE | ) |
Get or set the segment name.
string | $NewValue | New segment name. (OPTIONAL) |
Definition at line 265 of file Classification.php.
References Item\UpdateValue().
|
static |
Get number of new segments (Classifications) generated when creating a new Classification with a full name.
Definition at line 246 of file Classification.php.
Classification::UpdateLastAssigned | ( | ) |
Update the LastAssigned timestamp for this classification.
Definition at line 390 of file Classification.php.
References Id().
Classification::VariantName | ( | ) |
Get variant name of classification, if any.
Definition at line 207 of file Classification.php.
const Classification::NOPARENT = -1 |
Parent value for classifications with no parent.
Definition at line 18 of file Classification.php.