CWIS Developer Documentation
Public Member Functions | Public Attributes | List of all members
Classification Class Reference

Metadata type representing hierarchical ("Tree") controlled vocabulary values. More...

Public Member Functions

 __construct ($ClassId, $Name=NULL, $FieldId=NULL, $ParentId=NULL)
 Class constructor. More...
 
 Status ()
 Returns success/failure code for last call (where applicable). More...
 
 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...
 
 SegmentsCreated ()
 Get number of new segments (Classifications) generated when creating a new Classification with a full name. 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...
 

Public Attributes

const CLASSSTAT_OK = 0
 Status code indicating operation completed successfully. More...
 
const CLASSSTAT_INVALIDID = 1
 Status code indicating an invalid classification ID was specified. More...
 
const CLASSSTAT_INVALIDPARENTID = 2
 Status code indicating an invalid parent classification ID was specified. More...
 
const CLASSSTAT_DUPLICATENAME = 3
 Status code indicating a duplicate classification name was specified. More...
 

Detailed Description

Metadata type representing hierarchical ("Tree") controlled vocabulary values.

Definition at line 13 of file Classification.php.

Constructor & Destructor Documentation

Classification::__construct (   $ClassId,
  $Name = NULL,
  $FieldId = NULL,
  $ParentId = NULL 
)

Class constructor.

This can be used both to access an existing classification or to add a new classification to a hierarchy. For existing classifications specify just the Classification ID. For new classifications, pass in NULL for the Classification ID, and specify all of the other parameters.

Parameters
int | null$ClassIdID of Classification. Use NULL to create a new Classification.
string$NameFull name or segment name for new Classification. Segment name can be used if a parent ID is also supplied, otherwise full name is assumed. (OPTIONAL)
int$FieldIdMetadataField ID for new Classification. (OPTIONAL)
int$ParentIdID of parent in hierachy of for new Classification. Use -1 for new Classification with no parent (i.e. at top level of hierarchy). (OPTIONAL)

Definition at line 43 of file Classification.php.

References Id(), and SegmentsCreated().

Member Function Documentation

Classification::ChildCount ( )

Get number of classifications that have this Classification as their direct parent.

Returns
Count of child Classifications.

Definition at line 562 of file Classification.php.

References Id().

Referenced by Delete().

Here is the caller graph for this function:

Classification::ChildList ( )

Get list of IDs of Classifications that have this class as an "ancestor" (parent, grandparent, great-grandparent, etc).

Returns
Array of child/grandchild/etc Classification IDs.

Definition at line 576 of file Classification.php.

References Id().

Classification::Delete (   $DeleteParents = FALSE,
  $DeleteIfHasResources = FALSE,
  $DeleteIfHasChildren = FALSE 
)

Remove Classification (and accompanying associations) from database.

Parameters
bool$DeleteParentsFlag indicating whether to also delete Classification entries above this one in the hierarchy. (OPTIONAL
  • defaults to FALSE)
bool$DeleteIfHasResourcesFlag indicating whether to delete the Classification if it still has Resources associated with it. (OPTIONAL - defaults to FALSE)
bool$DeleteIfHasChildrenFlag indicating whether to delete the Classification if others have it as a parent. (OPTIONAL - defaults to FALSE)

Definition at line 609 of file Classification.php.

References ChildCount(), Id(), RecalcResourceCount(), and ResourceCount().

Classification::Depth ( )

Get depth of classification in hierarchy.

Top level is depth of 0.

Returns
Depth in hierarchy.

Definition at line 288 of file Classification.php.

Classification::FieldId (   $NewValue = DB_NOVALUE)

Get or set the ID of the MetadataField for the Classification.

Parameters
int$NewValueID of new MetadataField.
Returns
ID of currently associated MetadataField.

Definition at line 370 of file Classification.php.

Classification::FullName ( )

Get full classification name (all segments).

Returns
Classification name.

Definition at line 261 of file Classification.php.

Referenced by Name().

Here is the caller graph for this function:

Classification::FullResourceCount ( )

Get number of all resources (minus temporary ones) having this classification assigned to them.

This is only updated by RecalcResourceCount() and Delete().

Returns
Count of all resources having this classification.

Definition at line 309 of file Classification.php.

Classification::Id ( )

Get Classification ID.

Returns
Numerical Classification ID.

Definition at line 252 of file Classification.php.

Referenced by __construct(), ChildCount(), ChildList(), Delete(), RecalcDepthAndFullName(), RecalcResourceCount(), and UpdateLastAssigned().

Here is the caller graph for this function:

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.)

Parameters
string$NewValueNew link string.
Returns
Current link string.

Definition at line 349 of file Classification.php.

Classification::Name ( )

Get name of classification segment.

Returns
Segment name.

Definition at line 270 of file Classification.php.

References FullName().

Classification::ParentId ( )

Get ID of parent Classification.

Returns -1 if no parent (i.e. Classification is at top level of hierarchy).

Definition at line 327 of file Classification.php.

Classification::Qualifier (   $NewValue = DB_NOVALUE)

Get or set the Qualifier associated with the Classification.

Parameters
Qualifier$NewValueNew Qualifier.
Returns
Associated Qualifier (object) or NULL if no qualifier.
See also
Classification::QualifierId()

Definition at line 381 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.

Parameters
int$NewValueID of new Qualifier.
Returns
ID of current Qualifier.
See also
Classifiaction::Qualifier()

Definition at line 360 of file Classification.php.

Referenced by Qualifier().

Here is the caller graph for this function:

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 416 of file Classification.php.

References Id().

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.

Parameters
array$IdsToSkipClassification IDs to skip during recalculation. (OPTIONAL)
Returns
Array of IDs of the Classifications that were updated.

Definition at line 482 of file Classification.php.

References Id().

Referenced by Delete().

Here is the caller graph for this function:

Classification::ResourceCount ( )

Get number of released resources having this classification assigned to them.

This is only updated by RecalcResourceCount() and Delete().

Returns
Count of released resources having this classification.

Definition at line 298 of file Classification.php.

Referenced by Delete().

Here is the caller graph for this function:

Classification::SegmentName (   $NewValue = DB_NOVALUE)

Get or set the segment name.

Parameters
string$NewValueNew segment name. (OPTIONAL)
Returns
Segment name.

Definition at line 337 of file Classification.php.

Classification::SegmentsCreated ( )

Get number of new segments (Classifications) generated when creating a new Classification with a full name.

Definition at line 318 of file Classification.php.

Referenced by __construct().

Here is the caller graph for this function:

Classification::Status ( )

Returns success/failure code for last call (where applicable).

Returns
Status code.

Definition at line 243 of file Classification.php.

Classification::UpdateLastAssigned ( )

Update the LastAssigned timestamp for this classification.

Definition at line 469 of file Classification.php.

References Id().

Classification::VariantName ( )

Get variant name of classification, if any.

Returns
Variant name.

Definition at line 279 of file Classification.php.

Member Data Documentation

const Classification::CLASSSTAT_DUPLICATENAME = 3

Status code indicating a duplicate classification name was specified.

Definition at line 25 of file Classification.php.

const Classification::CLASSSTAT_INVALIDID = 1

Status code indicating an invalid classification ID was specified.

Definition at line 21 of file Classification.php.

const Classification::CLASSSTAT_INVALIDPARENTID = 2

Status code indicating an invalid parent classification ID was specified.

Definition at line 23 of file Classification.php.

const Classification::CLASSSTAT_OK = 0

Status code indicating operation completed successfully.

Definition at line 19 of file Classification.php.

Referenced by ClassificationFactory\RecalculateResourceCount(), and Resource\Set().


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