Listing
class Listing implements Listable
ViewModel for displaying a list of content objects.
Traits
Methods
Returns a list of template names used by specific content types.
Sets the sort type (ascending or descending) for the primary order column of a result set.
Sets the sort type (ascending or descending) for the secondary order column of a result set.
Set page-specific overrides of the site metadata.
URL-encode and escape a query string for use in a URL.
Check that a string is comprised solely of alphanumeric characters.
Check that a string is comprised solely of alphanumeric characters and underscores.
Check that a string is comprised solely of alphabetical characters.
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Constructor.
Display list of content in short (teaser) form.
Display a single content object.
Return IDs and titles of tags that are actually in use with content objects.
Return canonical URL for this page view.
Return a collection of tags.
Count content objects meeting filter criteria.
Return tags associated with a content object.
Return extra parameters to be included in pagination control links.
Get a content object.
Return user-side pagination limit.
Get children of a content object (collection or tag).
Get content objects matching cached filter criteria.
Return the backUrl.
Return children.
Return content count.
Return content list.
Returns the template for formatting the date from preferences.
Return ID.
Set ID.
Returns the Google Maps API key (if set) from preferences.
Return start.
Set start.
Return tag ID.
Set tag ID.
Return type.
Set type.
Return online status.
Return the response message (success or failure) for an action.
Details
in ContentTypes at line 36
array
listTemplates()
Returns a list of template names used by specific content types.
in ContentTypes at line 62
array
listTypes()
Returns a whitelist of permitted content object types.
Use this whitelist when dynamically instantiating content objects. If you create additional types of content object (which must be descendants of the TfContentObject class) you must add them to the whitelist below. Otherwise their use will be denied in many parts of the Tuskfish system.
in Listable at line 46
setOrder(string $field)
Sets the primary column to order query results by.
in Listable at line 56
setOrderType(string $orderType)
Sets the sort type (ascending or descending) for the primary order column of a result set.
in Listable at line 66
setSecondaryOrder(string $field)
Sets the secondary column to order query results by.
in Listable at line 76
setSecondaryOrderType(string $orderType)
Sets the sort type (ascending or descending) for the secondary order column of a result set.
in Listable at line 88
string
pageTitle()
Return title of this page.
in Listable at line 98
setPageTitle(string $pageTitle)
Set the title of this page.
in Listable at line 118
setTemplate(string $template)
Set the template used by this page.
in Listable at line 135
string
theme()
Return the theme used by this page.
in Listable at line 147
setTheme(string $theme)
Set (change) the theme.
You must ensure that the new theme directory contains the HTML template files that you need.
in Listable at line 164
array
metadata()
Return page-specific metadata overrides.
at line 513
setMetadata(array $metadata = [])
Set page-specific overrides of the site metadata.
Overrides trait setMetadata().
in ValidateString at line 41
string
encodeEscapeUrl(string $url)
URL-encode and escape a query string for use in a URL.
Trims, checks for UTF-8 compliance, rawurlencodes and then escapes with htmlspecialchars(). If you wish to use the data on a landing page you must decode it with htmlspecialchars_decode() followed by rawurldecode() in that order. But really, if you are using any characters that need to be encoded in the first place you should probably just stop.
in ValidateString at line 59
bool
isAlnum(string $alnum)
Check that a string is comprised solely of alphanumeric characters.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 77
bool
isAlnumUnderscore(string $alnumUnderscore)
Check that a string is comprised solely of alphanumeric characters and underscores.
Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 95
bool
isAlpha(string $alpha)
Check that a string is comprised solely of alphabetical characters.
Tolerates vanilla ASCII only. Accented regional characters are rejected. This method is designed to be used to check database identifiers or object property names.
in ValidateString at line 113
bool
isUtf8(string $text)
Check if the character encoding of text is UTF-8.
All strings received from external sources must be passed through this function, particularly prior to storage in the database.
in ValidateString at line 131
string
trimString(mixed $text)
Cast to string, check UTF-8 encoding and strip trailing whitespace and control characters.
Removes trailing whitespace and control characters (ASCII <= 32 / UTF-8 points 0-32 inclusive), checks for UTF-8 character set and casts input to a string. Note that the data returned by this function still requires escaping at the point of use; it is not database or XSS safe.
As the input is cast to a string do NOT apply this function to non-string types (int, float, bool, object, resource, null, array, etc).
at line 75
__construct(object $model)
Constructor.
at line 86
displayList()
Display list of content in short (teaser) form.
at line 98
displayObject()
Display a single content object.
at line 128
array
activeTagOptions(string $zeroOption = TFISH_SELECT_TAGS)
Return IDs and titles of tags that are actually in use with content objects.
at line 143
string
canonicalUrl()
Return canonical URL for this page view.
Used to populate the canonical link tag in theme files.
at line 168
array
collectionTagOptions(int $id, string $zeroOption = TFISH_SELECT_TAGS)
Return a collection of tags.
Retrieves tags that have been grouped into a collection as ID-title key-value pairs. Used to build select box controls.
at line 179
countContent()
Count content objects meeting filter criteria.
at line 203
array
contentTags()
Return tags associated with a content object.
at line 215
array
extraParams()
Return extra parameters to be included in pagination control links.
at line 241
getObject(int $id)
Get a content object.
at line 251
int
limit()
Return user-side pagination limit.
at line 261
array
listChildren()
Get children of a content object (collection or tag).
at line 284
listContent()
Get content objects matching cached filter criteria.
Result is cached as $contentList property.
at line 331
string
backUrl()
Return the backUrl.
If the cancel button is clicked, the user will be redirected to the backUrl.
at line 341
array
children()
Return children.
at line 351
Content
content()
Return content object.
at line 361
int
contentCount()
Return content count.
at line 371
array
contentList()
Return content list.
at line 379
string
dateFormat()
Returns the template for formatting the date from preferences.
at line 389
int
id()
Return ID.
at line 399
setId(int $id)
Set ID.
at line 409
string
mapsApiKey()
Returns the Google Maps API key (if set) from preferences.
at line 419
Content
parent()
Return parent of a content object.
at line 429
int
start()
Return start.
at line 439
setStart(int $start)
Set start.
at line 449
int
tag()
Return tag ID.
at line 459
setTag(int $tag)
Set tag ID.
at line 469
string
type()
Return type.
at line 481
setType(string $type)
Set type.
Filter list by content type.
at line 491
int
onlineStatus()
Return online status.
at line 501
string
response()
Return the response message (success or failure) for an action.