Functions

Function Description
cacheNewItem Caches a new database entry by investigating associated views.
cacheRecord Caches a single item in a view to the bigtree_module_view_cache table.
cacheViewData Grabs all the data from a view and does parsing on it based on automatic assumptions and manual parsers.
changeExists Checks to see if a change exists for a given item in the bigtree_pending_changes table.
clearCache Clears the cache of a view or all views with a given table.
createItem Creates an entry in the database for an auto module form.
createPendingItem Creates an entry in the bigtree_pending_changes table for an auto module form.
deleteItem Deletes an item from the given table and removes any pending changes, then uncaches it from its views.
deletePendingItem Deletes a pending item from bigtree_pending_changes and uncaches it.
getDependantViews Returns all views that have a dependance on a given table.
getEditAction Returns a module action for the given module and form IDs.
getEmbedForm Returns a module embeddable form.
getEmbedFormByHash Returns a module embeddable form.
getFilterQuery Returns a query string that is used for searching views based on group permissions.
getForm Returns a module form.
getGroupsForView Returns all groups in the view cache for a view.
getItem Returns an entry from a table with all its related information.
getModuleForForm Returns the associated module id for the given form.
getModuleForView Returns the associated module id for the given view.
getPendingItem Gets an entry from a table with all its related information and pending changes applied.
getRelatedFormForReport Returns the form for the same table as the given report.
getRelatedFormForView Returns the form for the same table as the given view.
getRelatedViewForForm Returns the view for the same table as the given form.
getRelatedViewForReport Returns the view for the same table as the given report.
getReport Returns a report with the filters and fields decoded.
getReportResults Returns rows from the table that match the filters provided.
getSearchResults Returns results from the bigtree_module_view_cache table.
getTagsForEntry Returns the tags for an entry.
getView Returns a view.
getViewData Gets a list of data for a view.
getViewDataForGroup Gets a list of data for a view in a given group.
getViewForTable Gets a view for a given table for showing change lists in Pending Changes.
parseViewData Parses data and returns the parsed columns (runs parsers and populated lists).
publishPendingItem Publishes a pending item and caches it.
recacheItem Re-caches a database entry.
sanitizeData Processes form data into values understandable by the MySQL table.
submitChange Creates a change request for an item and caches it.
track Used internally by the class to facilitate audit trail tracking when a logged in user is making a call.
uncacheItem Removes a database entry from the view cache.
updateItem Update an entry and cache it.
updatePendingItemField Update a pending item's field with a given value.
validate Validates a form element based on its validation requirements.
validationErrorMessage Returns an error message for a form element that failed validation.

cacheNewItem

Caches a new database entry by investigating associated views.

static cacheNewItem($id, $table, $pending = false, $recache = false)
Parameter Description
$id The id of the new item.
$table The table the new item is in.
$pending Whether this is actually a pending entry or not.
$recache Whether to delete previous cached entries with this id (for use by recacheItem)

cacheRecord

Caches a single item in a view to the bigtree_module_view_cache table.

static cacheRecord($item, $view, $parsers, $poplists, $original_item)
Parameter Description
$item The database record to cache.
$view The related view entry.
$parsers An array of manual parsers set in the view.
$poplists An array of populated lists that relate to the item.
$original_item The item without pending changes applied for GBP.

cacheViewData

Grabs all the data from a view and does parsing on it based on automatic assumptions and manual parsers.

static cacheViewData($view)
Parameter Description
$view The view entry to cache data for.

changeExists

Checks to see if a change exists for a given item in the bigtree_pending_changes table.

Return Value: true or false

static changeExists($table, $id)
Parameter Description
$table The table the item is from.
$id The ID of the item.

clearCache

Clears the cache of a view or all views with a given table.

static clearCache($entry)
Parameter Description
$entry The view id or view entry to clear the cache for or a table to find all views for (and clear their caches).

createItem

Creates an entry in the database for an auto module form.

Return Value: The id of the new entry in the database.

static createItem($table, $data, $many_to_many, $tags, $publishing_change, $open_graph)
Parameter Description
$table The table to put the data in.
$data An array of form data to enter into the table. This function determines what data in the array applies to a column in the database and discards the rest.
$many_to_many Many to many relationship entries.
$tags Tags for the entry.
$publishing_change A change ID that is being published (defaults to null)
$open_graph Open Graph information.

createPendingItem

Creates an entry in the bigtree_pending_changes table for an auto module form.

Return Value: The id of the new entry in the bigtree_pending_changes table.

static createPendingItem($module, $table, $data, $many_to_many, $tags, $publish_hook, $embedded_form, $open_graph)
Parameter Description
$module The module for the entry.
$table The table to put the data in.
$data An array of form data to enter into the table. This function determines what data in the array applies to a column in the database and discards the rest.
$many_to_many Many to many relationship entries.
$tags Tags for the entry.
$publish_hook A function to call when this change is published from the Dashboard.
$embedded_form If this is being called from an embedded form, set the user to NULL (defaults to false)
$open_graph Open Graph information.

deleteItem

Deletes an item from the given table and removes any pending changes, then uncaches it from its views.

static deleteItem($table, $id)
Parameter Description
$table The table to delete an entry from.
$id The id of the entry.

deletePendingItem

Deletes a pending item from bigtree_pending_changes and uncaches it.

static deletePendingItem($table, $id)
Parameter Description
$table The table the entry would have been in (should it have ever been published).
$id The id of the pending entry.

getDependantViews

Returns all views that have a dependance on a given table.

Return Value: An array of views from the modules database.

static getDependantViews($table)
Parameter Description
$table Table name

getEditAction

Returns a module action for the given module and form IDs.

Return Value: A bigtree_module_actions entry.

static getEditAction($module, $form)
Parameter Description
$module Module ID
$form Form ID

getEmbedForm

Returns a module embeddable form.

Return Value: An embeddable module form entry.

static getEmbedForm($id)
Parameter Description
$id The id of the form.

getEmbedFormByHash

Returns a module embeddable form.

Return Value: A module form entry with fields decoded.

static getEmbedFormByHash($hash)
Parameter Description
$hash The hash of the form.

getFilterQuery

Returns a query string that is used for searching views based on group permissions.
Can only be called when logged into the admin.

Return Value: A set of MySQL statements that filter out information the user cannot access.

static getFilterQuery($view)
Parameter Description
$view The view to create a filter for.

getForm

Returns a module form.

Return Value: A module form entry.

static getForm($id)
Parameter Description
$id The id of the form or a form entry to generate backwards compatibility tweaks for.

getGroupsForView

Returns all groups in the view cache for a view.

Return Value: An array of groups.

static getGroupsForView($view)
Parameter Description
$view The view entry.

getItem

Returns an entry from a table with all its related information.
If a pending ID is passed in (prefixed with a p) getPendingItem is called instead.

Return Value: Returns false if the entry could not be found.

static getItem($table, $id)
Parameter Description
$table The table to pull the entry from.
$id The id of the entry.

getModuleForForm

Returns the associated module id for the given form.

Return Value: The id of the module the form is a member of.

static getModuleForForm($form_id)
Parameter Description
$form_id Either a form entry or form id.

getModuleForView

Returns the associated module id for the given view.

Return Value: The id of the module the view is a member of.

static getModuleForView($view)
Parameter Description
$view Either a view entry or view id.

getPendingItem

Gets an entry from a table with all its related information and pending changes applied.

Return Value: Returns false if the entry could not be found.

static getPendingItem($table, $id)
Parameter Description
$table The table to pull the entry from.
$id The id of the entry.

getRelatedFormForReport

Returns the form for the same table as the given report.

Return Value: A form entry with fields decoded.

static getRelatedFormForReport($report)
Parameter Description
$report A report entry.

getRelatedFormForView

Returns the form for the same table as the given view.

Return Value: A form entry with fields decoded.

static getRelatedFormForView($view)
Parameter Description
$view A view entry.

getRelatedViewForForm

Returns the view for the same table as the given form.

Return Value: A view entry.

static getRelatedViewForForm($form)
Parameter Description
$form A form entry.

getRelatedViewForReport

Returns the view for the same table as the given report.

Return Value: A view entry.

static getRelatedViewForReport($report)
Parameter Description
$report A report entry.

getReport

Returns a report with the filters and fields decoded.

Return Value: An array of report information.

static getReport($id)
Parameter Description
$id The ID of the report

getReportResults

Returns rows from the table that match the filters provided.

Return Value: An array of entries from the report's table.

static getReportResults($report, $view, $form, $filters, $sort_field = "id", $sort_direction = "DESC")
Parameter Description
$report A module reports entry.
$view A module views entry.
$form A module forms entry.
$filters The submitted filters to run.
$sort_field The field to sort by.
$sort_direction The direction to sort by.

getSearchResults

Returns results from the bigtree_module_view_cache table.

Return Value: An array containing "pages" with the number of result pages and "results" with the results for the given page.

static getSearchResults($view, $page = 1, $query = "", $sort = "id DESC", $group = false)
Parameter Description
$view The view to pull data for.
$page The page of data to retrieve.
$query The query string to search against.
$sort The column and direction to sort.
$group The group to pull information for.

getTagsForEntry

Returns the tags for an entry.

Return Value: An array ot tags from bigtree_tags.

static getTagsForEntry($table, $id, $full = true)
Parameter Description
$table The table the entry is in.
$id The id of the entry.
$full Whether to return a full tag array or just the tag string (defaults to full tag array)

getView

Returns a view.

Return Value: A view entry with actions, settings, and fields decoded. fields also receive a width column for the view.

static getView($view_id, $decode_ipl = true)
Parameter Description
$view_id The id of the view or a view entry.
$decode_ipl Whether we want to decode internal page link on the preview url (defaults to true)

getViewData

Gets a list of data for a view.

Return Value: An array of items from bigtree_module_view_cache.

static getViewData($view, $sort = "id DESC", $type = "both")
Parameter Description
$view The view entry to pull data for.
$sort The sort direction, defaults to most recent.
$type Whether to get only active entries, pending entries, or both.

getViewDataForGroup

Gets a list of data for a view in a given group.

Return Value: An array of items from bigtree_module_view_cache.

static getViewDataForGroup($view, $group, $sort, $type = "both")
Parameter Description
$view The view entry to pull data for.
$group The group to get data for.
$sort The sort direction, defaults to most recent.
$type Whether to get only active entries, pending entries, or both.

getViewForTable

Gets a view for a given table for showing change lists in Pending Changes.

Return Value: A view entry with settings, and fields decoded and field widths set for Pending Changes.

static getViewForTable($table)
Parameter Description
$table Table name.

parseViewData

Parses data and returns the parsed columns (runs parsers and populated lists).

Return Value: An array of parsed entries.

static parseViewData($view, $items)
Parameter Description
$view The view to parse items for.
$items An array of entries to parse.

publishPendingItem

Publishes a pending item and caches it.

Return Value: The id of the new entry.

static publishPendingItem($table, $id, $data, $many_to_many, $tags, $open_graph)
Parameter Description
$table The table to store the entry in.
$id The id of the pending entry.
$data The form data to create an entry with.
$many_to_many Many to Many information
$tags Tag information
$open_graph Open Graph information

recacheItem

Re-caches a database entry.

static recacheItem($id, $table, $pending = false)
Parameter Description
$id The id of the entry.
$table The table the entry is in.
$pending Whether the entry is pending or not.

sanitizeData

Processes form data into values understandable by the MySQL table.

Return Value: Array of data safe for MySQL.

static sanitizeData($table, $data, $existing_description = false)
Parameter Description
$table The table to sanitize data for
$data Array of key->value pairs
$existing_description If the table has already been described, pass it in instead of making sanitizeData do it twice. (defaults to false)

submitChange

Creates a change request for an item and caches it.
Can only be called when logged into the admin.

Return Value: The id of the pending change.

static submitChange($module, $table, $id, $data, $many_to_many, $tags, $publish_hook, $open_graph)
Parameter Description
$module The module for the entry.
$table The table the entry is stored in.
$id The id of the entry.
$data The change request data.
$many_to_many The many to many changes.
$tags The tag changes.
$publish_hook A function to call when this change is published from the Dashboard.
$open_graph Open Graph changes.

track

Used internally by the class to facilitate audit trail tracking when a logged in user is making a call.

static track($table, $id, $action, $user = null)
Parameter Description
$table The table that is being changed
$id The id of the record being changed
$action The action being taken
$user A user ID to attribute the change to

uncacheItem

Removes a database entry from the view cache.

static uncacheItem($id, $table)
Parameter Description
$id The id of the entry.
$table The table the entry is in.

updateItem

Update an entry and cache it.

static updateItem($table, $id, $data, $many_to_many, $tags, $open_graph)
Parameter Description
$table The table the entry is in.
$id The id of the entry.
$data The data to update in the entry.
$many_to_many Many To Many information
$tags Tag information.
$open_graph Open Graph information.

updatePendingItemField

Update a pending item's field with a given value.

static updatePendingItemField($id, $field, $value)
Parameter Description
$id The id of the entry.
$field The field to change.
$value The value to set.

validate

Validates a form element based on its validation requirements.

Return Value: True if validation passed, otherwise false.

static validate($data, $type)
Parameter Description
$data The form's posted data for a given field.
$type Validation requirements (required, numeric, email, link).

validationErrorMessage

Returns an error message for a form element that failed validation.

Return Value: A string containing reasons the validation failed.

static validationErrorMessage($data, $type)
Parameter Description
$data The form's posted data for a given field.
$type Validation requirements (required, numeric, email, link).