CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Resource Class Reference

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

## Public Member Functions
| __construct ($ResourceId)
| Object constructor for loading an existing resource. More...
| Delete ()
| Remove resource (and accompanying associations) from database and delete any associated files. More...
| Status ()
| Retrieve result of last operation if available. More...
| Id ()
| Retrieve numerical resource ID. More...
| SchemaId ()
| Retrieve ID of schema for resource. More...
| Schema ()
| Get MetadataSchema for resource. More...
| IsTempResource ($NewSetting=NULL)
| Get/set whether resource is a temporary record. More...
| GetViewPageUrl ()
| Retrieve view page URL for this resource. More...
| Get ($Field, $ReturnObject=FALSE, $IncludeVariants=FALSE)
| Retrieve value using field name or field object. More...
| GetForDisplay ($FieldNameOrObject, $ReturnObject=TRUE, $IncludeVariants=FALSE)
| Retrieve value using field name or field object, signaling EVENT_FIELD_DISPLAY_FILTER to allow other code to possibly modify the value before it's returned. More...
| GetByField ($FieldNameOrObject, $ReturnObject=FALSE, $IncludeVariants=FALSE)
| Old method for retrieving values, deprecated in favor of Get(). More...
| GetByFieldId ($FieldId, $ReturnObject=FALSE, $IncludeVariants=FALSE)
| Retrieve value using field ID. More...
| GetAsArray ($IncludeDisabledFields=FALSE, $ReturnObjects=TRUE)
| Retrieve all resource values as an array. More...
| GetMapped ($MappedName, $ReturnObject=FALSE, $IncludeVariants=FALSE)
| Retrieve value using standard (mapped) field name. More...
| GetQualifier ($FieldName, $ReturnObject=TRUE)
| Retrieve qualifier by field name. More...
| GetQualifierByFieldId ($FieldId, $ReturnObject=TRUE)
| Retrieve qualifier by field ID. More...
| GetQualifierByField ($Field, $ReturnObject=TRUE)
| Retrieve qualifier by Field object. More...
| FieldIsSet ($FieldNameOrObject, $IgnorePadding=FALSE)
| Determine if the value for a field is set. More...
| GetImageUrls ($FieldNameOrObject, $ImageSize=SPTImage::SIZE_FULL)
| Get URLs for images, returning CleanURLs when possible and direct paths to image files otherwise. More...
| Set ($Field, $NewValue, $Reset=FALSE)
| Set value using field name or field object. More...
| SetByField ($Field, $NewValue)
| Method replaced by Resource::Set(), preserved for backward compatibility. More...
| SetByFieldId ($FieldId, $NewValue)
| Set field value using field ID. More...
| SetQualifier ($FieldName, $NewValue)
| Set qualifier using field name. More...
| SetQualifierByFieldId ($FieldId, $NewValue)
| Set qualifier using field ID. More...
| SetQualifierByField ($Field, $NewValue)
| Set qualifier using field object. More...
| ClearByFieldId ($FieldId, $ValueToClear=NULL)
| Clear field value specified by field ID. More...
| Clear ($Field, $ValueToClear=NULL)
| Clear field value. More...
| ClearByField ($Field, $ValueToClear=NULL)
| Clear field value. More...
| Classifications ()
| Get 2D array of classifications associated with resource. More...
| CumulativeRating ()
| Get cumulative rating (range is usually 0-100) More...
| ScaledCumulativeRating ()
| Return cumulative rating scaled to 1/10th. More...
| NumberOfRatings ()
| Get current number of ratings for resource. More...
| Rating ($NewRating=NULL, $UserId=NULL)
| Get/set rating by a specific user for resource. More...
| Comments ()
| Get comments for resource. More...
| NumberOfComments ()
| Get current number of comments for resource. More...
| UserCanView (User $User, $AllowHooksToModify=TRUE)
| Determine if the given user can view the resource, e.g., on the full record page. More...
| UserCanEdit ($User)
| Determine if the given user can edit the resource. More...
| UserCanAuthor ($User)
| Determine if the given user can edit the resource. More...
| UserCanModify ($User)
| Check if the user is allowed to modify (Edit for perm resources, Author for temp) a specified resources. More...
| UserCanViewField ($User, $FieldOrFieldName)
| Check whether user is allowed to view specified metadata field. More...
| UserCanEditField ($User, $FieldOrFieldName)
| Check whether user is allowed to edit specified metadata field. More...
| UserCanAuthorField ($User, $FieldOrFieldName)
| Check whether user is allowed to author specified metadata field. More...
| UserCanModifyField ($User, $FieldOrFieldName)
| Check whether user is allowed to modify (Edit for perm resources, Author for temp) specified metadata field. More...
| QueueSearchAndRecommenderUpdate ()
| Update search and recommender system DBs. More...

## Static Public Member Functions
static | Create ($SchemaId)
| Create a new resource. More...
static | GetSchemaForResource ($ResourceId)
| Get schema ID for specified resource(s). More...

## Protected Attributes
| $DB

## Detailed Description

Represents a "resource" in CWIS.

Definition at line 13 of file Resource.php.

## Constructor & Destructor Documentation

Resource::__construct | ( |  | $ResourceId | ) |

Object constructor for loading an existing resource.

(To create a new resource, use Resource::Create().)

Parameters

  int | $ResourceId | ID of resource to load.

See also
  Create()

Definition at line 24 of file Resource.php.

References CumulativeRating(), Id(), and SchemaId().

## Member Function Documentation

Resource::Classifications | ( |  | ) |

Get 2D array of classifications associated with resource.

Returns
  array Array where first index is classification (field) name, second index is classification ID.

Definition at line 2189 of file Resource.php.

References $DB, and Id().

Referenced by Delete().

Here is the caller graph for this function:

Resource::Clear | ( |  | $Field,
|  |  | $ValueToClear = `NULL`
| ) |  |

Clear field value.

Parameters

  object | $Field | Metadata field.
  mixed | $ValueToClear | Specific value to clear (for fields that support multiple values). (OPTIONAL)

Definition at line 1825 of file Resource.php.

References $DB, SPTImage\ClearImageSymlinksForResource(), Get(), Id(), IsTempResource(), 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_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, MetadataSchema\MDFTYPE_USER, and Schema().

Referenced by ClearByField(), and ClearByFieldId().

Here is the caller graph for this function:

Resource::ClearByField | ( |  | $Field,
|  |  | $ValueToClear = `NULL`
| ) |  |

Clear field value.

DEPRECATED in favor of Clear().

Parameters

  object | $Field | Metadata field.
  mixed | $ValueToClear | Specific value to clear (for fields that support multiple values). (OPTIONAL)

See also
  Resource::Clear()

Deprecated:

Definition at line 2177 of file Resource.php.

References Clear().

Referenced by Set().

Here is the caller graph for this function:

Resource::ClearByFieldId | ( |  | $FieldId,
|  |  | $ValueToClear = `NULL`
| ) |  |

Clear field value specified by field ID.

Parameters

  int | $FieldId | Metadata field ID.
  mixed | $ValueToClear | Specific value to clear (for fields that support multiple values). (OPTIONAL)

Definition at line 1813 of file Resource.php.

References Clear(), and Schema().

Resource::Comments | ( |  | ) |

Get comments for resource.

Returns
  array Comments as Message objects.

Definition at line 2368 of file Resource.php.

References Id().

static Resource::Create | ( |  | $SchemaId | ) |
| static

Create a new resource.

Parameters

  int | $SchemaId | ID of metadata schema for new resource.

Returns
  object Resource object.

Exceptions

  Exception | If resource creation failed.

Definition at line 66 of file Resource.php.

References $DB, Id(), MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, MetadataSchema\MDFTYPE_POINT, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\SCHEMAID_DEFAULT, and MetadataField\UPDATEMETHOD_ONRECORDCREATE.

Referenced by CWUserFactory\CreateNewUser(), ResourceFactory\DuplicateResource(), and Resource_Test\testGetandSet().

Here is the caller graph for this function:

Resource::CumulativeRating | ( |  | ) |

Get cumulative rating (range is usually 0-100)

Returns
  int Rating value.

Definition at line 2222 of file Resource.php.

Referenced by __construct(), GetAsArray(), NumberOfRatings(), and ScaledCumulativeRating().

Here is the caller graph for this function:

Resource::Delete | ( |  | ) |

Remove resource (and accompanying associations) from database and delete any associated files.

Definition at line 169 of file Resource.php.

References $DB, Classifications(), and Id().

Referenced by CWUser\Delete().

Here is the caller graph for this function:

Resource::FieldIsSet | ( |  | $FieldNameOrObject,
|  |  | $IgnorePadding = `FALSE`
| ) |  |

Determine if the value for a field is set.

Parameters

  mixed | $FieldNameOrObject | Full name of field or a Field object.
  bool | $IgnorePadding | Optional flag for ignoring whitespace padding for text, paragraph, number, and URL fields.

Returns
  Returns TRUE if the value is set or FALSE otherwise.

Definition at line 1060 of file Resource.php.

References Get(), 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_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, MetadataSchema\MDFTYPE_USER, and Schema().

Resource::Get | ( |  | $Field,
|  |  | $ReturnObject = `FALSE`,
|  |  | $IncludeVariants = `FALSE`
| ) |  |

Retrieve value using field name or field object.

Parameters

  mixed | $Field | Field ID or full name of field or a Field object.
  bool | $ReturnObject | For field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
  bool | $IncludeVariants | If 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.

Definition at line 416 of file Resource.php.

References FileFactory\GetFilesForResource(), Id(), 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_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, MetadataSchema\MDFTYPE_USER, Schema(), SchemaId(), and Set().

Referenced by Clear(), FieldIsSet(), CWUser\Get(), GetAsArray(), GetByField(), GetByFieldId(), GetForDisplay(), GetImageUrls(), GetMapped(), GetQualifierByField(), and Set().

Here is the caller graph for this function:

Resource::GetAsArray | ( |  | $IncludeDisabledFields = `FALSE`,
|  |  | $ReturnObjects = `TRUE`
| ) |  |

Retrieve all resource values as an array.

Parameters

  bool | $IncludeDisabledFields | Include values for disabled fields. (OPTIONAL, defaults to FALSE)
  bool | $ReturnObjects | If TRUE, an object is returned for field types where appropriate, in the same fashion as Resource::Get() (OPTIONAL, defaults to TRUE)

Returns
  Array of values with field names for array indices. Qualifiers (where available) are returned with an index of the field name with " Qualifier" appended.

See also
  Resource::Get()

Definition at line 834 of file Resource.php.

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

Resource::GetByField | ( |  | $FieldNameOrObject,
|  |  | $ReturnObject = `FALSE`,
|  |  | $IncludeVariants = `FALSE`
| ) |  |

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

Parameters

  mixed | $FieldNameOrObject | Full name of field or a Field object.
  bool | $ReturnObject | For field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
  bool | $IncludeVariants | If 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
  Resource::Get()

Deprecated:

Definition at line 796 of file Resource.php.

References Get().

Resource::GetByFieldId | ( |  | $FieldId,
|  |  | $ReturnObject = `FALSE`,
|  |  | $IncludeVariants = `FALSE`
| ) |  |

Retrieve value using field ID.

Parameters

  int | $FieldId | ID of field.
  bool | $ReturnObject | For field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
  bool | $IncludeVariants | If 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
  Resource::Get()

Deprecated:

Definition at line 816 of file Resource.php.

References Get().

Resource::GetForDisplay | ( |  | $FieldNameOrObject,
|  |  | $ReturnObject = `TRUE`,
|  |  | $IncludeVariants = `FALSE`
| ) |  |

Retrieve value using field name or field object, signaling EVENT_FIELD_DISPLAY_FILTER to allow other code to possibly modify the value before it's returned.

Note that the default for the $ReturnObject parameter is TRUE, which is the opposite of the default for the same parameter to all other Resource::Get*() methods.

Parameters

  mixed | $FieldNameOrObject | Full name of field or a Field object.
  bool | $ReturnObject | For field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. (OPTIONAL, defaults to TRUE)
  bool | $IncludeVariants | If TRUE, includes variants in return value. Only applicable for ControlledName fields. (OPTIONAL, defaults to FALSE)

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
  Resource::Get()

Definition at line 760 of file Resource.php.

References Get(), and Schema().

Resource::GetImageUrls | ( |  | $FieldNameOrObject,
|  |  | $ImageSize = `SPTImage::SIZE_FULL`
| ) |  |

Get URLs for images, returning CleanURLs when possible and direct paths to image files otherwise.

Parameters

  mixed | $FieldNameOrObject | Full field name, FieldId, or a MetadataField object.
  mixed | $ImageSize | Desired size as an SPTImage::SIZE_ constant.

Returns
  array of image URLs, keyed by ImageId

Definition at line 1130 of file Resource.php.

References Get(), Id(), and Schema().

Resource::GetMapped | ( |  | $MappedName,
|  |  | $ReturnObject = `FALSE`,
|  |  | $IncludeVariants = `FALSE`
| ) |  |

Retrieve value using standard (mapped) field name.

Parameters

  string | $MappedName | Standard field name.
  bool | $ReturnObject | For field types that can return multiple values, if TRUE, returns array of objects, else returns array of values. Defaults to FALSE.
  bool | $IncludeVariants | If 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
  Resource::Get()

Definition at line 880 of file Resource.php.

References Get(), and Schema().

Resource::GetQualifier | ( |  | $FieldName,
|  |  | $ReturnObject = `TRUE`
| ) |  |

Retrieve qualifier by field name.

Parameters

  string | $FieldName | Full name of field.
  bool | $ReturnObject | If 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 898 of file Resource.php.

References GetQualifierByField(), and Schema().

Resource::GetQualifierByField | ( |  | $Field,
|  |  | $ReturnObject = `TRUE`
| ) |  |

Retrieve qualifier by Field object.

Parameters

  MetadataField | $Field | Field object.
  bool | $ReturnObject | If 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 926 of file Resource.php.

References $Items, Get(), 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

  int | $FieldId | ID of field.
  int | $ReturnObject | If 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 912 of file Resource.php.

References GetQualifierByField(), and Schema().

static Resource::GetSchemaForResource | ( |  | $ResourceId | ) |
| static

Get schema ID for specified resource(s).

Parameters

  int | $ResourceId | ID of resource or array of IDs of resources.

Returns
  int Schema ID or array of schema IDs indexed by resource ID.

Definition at line 2529 of file Resource.php.

References $DB.

Resource::GetViewPageUrl | ( |  | ) |

Retrieve view page URL for this resource.

Returns
  string view page url

Definition at line 392 of file Resource.php.

References Id(), and Schema().

Resource::Id | ( |  | ) |

Retrieve numerical resource ID.

Returns
  Resource ID.

Definition at line 293 of file Resource.php.

Referenced by __construct(), Classifications(), Clear(), Comments(), Create(), Delete(), Get(), GetAsArray(), GetImageUrls(), GetViewPageUrl(), IsTempResource(), NumberOfComments(), NumberOfRatings(), Rating(), CWUser\ResourceId(), and Set().

Here is the caller graph for this function:

Resource::IsTempResource | ( |  | $NewSetting = `NULL` | ) |

Get/set whether resource is a temporary record.

Parameters

  bool | $NewSetting | TRUE/FALSE setting for whether resource is temporary. (OPTIONAL)

Returns
  TRUE if resource is temporary record, or FALSE otherwise.

Definition at line 322 of file Resource.php.

References $DB, Id(), and SchemaId().

Referenced by Clear(), QueueSearchAndRecommenderUpdate(), and Set().

Here is the caller graph for this function:

Resource::NumberOfComments | ( |  | ) |

Get current number of comments for resource.

Returns
  int Number of comments.

Definition at line 2391 of file Resource.php.

References Id().

Resource::NumberOfRatings | ( |  | ) |

Get current number of ratings for resource.

Returns
  int Ratings count.

Definition at line 2247 of file Resource.php.

References CumulativeRating(), and Id().

Resource::QueueSearchAndRecommenderUpdate | ( |  | ) |

Update search and recommender system DBs.

Definition at line 2512 of file Resource.php.

References IsTempResource().

Resource::Rating | ( |  | $NewRating = `NULL`,
|  |  | $UserId = `NULL`
| ) |  |

Get/set rating by a specific user for resource.

Parameters

  int | $NewRating | New rating value.
  int | $UserId | ID of user rating resource.

Returns
  int Current rating value of resource by user or NULL if user has not rated resource..

Definition at line 2278 of file Resource.php.

References $DB, and Id().

Resource::ScaledCumulativeRating | ( |  | ) |

Return cumulative rating scaled to 1/10th.

(Range is usually 0-10.)

Returns
  int Scaled rating value or NULL if no cumulative rating available.

Definition at line 2231 of file Resource.php.

References CumulativeRating().

Resource::Schema | ( |  | ) |

Get MetadataSchema for resource.

Returns
  object Our schema.

Definition at line 311 of file Resource.php.

Referenced by Clear(), ClearByFieldId(), FieldIsSet(), Get(), GetAsArray(), GetForDisplay(), GetImageUrls(), GetMapped(), GetQualifier(), GetQualifierByFieldId(), GetViewPageUrl(), Set(), SetQualifier(), and SetQualifierByFieldId().

Here is the caller graph for this function:

Resource::SchemaId | ( |  | ) |

Retrieve ID of schema for resource.

Returns
  int Schema ID.

Definition at line 302 of file Resource.php.

Referenced by __construct(), Get(), IsTempResource(), and Set().

Here is the caller graph for this function:

Resource::Set | ( |  | $Field,
|  |  | $NewValue,
|  |  | $Reset = `FALSE`
| ) |  |

Set value using field name or field object.

Parameters

  mixed | $Field | Field ID or full name of field or a Field object.
  mixed | $NewValue | New value for field.
  bool | $Reset | When TRUE Controlled Names, Classifications, and Options will be set to contain ONLY the contents of NewValue, rather than appending $NewValue to the current value.

Exceptions

  Exception | When attempting to set a value for a field that is part of a different schema than the resource.
  InvalidArgumentException | When attempting to set a controlled name with an invalid ID.

Definition at line 1165 of file Resource.php.

References $DB, Classification\CLASSSTAT_OK, ClearByField(), SPTImage\ClearImageSymlinksForResource(), FileFactory\Copy(), Get(), Id(), IsTempResource(), 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_REFERENCE, MetadataSchema\MDFTYPE_TEXT, MetadataSchema\MDFTYPE_TIMESTAMP, MetadataSchema\MDFTYPE_TREE, MetadataSchema\MDFTYPE_URL, MetadataSchema\MDFTYPE_USER, Schema(), SchemaId(), and ControlledName\STATUS_OK.

Referenced by Get(), CWUser\Set(), SetByField(), and SetByFieldId().

Here is the caller graph for this function:

Resource::SetByField | ( |  | $Field,
|  |  | $NewValue
| ) |  |

Method replaced by Resource::Set(), preserved for backward compatibility.

Parameters

  object | $Field | MetadataField object.
  mixed | $NewValue | New value for field.

See also
  Resource::Set()

Deprecated:

Definition at line 1735 of file Resource.php.

References Set().

Resource::SetByFieldId | ( |  | $FieldId,
|  |  | $NewValue
| ) |  |

Set field value using field ID.

Parameters

  int | $FieldId | Metadata field ID.
  mixed | $NewValue | Value to set.

See also
  Resource::Set()

Deprecated:

Definition at line 1747 of file Resource.php.

References Set().

Resource::SetQualifier | ( |  | $FieldName,
|  |  | $NewValue
| ) |  |

Set qualifier using field name.

Parameters

  string | $FieldName | Metadata field name.
  mixed | $NewValue | Qualifier object or ID.

Definition at line 1757 of file Resource.php.

References Schema(), and SetQualifierByField().

Resource::SetQualifierByField | ( |  | $Field,
|  |  | $NewValue
| ) |  |

Set qualifier using field object.

Parameters

  object | $Field | Metadata field.
  mixed | $NewValue | Qualifier object or ID.

Definition at line 1779 of file Resource.php.

Referenced by SetQualifier(), and SetQualifierByFieldId().

Here is the caller graph for this function:

Resource::SetQualifierByFieldId | ( |  | $FieldId,
|  |  | $NewValue
| ) |  |

Set qualifier using field ID.

Parameters

  int | $FieldId | Metadata field ID.
  mixed | $NewValue | Qualifier object or ID.

Definition at line 1768 of file Resource.php.

References Schema(), and SetQualifierByField().

Resource::Status | ( |  | ) |

Retrieve result of last operation if available.

Returns
  Result of last operation (if available).

Definition at line 284 of file Resource.php.

Resource::UserCanAuthor | ( |  | $User | ) |

Determine if the given user can edit the resource.

The result of this method can be modified via the EVENT_RESOURCE_EDIT_PERMISSION_CHECK event.

Parameters

  User | $User | User to check against.

Returns
  bool TRUE if the user can edit the resource and FALSE otherwise

Definition at line 2443 of file Resource.php.

Resource::UserCanAuthorField | ( |  | $User,
|  |  | $FieldOrFieldName
| ) |  |

Check whether user is allowed to author specified metadata field.

Parameters

  User | $User | User to check.
  mixed | $FieldOrFieldName | Field name or object.

Returns
  TRUE if user can author field, otherwise FALSE.

Definition at line 2488 of file Resource.php.

Resource::UserCanEdit | ( |  | $User | ) |

Determine if the given user can edit the resource.

The result of this method can be modified via the EVENT_RESOURCE_EDIT_PERMISSION_CHECK event.

Parameters

  User | $User | User to check against.

Returns
  bool TRUE if the user can edit the resource and FALSE otherwise

Definition at line 2432 of file Resource.php.

Resource::UserCanEditField | ( |  | $User,
|  |  | $FieldOrFieldName
| ) |  |

Check whether user is allowed to edit specified metadata field.

Parameters

  User | $User | User to check.
  mixed | $FieldOrFieldName | Field name or object.

Returns
  TRUE if user can edit field, otherwise FALSE.

Definition at line 2477 of file Resource.php.

Resource::UserCanModify | ( |  | $User | ) |

Check if the user is allowed to modify (Edit for perm resources, Author for temp) a specified resources.

Parameters

  User | $User | User to check.

Returns
  bool TRUE if the user can modify the resource, FALSE otherwise

Definition at line 2454 of file Resource.php.

Resource::UserCanModifyField | ( |  | $User,
|  |  | $FieldOrFieldName
| ) |  |

Check whether user is allowed to modify (Edit for perm resources, Author for temp) specified metadata field.

Parameters

  User | $User | User to check.
  mixed | $FieldOrFieldName | Field name or object.

Returns
  TRUE if user can modify field, otherwise FALSE.

Definition at line 2500 of file Resource.php.

Resource::UserCanView | ( | User | $User,
|  |  | $AllowHooksToModify = `TRUE`
| ) |  |

Determine if the given user can view the resource, e.g., on the full record page.

The result of this method can be modified via the EVENT_RESOURCE_VIEW_PERMISSION_CHECK event.

Parameters

  User | $User | User to check against.
  bool | $AllowHooksToModify | TRUE if hook functions should be allowed to modify the return value (OPTIONAL default TRUE).

Returns
  bool TRUE if the user can view the resource and FALSE otherwise

Definition at line 2421 of file Resource.php.

Resource::UserCanViewField | ( |  | $User,
|  |  | $FieldOrFieldName
| ) |  |

Check whether user is allowed to view specified metadata field.

Parameters

  User | $User | User to check.
  mixed | $FieldOrFieldName | Field name or object.

Returns
  TRUE if user can view field, otherwise FALSE.

Definition at line 2466 of file Resource.php.

## Member Data Documentation

Resource::$DB
| protected

Definition at line 2575 of file Resource.php.

Referenced by Classifications(), Clear(), Create(), Delete(), GetSchemaForResource(), IsTempResource(), Rating(), and Set().

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

- objects/Resource.php