dmBridge PHP API
DMObject Class Reference

Models a real-world CONTENTdm(R) object (item) - not a PHP object. More...

Inheritance diagram for DMObject:

Public Member Functions

Static Public Member Functions

Data Fields

Protected Member Functions


Detailed Description

Models a real-world CONTENTdm(R) object (item) - not a PHP object.

DMObjects should be instantiated using DMObjectFactory::getObject(). This will ensure that no duplicate objects are instantiated.

Author:
Alex Dolski <alex.dolski@unlv.edu> http://www.opensource.org/licenses/mit-license.php

Definition at line 17 of file DMObject.php.


Constructor & Destructor Documentation

DMObject::__construct ( DMCollection collection,
ptr,
DMDataStore data_store,
DMConfigIni config 
)

Not for public use; to instantiate a DMObject, use DMObjectFactory::getObject() instead.

Parameters:
DMCollectioncollection
intptr
DMDataStoredata_store
DMConfigIniconfig

Definition at line 74 of file DMObject.php.


Member Function Documentation

DMObject::__toString ( )
Returns:
string The DC title of the DMObject (if available), or "alias pointer" if not.
Since:
0.1

Definition at line 87 of file DMObject.php.

DMObject::addComment ( DMComment comment)

Convenience method that appends a new comment to the DMObject.

Parameters:
DMCommentcomment
Returns:
True if the comment was successfully saved; false if not.
Exceptions:
DMDataStoreException
DMPDOException

Definition at line 208 of file DMObject.php.

DMObject::addField ( DMDCElement elem)

Adds a metadata element, or replaces an existing element with the same nick.

This will not be persisted.

Parameters:
DMDCElementelem

Definition at line 340 of file DMObject.php.

DMObject::addRating ( DMRating r)

Appends a new rating to the instance and saves it to the data store.

Parameters:
DMRatingr
Returns:
void
Exceptions:
DMDataStoreException

Definition at line 622 of file DMObject.php.

DMObject::addTag ( DMTag tag)

Convenience method that appends a new tag to the instance and saves it to the data store.

Parameters:
DMTagtag
Returns:
void
Exceptions:
DMDataStoreException

Definition at line 663 of file DMObject.php.

DMObject::equals ( obj)
Parameters:
mixedobj
Returns:
True if the object to be compared has the same collection alias and pointer as the instance; false if not.
Since:
2.0

Definition at line 291 of file DMObject.php.

Referenced by DMSession::addRecentlyViewedObject(), UNLVRandomSQLiteDataStore::isRandomObject(), and UNLVRandomMySQLDataStore::isRandomObject().

static DMObject::exists ( DMCollection col,
ptr 
) [static]
Parameters:
DMCollectioncol
ptr
Returns:
boolean

Definition at line 59 of file DMObject.php.

Referenced by DMObjectFactory::getObject().

DMObject::getCdmURI ( )

Retrieves the URI of the DMObject's item record in CONTENTdm(R).

Use of the object's reference URL (accessible by getReferenceURL()) instead is preferred.

Returns:
string
See also:
getReferenceURL()

Definition at line 106 of file DMObject.php.

DMObject::getChild ( index)

Returns the DMObject corresponding to array index $index (equivalent to page minus 1), or null if none exists.

Parameters:
index
Returns:
DMObject|null
See also:
getChildren()

Definition at line 133 of file DMObject.php.

Referenced by getFileURL(), getFullText(), and getMediaType().

DMObject::getChildren ( )
Returns:
Array of all of the DMObject's child DMObjects in page order, or an empty array if none exist or if the DMObject is not compound.
See also:
getChild()

Definition at line 154 of file DMObject.php.

Referenced by DMSession::addHasCommented(), getChild(), hasChildren(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getCollection ( ) [final]
Returns:
DMCollection The object's parent collection

Definition at line 192 of file DMObject.php.

Referenced by DMObjectView::__construct(), DMObjectResultsView::__construct(), __toString(), DMSession::addFavorite(), DMSession::addHasRated(), UNLVHighlightSQLiteDataStore::addHighlightedObject(), UNLVHighlightMySQLDataStore::addHighlightedObject(), DMPDODataStore::addObjectComment(), DMPDODataStore::addObjectRating(), DMPDODataStore::addObjectTag(), UNLVRandomSQLiteDataStore::addRandomObject(), UNLVRandomMySQLDataStore::addRandomObject(), UNLVSpatialSQLiteDataStore::deleteObject(), UNLVSpatialMySQLDataStore::deleteObject(), equals(), DMPDODataStore::getAllRatingsForObject(), DMPDODataStore::getApprovedCommentsForObject(), getCdmURI(), getChildren(), getCommentsFeedURL(), getFileURL(), getImageURL(), DMPDODataStore::getNumRatingsForObject(), getParent(), DMPDODataStore::getRatingForObject(), getReferenceURL(), getThumbURL(), getURI(), getViewer(), getViewerClassName(), DMSession::hasCommentedOnObject(), DMSession::hasRatedObject(), isCompound(), UNLVSpatialObjectFactory::spatializeObject(), DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), DMXMLRepresentationTransformerV1::transformObjectComments(), DMJSONRepresentationTransformerV1::transformObjectComments(), DMXMLRepresentationTransformerV1::transformObjectRating(), DMJSONRepresentationTransformerV1::transformObjectRating(), DMXMLRepresentationTransformerV1::transformObjectTags(), DMJSONRepresentationTransformerV1::transformObjectTags(), UNLVSpatialSQLiteDataStore::updateObject(), and UNLVSpatialMySQLDataStore::updateObject().

DMObject::getCommentsFeedURL ( )

Retrieves the URI of the feed for the list of object comments.

Returns:
string
Since:
1.1

Definition at line 227 of file DMObject.php.

DMObject::getDateCreated ( )

Retrieves the DMObject's "dmcreated" value from CONTENTdm(R).

Returns:
DMDateTime

Definition at line 255 of file DMObject.php.

Referenced by DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), and DMAtomRepresentationTransformer::transformObject().

DMObject::getDateUpdated ( )

Retrieves the DMObject's "dmmodified" value from CONTENTdm(R).

Returns:
DMDateTime

Definition at line 269 of file DMObject.php.

Referenced by DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), and DMAtomRepresentationTransformer::transformObject().

DMObject::getFeedURI ( )

Convenience method equivalent to calling getURI(DMBridgeComponent::TemplateEngine, "atom").

Returns:
DMInternalURI

Definition at line 320 of file DMObject.php.

DMObject::getField ( nick)
Parameters:
stringnick
Returns:
DMDCElement If $nick is a valid field nickname, returns a DMDCElement object corresponding to the field. If it is not, returns null.

Definition at line 330 of file DMObject.php.

DMObject::getFields ( )

Alias of getMetadata().

Returns:
array An array of all of the DMObject's fields as DMDCElement objects.
See also:
getMetadata()

Definition at line 358 of file DMObject.php.

DMObject::getFilename ( )

Returns the filename of the DMObject, without any path information.

Returns:
string

Definition at line 367 of file DMObject.php.

Referenced by getMediaType(), isURLType(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getFileURL ( )

Returns the URL of the object's file.

Returns:
DMURI

Definition at line 387 of file DMObject.php.

Referenced by getURI(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getFullText ( )

Returns the DMDCElement object corresponding to the object's fulltext field (with nick "full").

If the DMObject is a compound object, returns the fulltext field corresponding to the first page. To avoid this behavior, use getMetadata("full").

Returns:
DMDCElement object, or false if not available
See also:
getMetadata()
Since:
0.1

Definition at line 424 of file DMObject.php.

DMObject::getHeight ( )
Returns:
The height of the DMObject's image, if applicable.

Definition at line 442 of file DMObject.php.

Referenced by getImageURL(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getImageURL ( maxwidth,
maxheight,
x = 0,
y = 0,
rotate = 0 
)
Parameters:
intmaxwidth
intmaxheight
intx X offset
inty Y offset
introtate
Returns:
string Absolute URL of the DMObject's image with dimensions and orientation corresponding to the supplied parameters, or false if the height/width of the image are 0 (such as would be the case if it did not have one).

Definition at line 468 of file DMObject.php.

Referenced by DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getMediaType ( )

Returns a best guess at the file's media (MIME) type.

The guess is based exclusively on the file's filename extension, as the CONTENTdm(R) PHP API does not supply media type information. If the media type cannot be guessed, returns a media type of "unknown/unknown".

Returns:
DMMediaType

Definition at line 540 of file DMObject.php.

Referenced by getViewer(), getViewerClassName(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::getMetadata ( nick = null)
Parameters:
stringnick
Returns:
If $nick is supplied and a valid field nickname, returns a DMDCElement object corresponding to the field. If it is supplied but not valid, returns null. If it is not supplied, returns an array of all of the DMObject's fields, as DMDCElement objects.
See also:
getField()

Definition at line 517 of file DMObject.php.

Referenced by __toString(), getField(), getFields(), getFullText(), UNLVSpatialObjectFactory::spatializeObject(), DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), DMAtomRepresentationTransformer::transformObject(), and DMAtomRepresentationTransformer::transformObjectComments().

DMObject::getPage ( )
Returns:
int

Definition at line 574 of file DMObject.php.

Referenced by getFileURL(), and DMXMLRepresentationTransformerV1::transformObject().

DMObject::getPtr ( )
Returns:
int

Definition at line 604 of file DMObject.php.

Referenced by __toString(), DMSession::addFavorite(), DMSession::addHasRated(), UNLVHighlightSQLiteDataStore::addHighlightedObject(), UNLVHighlightMySQLDataStore::addHighlightedObject(), DMPDODataStore::addObjectComment(), DMPDODataStore::addObjectRating(), DMPDODataStore::addObjectTag(), UNLVRandomSQLiteDataStore::addRandomObject(), UNLVRandomMySQLDataStore::addRandomObject(), UNLVSpatialSQLiteDataStore::deleteObject(), UNLVSpatialMySQLDataStore::deleteObject(), equals(), DMPDODataStore::getAllRatingsForObject(), DMPDODataStore::getApprovedCommentsForObject(), getCdmURI(), getChildren(), getCommentsFeedURL(), getFileURL(), getImageURL(), DMPDODataStore::getNumRatingsForObject(), getParent(), DMPDODataStore::getRatingForObject(), getReferenceURL(), getThumbURL(), getURI(), DMSession::hasCommentedOnObject(), DMSession::hasRatedObject(), isCompound(), UNLVSpatialObjectFactory::spatializeObject(), DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), DMXMLRepresentationTransformerV1::transformObjectComments(), DMJSONRepresentationTransformerV1::transformObjectComments(), DMXMLRepresentationTransformerV1::transformObjectRating(), DMJSONRepresentationTransformerV1::transformObjectRating(), DMXMLRepresentationTransformerV1::transformObjectTags(), DMJSONRepresentationTransformerV1::transformObjectTags(), UNLVSpatialSQLiteDataStore::updateObject(), and UNLVSpatialMySQLDataStore::updateObject().

DMObject::getRating ( out_of = 100,
decimal_places = 10 
)

Retrieves the DMObject's rating from the data store, as a float.

Parameters:
intout_of
intdecimal_places
Returns:
float
Exceptions:
DMDataStoreException

Definition at line 634 of file DMObject.php.

Referenced by DMXMLRepresentationTransformerV1::transformObject(), DMJSONRepresentationTransformerV1::transformObject(), DMXMLRepresentationTransformerV1::transformObjectRating(), and DMJSONRepresentationTransformerV1::transformObjectRating().

DMObject::getThumbnailURL ( )
DMObject::getThumbURL ( )

Returns an absolute URL of the DMObject's thumbnail image.

Returns:
string

Definition at line 672 of file DMObject.php.

Referenced by getThumbnailURL(), and DMAtomRepresentationTransformer::transformObject().

DMObject::getTitle ( )

Returns the DMObject's page title, which may be different from the metadata title returned by DMObject::getField() or getMetadata().

See also:
getField()
getMetadata()

Definition at line 698 of file DMObject.php.

Referenced by DMXMLRepresentationTransformerV1::transformObject().

DMObject::getURI ( component = DMBridgeComponent::TemplateEngine,
representation = null,
resolve_links = true 
)
Parameters:
intcomponent One of the constants in DMBridgeComponent.
stringrepresentation An optional alternate representation such as "atom". The default is HTML.
booleanresolve_links If true, returns the URL of a "URL object." If false, returns its physical URI in dmBridge. Affects only objects that were created as "URL"-type objects in CONTENTdm(R). Supplying false for this parameter is not recommended in the template engine because it will link to an object view page that might have otherwise never been seen.
Returns:
DMURI The absolute URI of the instance within the given component and with the given representation.
Since:
2.0

Definition at line 721 of file DMObject.php.

Referenced by DMAtomRepresentationTransformer::transformObject(), DMXMLRepresentationTransformerV1::transformObjectComments(), DMJSONRepresentationTransformerV1::transformObjectComments(), DMAtomRepresentationTransformer::transformObjectComments(), DMXMLRepresentationTransformerV1::transformObjectRating(), DMJSONRepresentationTransformerV1::transformObjectRating(), DMXMLRepresentationTransformerV1::transformObjectTags(), and DMJSONRepresentationTransformerV1::transformObjectTags().

DMObject::getViewer ( width_override = null,
height_override = null 
)
Parameters:
intwidth_override
intheight_override
Returns:
DMObjectViewerDelegate

Definition at line 757 of file DMObject.php.

Referenced by DMObjectView::__construct().

DMObject::getViewerClassName ( )
Returns:
string

Definition at line 783 of file DMObject.php.

DMObject::getWidth ( )
Returns:
int The width of the dmObject's image, if applicable.

Definition at line 799 of file DMObject.php.

Referenced by getImageURL(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::hasChildren ( ) [final]

Returns true if the object is compound and has children, or false if it is either not compound, or has no children.

Returns:
Boolean
See also:
isCompound()

Definition at line 185 of file DMObject.php.

Referenced by getFullText().

DMObject::hasComments ( )
Returns:
Boolean True if the object has at least one approved comment, or false if not

Definition at line 216 of file DMObject.php.

DMObject::isChild ( )
Returns:
Boolean

Definition at line 144 of file DMObject.php.

Referenced by DMSession::addHasCommented(), getCdmURI(), and getFileURL().

DMObject::isCompound ( )

Whether the object is compound, even if it has no pages.

Returns:
Boolean

Definition at line 238 of file DMObject.php.

Referenced by DMSession::addHasCommented(), getCdmURI(), getFileURL(), getMediaType(), DMXMLRepresentationTransformerV1::transformObject(), and DMJSONRepresentationTransformerV1::transformObject().

DMObject::isFavorite ( )

Checks whether the DMObject is in the user's favorites.

Returns:
Boolean
Since:
0.1

Definition at line 304 of file DMObject.php.

DMObject::isURLType ( )
Returns:
boolean Whether the instance is a "URL-type" object.

Definition at line 747 of file DMObject.php.

Referenced by getURI().

DMObject::setDateUpdated ( DMDateTime date) [protected]
Parameters:
DMDateTimedate

Definition at line 281 of file DMObject.php.

Referenced by getDateUpdated().

DMObject::setFilename ( filename) [protected]
Parameters:
stringfilename
Since:
0.1

Definition at line 378 of file DMObject.php.

DMObject::setHeight ( int) [protected]
Parameters:
intint
Since:
0.1

Definition at line 453 of file DMObject.php.

DMObject::setWidth ( int) [protected]
Parameters:
intint

Definition at line 809 of file DMObject.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables