Resource Class Reference

Represents a "resource" in CWIS. More...

Public Member Functions

 Resource ($ResourceId=NULL)
 Object constructor.
 Delete ()
 Remove resource (and accompanying associations) from database.
 Status ()
 Retrieve result of last operation if available.
 Id ()
 Retrieve numerical resource ID.
 IsTempResource ($NewSetting=NULL)
 Get/set whether resource is a temporary record.
 Get ($FieldNameOrObject, $ReturnObject=FALSE, $IncludeVariants=FALSE)
 Retrieve value using field name or field object.
 GetByField ($FieldNameOrObject, $ReturnObject=FALSE, $IncludeVariants=FALSE)
 Old method for retrieving values, deprecated in favor of Get().
 GetByFieldId ($FieldId, $ReturnObject=FALSE, $IncludeVariants=FALSE)
 Retrieve value using field ID.
 GetAsArray ($IncludeDisabledFields=FALSE, $ReturnObjects=TRUE)
 GetMapped ($MappedName, $ReturnObject=FALSE, $IncludeVariants=FALSE)
 Retrieve value using standard (mapped) field name.
 GetQualifier ($FieldName, $ReturnObject=TRUE)
 Retrieve qualifier by field name.
 GetQualifierByFieldId ($FieldId, $ReturnObject=TRUE)
 Retrieve qualifier by field ID.
 GetQualifierByField ($Field, $ReturnObject=TRUE)
 Retrieve qualifier by Field object.
 Set ($FieldNameOrObject, $NewValue)
 SetByField ($Field, $NewValue)
 SetByFieldId ($FieldId, $NewValue)
 SetQualifier ($FieldName, $NewValue)
 SetQualifierByFieldId ($FieldId, $NewValue)
 SetQualifierByField ($Field, $NewValue)
 Clear ($FieldName, $ValueToClear=NULL)
 ClearByFieldId ($FieldId, $ValueToClear=NULL)
 ClearByField ($Field, $ValueToClear=NULL)
 Classifications ()
 CumulativeRating ()
 ScaledCumulativeRating ()
 NumberOfRatings ()
 Rating ($NewRating=NULL, $UserId=NULL)
 Comments ()
 NumberOfComments ()
 UserCanEdit ($User)
 UserCanViewField ($User, $FieldOrFieldName)
 UserCanEditField ($User, $FieldOrFieldName)

List of all members.


Detailed Description

Represents a "resource" in CWIS.

Definition at line 14 of file Resource.php.


Member Function Documentation

Resource::Classifications (  )

Definition at line 1330 of file Resource.php.

References Id().

Referenced by Delete().

Here is the caller graph for this function:

Resource::Clear ( FieldName,
ValueToClear = NULL 
)

Definition at line 1129 of file Resource.php.

References ClearByField().

Resource::ClearByFieldId ( FieldId,
ValueToClear = NULL 
)

Definition at line 1136 of file Resource.php.

References ClearByField().

Resource::Comments (  )

Definition at line 1487 of file Resource.php.

References Id().

Resource::CumulativeRating (  )

Definition at line 1359 of file Resource.php.

References CumulativeRating().

Referenced by CumulativeRating(), GetAsArray(), NumberOfRatings(), Resource(), ScaledCumulativeRating(), and SPTOAIItem::SPTOAIItem().

Here is the caller graph for this function:

Resource::Delete (  )

Remove resource (and accompanying associations) from database.

Definition at line 122 of file Resource.php.

References Classifications(), Id(), and MetadataSchema::MDFTYPE_IMAGE.

Resource::Get ( FieldNameOrObject,
ReturnObject = FALSE,
IncludeVariants = FALSE 
)

Retrieve value using field name or field object.

Parameters:
FieldNameOrObjectFull name of field or a Field object.
ReturnObjectFor field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
IncludeVariantsIf TRUE, includes variants in return value. Only applicable for ControlledName fields.
Returns:
Requested object(s) or value(s). Returns empty array (for field types that allow multiple values) or NULL (for field types that do not allow multiple values) if no values found. Returns NULL if field does not exist or was otherwise invalid.
See also:
GetByFieldId

Definition at line 292 of file Resource.php.

References FileFactory::GetFilesForResource(), Id(), MetadataSchema::MDFSTAT_OK, MetadataSchema::MDFTYPE_CONTROLLEDNAME, MetadataSchema::MDFTYPE_DATE, MetadataSchema::MDFTYPE_FILE, MetadataSchema::MDFTYPE_FLAG, MetadataSchema::MDFTYPE_IMAGE, MetadataSchema::MDFTYPE_NUMBER, MetadataSchema::MDFTYPE_OPTION, MetadataSchema::MDFTYPE_PARAGRAPH, MetadataSchema::MDFTYPE_POINT, MetadataSchema::MDFTYPE_TEXT, MetadataSchema::MDFTYPE_TIMESTAMP, MetadataSchema::MDFTYPE_TREE, MetadataSchema::MDFTYPE_URL, and MetadataSchema::MDFTYPE_USER.

Referenced by ClearByField(), GetAsArray(), GetByField(), GetByFieldId(), SPTOAIItem::GetDatestamp(), GetQualifierByField(), SPTOAIItem::GetSets(), and UserCanEditField().

Here is the caller graph for this function:

Resource::GetAsArray ( IncludeDisabledFields = FALSE,
ReturnObjects = TRUE 
)

Definition at line 536 of file Resource.php.

References CumulativeRating(), Get(), GetQualifierByField(), and Id().

Resource::GetByField ( FieldNameOrObject,
ReturnObject = FALSE,
IncludeVariants = FALSE 
)

Old method for retrieving values, deprecated in favor of Get().

See also:
Get

Definition at line 512 of file Resource.php.

References Get().

Resource::GetByFieldId ( FieldId,
ReturnObject = FALSE,
IncludeVariants = FALSE 
)

Retrieve value using field ID.

Parameters:
FieldIdID of field.
ReturnObjectFor field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
IncludeVariantsIf TRUE, includes variants in return value. Only applicable for ControlledName fields.
Returns:
Requested object(s) or value(s). Returns empty array (for field types that allow multiple values) or NULL (for field types that do not allow multiple values) if no values found.
See also:
Get

Definition at line 529 of file Resource.php.

References Get().

Referenced by GetMapped(), and SPTOAIItem::GetValue().

Here is the caller graph for this function:

Resource::GetMapped ( MappedName,
ReturnObject = FALSE,
IncludeVariants = FALSE 
)

Retrieve value using standard (mapped) field name.

Parameters:
MappedNameStandard field name.
ReturnObjectFor field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
IncludeVariantsIf TRUE, includes variants in return value. Only applicable for ControlledName fields. Defaults to FALSE.
Returns:
Requested object(s) or value(s), or NULL if no mapping found. Returns empty array (for field types that allow multiple values) or NULL (for field types that do not allow multiple values) if no values found.
See also:
Get

Definition at line 582 of file Resource.php.

References GetByFieldId().

Resource::GetQualifier ( FieldName,
ReturnObject = TRUE 
)

Retrieve qualifier by field name.

Parameters:
FieldNameFull name of field.
ReturnObjectIf TRUE, return Qualifier objects, else return qualifier IDs. Defaults to TRUE.
Returns:
Array of qualifiers if field supports qualifiers, or NULL if field does not support qualifiers.

Definition at line 596 of file Resource.php.

References GetQualifierByField().

Resource::GetQualifierByField ( Field,
ReturnObject = TRUE 
)

Retrieve qualifier by Field object.

Parameters:
FieldField object.
ReturnObjectIf TRUE, return Qualifier objects, else return qualifier IDs. Defaults to TRUE.
Returns:
Array of qualifiers if field supports qualifiers, or NULL if field does not support qualifiers or field is invalid.

Definition at line 622 of file Resource.php.

References $Items, Get(), MetadataSchema::MDFSTAT_OK, MetadataSchema::MDFTYPE_CONTROLLEDNAME, MetadataSchema::MDFTYPE_OPTION, and MetadataSchema::MDFTYPE_TREE.

Referenced by GetAsArray(), GetQualifier(), and GetQualifierByFieldId().

Here is the caller graph for this function:

Resource::GetQualifierByFieldId ( FieldId,
ReturnObject = TRUE 
)

Retrieve qualifier by field ID.

Parameters:
FieldIdID of field.
ReturnObjectIf TRUE, return Qualifier objects, else return qualifier IDs. Defaults to TRUE.
Returns:
Array of qualifiers if field supports qualifiers, or NULL if field does not support qualifiers.

Definition at line 608 of file Resource.php.

References GetQualifierByField().

Referenced by SPTOAIItem::GetQualifier().

Here is the caller graph for this function:

Resource::Id (  )

Retrieve numerical resource ID.

Returns:
Resource ID.

Definition at line 211 of file Resource.php.

References Id().

Referenced by Classifications(), ClearByField(), Comments(), Delete(), Get(), GetAsArray(), Id(), IsTempResource(), NumberOfComments(), NumberOfRatings(), Rating(), Resource(), and Set().

Here is the caller graph for this function:

Resource::IsTempResource ( NewSetting = NULL )

Get/set whether resource is a temporary record.

Parameters:
NewSettingTRUE/FALSE setting for whether resource is temporary. (OPTIONAL)
Returns:
TRUE if resource is temporary record, or FALSE otherwise.

Definition at line 218 of file Resource.php.

References Id().

Resource::NumberOfComments (  )

Definition at line 1507 of file Resource.php.

References Id().

Resource::NumberOfRatings (  )

Definition at line 1375 of file Resource.php.

References CumulativeRating(), and Id().

Resource::Rating ( NewRating = NULL,
UserId = NULL 
)

Definition at line 1400 of file Resource.php.

References Id().

Resource::Resource ( ResourceId = NULL )

Object constructor.

Parameters:
ResourceIdID of resource to load. New resource is created if no ID is supplied.

Definition at line 23 of file Resource.php.

References CumulativeRating(), Id(), MetadataSchema::MDFTYPE_FLAG, MetadataSchema::MDFTYPE_NUMBER, MetadataSchema::MDFTYPE_OPTION, MetadataSchema::MDFTYPE_POINT, MetadataSchema::MDFTYPE_TIMESTAMP, SetByField(), and MetadataField::UPDATEMETHOD_ONRECORDCREATE.

Resource::ScaledCumulativeRating (  )

Definition at line 1362 of file Resource.php.

References CumulativeRating().

Resource::SetByField ( Field,
NewValue 
)

Definition at line 1076 of file Resource.php.

References Set().

Referenced by Resource().

Here is the caller graph for this function:

Resource::SetByFieldId ( FieldId,
NewValue 
)

Definition at line 1079 of file Resource.php.

References Set().

Resource::SetQualifier ( FieldName,
NewValue 
)

Definition at line 1086 of file Resource.php.

References SetQualifierByField().

Resource::SetQualifierByField ( Field,
NewValue 
)

Definition at line 1100 of file Resource.php.

Referenced by SetQualifier(), and SetQualifierByFieldId().

Here is the caller graph for this function:

Resource::SetQualifierByFieldId ( FieldId,
NewValue 
)

Definition at line 1093 of file Resource.php.

References SetQualifierByField().

Resource::Status (  )

Retrieve result of last operation if available.

Returns:
Result of last operation (if available).

Definition at line 205 of file Resource.php.

Referenced by SPTOAIItem::SPTOAIItem().

Here is the caller graph for this function:

Resource::UserCanEdit ( User )

Definition at line 1529 of file Resource.php.

Resource::UserCanEditField ( User,
FieldOrFieldName 
)

Definition at line 1567 of file Resource.php.

References Get().

Referenced by UserCanViewField().

Here is the caller graph for this function:

Resource::UserCanViewField ( User,
FieldOrFieldName 
)

Definition at line 1539 of file Resource.php.

References UserCanEditField().


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