Functions

Function Description
add Adds an entry to the table.
approve Approves a given entry.
archive Archives a given entry.
delete Deletes an entry from the table.
feature Features a given entry.
get Gets a single entry from the table or translates an entry from the table.
getAll Returns all items from the table.
getAllPositioned Returns all entries from the table based on position.
getApproved Returns approved entries from the table.
getArchived Returns archived entries from the table.
getBreadcrumb An optional function to override in your module class.
getByRoute Returns a table entry that has a `route` field matching the given value.
getFeatured Returns featured entries from the table.
getInfo Returns information about a given entry from the module.
getMatching Returns entries from the table that match the key/value pairs.
getNav An optional function to override in your module class.
getNonarchived Returns nonarchived entries from the table.
getPage Returns a page of entries from the table.
getPageCount Returns the number of pages of entries in the table.
getPending Returns an entry from the table with pending changes applied.
getRandom Returns a single (or many) random entries from the table.
getRecent Returns an array of entries from the table that have passed.
getRecentFeatured Returns an array of entries from the table that have passed and are featured.
getRelatedByTags Returns relevant entries from the table that match the given tags.
getSitemap An optional function to override in your module class.
getTagsForItem Returns a list of tags the given table entry has been tagged with.
getUnarchived Returns entries that are not archived from the table.
getUnapproved Returns unapproved entries from the table.
getUpcoming Returns an array of entries from the table that occur in the future.
getUpcomingFeatured Returns an array of entries from the table that occur in the future and are featured.
save Saves the given entry back to the table.
search Returns an array of entries from the table with columns that match the search query.
setPosition Sets the position of a given entry.
unapprove Unapproves a given entry.
unarchive Unarchives a given entry.
unfeature Unfeatures a given entry.
update Updates an entry in the table.

add

Adds an entry to the table.

Return Value: The "id" of the new entry.

add($fields, $values = false, $enforce_unique = false, $ignore_cache = false)
Parameter Description
$fields Either a single column key or an array of column keys (if you pass an array you must pass an array for values as well)
$values Either a signle column value or an array of column values (if you pass an array you must pass an array for fields as well)
$enforce_unique Check to see if this entry is already in the database (prevent duplicates, defaults to false)
$ignore_cache If this is set to true, BigTree will not cache this entry in bigtree_module_view_cache

approve

Approves a given entry.

approve($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

archive

Archives a given entry.

archive($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

delete

Deletes an entry from the table.

delete($item)
Parameter Description
$item The id of the entry to delete or the entry itself.

feature

Features a given entry.

feature($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

get

Gets a single entry from the table or translates an entry from the table.
This method is called on each entry retrieved in every other function in this class so it can be used for additional data transformation overrides in your module class.

Return Value: A translated item from the table.

get($item)
Parameter Description
$item Either the ID of an item to pull from the table or a table entry to parse.

getAll

Returns all items from the table.

Return Value: An array of items from the table.

getAll($order = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$columns The columns to return (defaults to all)

getAllPositioned

Returns all entries from the table based on position.

Return Value: An array of entries from the table.

getAllPositioned($columns = false)
Parameter Description
$columns The columns to retrieve (defaults to all)

getApproved

Returns approved entries from the table.

Return Value: An array of entries from the table.

getApproved($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getArchived

Returns archived entries from the table.

Return Value: An array of entries from the table.

getArchived($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getBreadcrumb

An optional function to override in your module class.
Provides additional breadcrumb segments when <BigTreeCMS.getBreadcrumb> is called on a page with a template that uses this module.

Return Value: An array of arrays with "title" and "link" key/value pairs.

getBreadcrumb($page)
Parameter Description
$page The page data for the current page the user is on.

getByRoute

Returns a table entry that has a `route` field matching the given value.

Return Value: An entry from the table if one is found.

getByRoute($route)
Parameter Description
$route A string to check the `route` field for.

getFeatured

Returns featured entries from the table.

Return Value: An array of entries from the table.

getFeatured($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getInfo

Returns information about a given entry from the module.

Return Value: "status" - Whether this entry has pending changes "changed" or not "published"

getInfo($entry)
Parameter Description
$entry An entry from this module or an id

getMatching

Returns entries from the table that match the key/value pairs.

Return Value: An array of entries from the table.

getMatching($fields, $values, $order = false, $limit = false, $exact = false, $columns = false)
Parameter Description
$fields Either a single column key or an array of column keys (if you pass an array you must pass an array for values as well)
$values Either a signle column value or an array of column values (if you pass an array you must pass an array for fields as well)
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$exact If you want exact matches for NULL, "", and 0, pass true, otherwise 0 = NULL = ""
$columns The columns to retrieve (defaults to all)

getNav

An optional function to override in your module class.
Provides additional navigation children when <BigTreeCMS.getNavByParent> is called on a page with a template that uses this module.

Return Value: An array of arrays with "title" and "link" key/value pairs. Also accepts "children" for sending grandchildren as well.

getNav($page)
Parameter Description
$page The page data for the current page the user is on.

getNonarchived

Returns nonarchived entries from the table.

Return Value: An array of entries from the table.

getNonarchived($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getPage

Returns a page of entries from the table.

Return Value: Array of entries from the table.

getPage($page = 1, $order = "id ASC", $perpage = 15, $where = false, $columns = false)
Parameter Description
$page The page to return
$order The sort order (in MySQL syntax, i.e. "id DESC")
$perpage The number of results per page (defaults to 15)
$where Optional MySQL WHERE conditions
$columns The columns to retrieve (defaults to all)

getPageCount

Returns the number of pages of entries in the table.

Return Value: The number of pages.

getPageCount($perpage = 15, $where = false)
Parameter Description
$perpage The number of results per page (defaults to 15)
$where Optional MySQL WHERE conditions

getPending

Returns an entry from the table with pending changes applied.

Return Value: The entry from the table with pending changes applied.

getPending($id)
Parameter Description
$id The id of the entry in the table, or the id of the pending entry in bigtree_pending_changes prefixed with a "p"

getRandom

Returns a single (or many) random entries from the table.

Return Value: If "count" is passed, an array of entries from the table. Otherwise, a single entry from the table.

getRandom($count = false, $columns = false)
Parameter Description
$count The number of entries to return (if more than one).
$columns The columns to retrieve (defaults to all)

getRecent

Returns an array of entries from the table that have passed.

Return Value: An array of entries from the table.

getRecent($count = 5, $field = "date", $columns = false)
Parameter Description
$count Number of entries to return.
$field Field to use for the date check.
$columns The columns to retrieve (defaults to all)

getRecentFeatured

Returns an array of entries from the table that have passed and are featured.

Return Value: An array of entries from the table.

getRecentFeatured($count = 5, $field = "date", $columns = false)
Parameter Description
$count Number of entries to return.
$field Field to use for the date check.
$columns The columns to retrieve (defaults to all)

getRelatedByTags

Returns relevant entries from the table that match the given tags.

Return Value: An array of entries from the table sorted by most relevant to least.

getRelatedByTags($tags)
Parameter Description
$tags An array of tags to match against.

getSitemap

An optional function to override in your module class.
Provides additional sitemap children when <BigTreeCMS.getNavByParent> is called on a page with a template that uses this module.

Return Value: An array of arrays with "title" and "link" key/value pairs. Should not be a multi level array.

getSitemap($page)
Parameter Description
$page The page data for the current page the user is on.

getTagsForItem

Returns a list of tags the given table entry has been tagged with.

Return Value: An array of tags (strings).

getTagsForItem($item, $full = false)
Parameter Description
$item Either a table entry or the "id" of a table entry.
$full Whether to return a full tag array or only the tag string (defaults to only the tag string)

getUnarchived

Returns entries that are not archived from the table.
Equivalent to getNonarchived.

Return Value: An array of entries from the table.

getUnarchived($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getUnapproved

Returns unapproved entries from the table.

Return Value: An array of entries from the table.

getUnapproved($order = false, $limit = false, $columns = false)
Parameter Description
$order The sort order (in MySQL syntax, i.e. "id DESC")
$limit Max number of entries to return, defaults to all
$columns The columns to retrieve (defaults to all)

getUpcoming

Returns an array of entries from the table that occur in the future.

Return Value: An array of entries from the table.

getUpcoming($count = 5, $field = "date", $columns = false)
Parameter Description
$count Number of entries to return.
$field Field to use for the date check.
$columns The columns to retrieve (defaults to all)

getUpcomingFeatured

Returns an array of entries from the table that occur in the future and are featured.

Return Value: An array of entries from the table.

getUpcomingFeatured($count = 5, $field = "date", $columns = false)
Parameter Description
$count Number of entries to return.
$field Field to use for the date check.
$columns The columns to retrieve (defaults to all)

save

Saves the given entry back to the table.

save($item, $ignore_cache = false)
Parameter Description
$item A modified entry from the table.
$ignore_cache If this is set to true, BigTree will not cache this entry in bigtree_module_view_cache

setPosition

Sets the position of a given entry.

setPosition($item, $position)
Parameter Description
$item The "id" of an entry or an entry from the table.
$position The position to set. BigTree sorts by default as position DESC, id ASC.

unapprove

Unapproves a given entry.

unapprove($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

unarchive

Unarchives a given entry.

unarchive($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

unfeature

Unfeatures a given entry.

unfeature($item)
Parameter Description
$item The "id" of an entry or an entry from the table.

update

Updates an entry in the table.

update($id, $fields, $values = false, $ignore_cache = false)
Parameter Description
$id The "id" of the entry in the table.
$fields Either a single column key or an array of column keys (if you pass an array you must pass an array for values as well) — Optionally this can be a key/value array and the values field kept false
$values Either a signle column value or an array of column values (if you pass an array you must pass an array for fields as well)
$ignore_cache If this is set to true, BigTree will not cache this entry in bigtree_module_view_cache