public
|
#
__construct( TfValidator $validator, TfDatabase $db, TfCriteriaFactory $criteriaFactory, TfFileHandler $fileHandler, TfTaglinkHandler $taglinkHandler )
Constructor.
Parameters
- $validator
- An instance of the Tuskfish data validator class.
- $db
- An instance of the database class.
- $criteriaFactory
- an instance of the Tuskfish criteria factory class.
- $fileHandler
- An instance of the Tuskfish file handler class.
- $taglinkHandler
- An instance of the Tuskfish taglink handler class.
|
public
object|boolean
|
#
convertRowToObject( array $row )
Convert a database content row to a corresponding content object.
Convert a database content row to a corresponding content object.
Only use this function to convert single objects, as it does a separate query to look up
the associated taglinks. Running it through a loop will therefore consume a lot of resources.
To convert multiple objects, load them directly into the relevant class files, prepare a
buffer of tags using getTags() and loop through the objects referring to the buffer rather
than hitting the database every time.
Parameters
- $row
- Array of result set from database.
Returns
object|boolean Content object on success, false on failure.
|
protected
array
|
#
loadTagsForObject( integer $id )
Returns an array of tag IDs for a given content object.
Returns an array of tag IDs for a given content object.
Parameters
- $id
- ID of content object.
Returns
array Array of tag IDs.
|
public
boolean
|
#
delete( integer $id )
Delete a single object from the content table.
Delete a single object from the content table.
Parameters
- $id
- ID of content object to delete.
Returns
boolean True on success, false on failure.
|
public
boolean
|
#
deleteParentalReferences( integer $id )
Removes references to a collection when it is deleted or changed to another type.
Removes references to a collection when it is deleted or changed to another type.
Parameters
- $id
- ID of the parent collection.
Returns
boolean True on success, false on failure.
|
public
boolean
|
#
insert( TfContentObject $obj )
Inserts a content object into the database.
Inserts a content object into the database.
Note that content child content classes that have unset unused properties from the parent
should reset them to null before insertion or update. This is to guard against the case
where the admin reassigns the type of a content object - it makes sure that unused properties
are zeroed in the database.
Parameters
- $obj
- A content object subclass.
Returns
boolean True on success, false on failure.
|
public
boolean
|
#
isSanctionedType( string $type )
Checks if a class name is a sanctioned subclass of TfContentObject.
Checks if a class name is a sanctioned subclass of TfContentObject.
Basically this just checks if the class name is whitelisted.
Parameters
- $type
- Type of content object.
Returns
boolean True if sanctioned type otherwise false.
|
public
array|boolean
|
#
getActiveTagList( string $module = null, string $type = null, boolean $onlineOnly = true )
Get a list of tags actually in use by other content objects, optionally filtered by module
and / or type.
Get a list of tags actually in use by other content objects, optionally filtered by module
and / or type.
Used primarily to build select box controls. Use $onlineOnly to select only those tags that
are marked as online (true), or all tags (false).
Parameters
- $module
- Restrict to tags from a certain module.
- $type
- Type of content object (subclass name).
- $onlineOnly
- True if marked as online, false if marked as offline.
Returns
array|boolean List of tags if available, false if empty.
|
public
integer
|
#
getCount( TfCriteria $criteria = null )
Count content objects optionally matching conditions specified with a TfCriteria object.
Count content objects optionally matching conditions specified with a TfCriteria object.
Parameters
- $criteria
- Query composer object used to build conditional database query.
Returns
integer $count Number of objects matching conditions.
|
public
array
|
#
getListOfMimetypes( )
Return a list of mimetypes.
Return a list of mimetypes.
This list is not exhaustive, but it does cover most things that a sane person would want.
Feel free to add more if you wish, but do NOT use this as a whitelist of permitted mimetypes,
it is just a reference.
Returns
array Array of mimetypes with extension as key.
Copyright
The ImpressCMS Project http://www.impresscms.org/
License
Author
|
public
array
|
#
getListOfTitles( TfCriteria $criteria = null )
Returns a list of content object titles with ID as key.
Returns a list of content object titles with ID as key.
Parameters
- $criteria
- Query composer object used to build conditional database query.
Returns
array Array as id => title of content objects.
|
public
TfContentObject |boolean
|
#
getObject( integer $id )
Retrieves a single content object based on its ID.
Retrieves a single content object based on its ID.
Parameters
- $id
- ID of content object.
Returns
TfContentObject |boolean $object Content object on success, false on failure.
|
public
array
|
#
getObjects( TfCriteria $criteria = null )
Get content objects, optionally matching conditions specified with a TfCriteria object.
Get content objects, optionally matching conditions specified with a TfCriteria object.
Parameters
- $criteria
- Query composer object used to build conditional database query.
Returns
array Array of content objects.
|
public
string
|
#
getOnlineSelectBox( integer $selected = null, string $zeroOption = TFISH_ONLINE_STATUS )
Generates an online/offline select box.
Generates an online/offline select box.
Parameters
- $selected
- The currently option.
- $zeroOption
- The text to display in the zero option of the select box.
Returns
string HTML select box.
|
public
array
|
#
getTagList( boolean $onlineOnly = true )
Get an array of all tag objects in $id => $title format.
Get an array of all tag objects in $id => $title format.
Parameters
- $onlineOnly
- tags marked online only.
Returns
array Array of tag IDs and titles.
|
public
array
|
#
getTags( )
Get an array of all tag objects.
Get an array of all tag objects.
Use this function when you need to build a buffer of tags to reduce database queries, for
example when looping through a result set.
Returns
array Array of TfTag objects.
|
protected
integer|null
|
#
getTypeIndex( array $criteriaItems )
Search the filtering criteria ($criteria->items) to see if object type has been set and
return the key.
Search the filtering criteria ($criteria->items) to see if object type has been set and
return the key.
Parameters
- $criteriaItems
- Array of TfCriteriaItem objects.
Returns
integer|null Key of relevant TfCriteriaItem or null.
|
public
string
|
#
getTypeSelectBox( string $selected = '', string $zeroOption = null )
Get a content type select box.
Get a content type select box.
Parameters
- $selected
- Currently selected option.
- $zeroOption
- The default text to show at top of select box.
Returns
string HTML select box.
|
public
array
|
#
makeTagLinks( array $tags, string $targetFilename = '' )
Converts an array of tagIds into an array of tag links with an arbitrary local target file.
Converts an array of tagIds into an array of tag links with an arbitrary local target file.
Note that the filename may only consist of alphanumeric characters and underscores. Do not
include the file extension (eg. use 'article' instead of 'article.php'. The base URL of the
site will be prepended and .php plus the tagId will be appended.
Parameters
- $tags
- Array of tag IDs.
- $targetFilename
- Name of file for tag links to point at.
Returns
array Array of HTML tag links.
|
public
boolean
|
#
streamDownloadToBrowser( integer $id, string $filename = '' )
Initiate streaming of a downloadable media file associated with a content object.
Initiate streaming of a downloadable media file associated with a content object.
DOES NOT WORK WITH COMPRESSION ENABLED IN OUTPUT BUFFER. This method acts as an intermediary
to provide access to uploaded file resources that reside outside of the web root, while
concealing the real file path and name. Use this method to provide safe user access to
uploaded files. If anything nasty gets uploaded nobody will be able to execute it directly
through the browser.
Parameters
- $id
- ID of the associated content object.
- $filename
An alternative name (rename) for the file you wish to transfer,
excluding extension.
Returns
boolean True on success, false on failure.
|
public
boolean
|
#
toggleOnlineStatus( integer $id )
Toggle the online status of a content object.
Toggle the online status of a content object.
Parameters
- $id
- ID of content object.
Returns
boolean True on success, false on failure.
|
public
boolean
|
#
update( TfContentObject $obj )
Updates a content object in the database.
Updates a content object in the database.
Parameters
- $obj
- A content object subclass.
Returns
boolean True on success, false on failure.
|
public
|
#
updateCounter( integer $id )
Increment a given content object counter field by one.
Increment a given content object counter field by one.
Parameters
- $id
- ID of content object.
|