Main Class

Purpose

The Ditto class contains all functions relating to Ditto’s functionality and any supporting functions they need

Summary
Main ClassThe Ditto class contains all functions relating to Ditto’s functionality and any supporting functions they need
Functions
getTVListGet a list of all available TVs
addFieldAdd a field to the internal field detection system
addFieldsAdd a field to the internal field detection system from an array or delimited string
removeFieldRemove a field to the internal field detection system
setDisplayFieldsMove the detected fields into the Ditto fields array
getDocVarTypeDetermine if the provided field is a tv, a database field, or something else
parseOrderByParse out orderBy parameter string
checkAdvSortCheck the advSortString
parseFiltersSplit up the filters into an array and add the required fields to the fields array
renderRender the document output
parseFieldsFind the fields that are contained in the custom placeholders or those that are needed in other functions
arrayUniqueMake fields array unique
parseCustomPlaceholdersParse the required fields out of the custom placeholders
parseDBFieldsParse out the fields required for each state
renderQELinksRender QE links when needed
getAuthorGet the author name, or if not available the username
customSortSort resource array if advanced sorting is needed
userSortSort the resource array by a user defined function
multiSortSort the resource array by multiple fields Rows->Columns portion by Jon L.
determineIDsGet Document IDs for future use
weightedRandomExecute a random order sort
getParentListGet a list of all available parents
appendTVApeend a TV to the documents array
appendKeywordsAppend keywords’s to the resource array
fetchKeywordsHelper function to appendKeywords
getChildIDsGet the IDs ready to be processed Similar to the modx version by the same name but much faster
getDocumentsGet documents and append TVs + Prefetch Data, and sort
getDocumentsLiteGet an array of documents
cleanIDsClean the IDs of any dangerous characters
buildURLBuild a URL with regard to Ditto ID
getParamGet a parameter or use the default language value
paginatePaginate the documents
noResultsRender the noResults output
relToAbsConvert relative urls to absolute URLs Based on script from http://wintermute.com.au- /bits- /2005-09- /php-relative-absolute-links- /

Functions

getTVList

function getTVList()

Get a list of all available TVs

addField

function addField($name,  
$location,  
$type = false)

Add a field to the internal field detection system

addFields

function addFields($fields,  
$location = '*',
$delimiter = ',',
$callback = false)

Add a field to the internal field detection system from an array or delimited string

removeField

function removeField($name,
$location,
$type)

Remove a field to the internal field detection system

setDisplayFields

function setDisplayFields($fields,
$hiddenFields)

Move the detected fields into the Ditto fields array

getDocVarType

function getDocVarType($field)

Determine if the provided field is a tv, a database field, or something else

parseOrderBy

function parseOrderBy($orderBy,
$randomize)

Parse out orderBy parameter string

checkAdvSort

function checkAdvSort($sortBy,  
$sortDir = 'asc')

Check the advSortString

parseFilters

function parseFilters($filter = false,
$cFilters = false,
$pFilters =  false,
$globalDelimiter,  
$localDelimiter  )

Split up the filters into an array and add the required fields to the fields array

render

function render($resource,  
$template,  
$removeChunk,  
$dateSource,  
$dateFormat,  
$ph = array(),
$phx = 1,
$x = 0)

Render the document output

parseFields

function parseFields($placeholders,
$seeThruUnpub,
$dateSource,
$randomize)

Find the fields that are contained in the custom placeholders or those that are needed in other functions

arrayUnique

function arrayUnique($array)

Make fields array unique

parseCustomPlaceholders

function parseCustomPlaceholders($placeholders)

Parse the required fields out of the custom placeholders

parseDBFields

function parseDBFields($seeThruUnpub)

Parse out the fields required for each state

renderQELinks

function renderQELinks($fields,
$resource,
$QEPrefix,
$placeholders)

Render QE links when needed

getAuthor

function getAuthor($createdby)

Get the author name, or if not available the username

customSort

function customSort($data,
$fields,
$order)

Sort resource array if advanced sorting is needed

userSort

function userSort($resource,
$sort)

Sort the resource array by a user defined function

multiSort

function multiSort($resource,
$orderBy)

Sort the resource array by multiple fields Rows->Columns portion by Jon L.  -- inte.nosp@m.l352@gmai.nosp@m.l.com Link: http://de3.php.net- /manual- /en- /function.array-multisort.php#73498

determineIDs

function determineIDs($IDs,
$IDType,
$TVs,
$orderBy,
$depth,
$showPublishedOnly,
$seeThruUnpub,
$hideFolders,
$hidePrivate,
$showInMenuOnly,
$myWhere,
$keywords,
$dateSource,
$limit,
$summarize,
$filter,
$paginate,
$randomize)

Get Document IDs for future use

weightedRandom

function weightedRandom($resource,
$field,
$show)

Execute a random order sort

getParentList

function getParentList()

Get a list of all available parents

appendTV

function appendTV($tvname = "",
$docIDs  )

Apeend a TV to the documents array

appendKeywords

function appendKeywords($resource)

Append keywords’s to the resource array

fetchKeywords

function fetchKeywords($resource)

Helper function to appendKeywords

getChildIDs

function getChildIDs($IDs,
$depth)

Get the IDs ready to be processed Similar to the modx version by the same name but much faster

getDocuments

function getDocuments($ids =  array (),
$fields,  
$TVs,  
$orderBy,  
$published =  1,
$deleted =  0,
$public =  1,
$where =  '',
$limit =  "",
$keywords = 0,
$randomize = 0,
$dateSource = false)

Get documents and append TVs + Prefetch Data, and sort

getDocumentsLite

Get an array of documents

cleanIDs

function cleanIDs($IDs)

Clean the IDs of any dangerous characters

buildURL

function buildURL($args,  
$id = false,
$dittoIdentifier = false)

Build a URL with regard to Ditto ID

getParam

function getParam($param,
$langString)

Get a parameter or use the default language value

paginate

function paginate($start,
$stop,
$total,
$summarize,
$tplPaginateNext,
$tplPaginatePrevious,
$tplPaginateNextOff,
$tplPaginatePreviousOff,
$tplPaginatePage,
$tplPaginateCurrentPage,
$paginateAlwaysShowLinks,
$paginateSplitterCharacter)

Paginate the documents

noResults

function noResults($text,
$paginate)

Render the noResults output

relToAbs

function relToAbs($text,
$base)

Convert relative urls to absolute URLs Based on script from http://wintermute.com.au- /bits- /2005-09- /php-relative-absolute-links- /

function getTVList()
Get a list of all available TVs
function addField($name,  
$location,  
$type = false)
Add a field to the internal field detection system
function addFields($fields,  
$location = '*',
$delimiter = ',',
$callback = false)
Add a field to the internal field detection system from an array or delimited string
function removeField($name,
$location,
$type)
Remove a field to the internal field detection system
function setDisplayFields($fields,
$hiddenFields)
Move the detected fields into the Ditto fields array
function getDocVarType($field)
Determine if the provided field is a tv, a database field, or something else
function parseOrderBy($orderBy,
$randomize)
Parse out orderBy parameter string
function checkAdvSort($sortBy,  
$sortDir = 'asc')
Check the advSortString
function parseFilters($filter = false,
$cFilters = false,
$pFilters =  false,
$globalDelimiter,  
$localDelimiter  )
Split up the filters into an array and add the required fields to the fields array
function render($resource,  
$template,  
$removeChunk,  
$dateSource,  
$dateFormat,  
$ph = array(),
$phx = 1,
$x = 0)
Render the document output
function parseFields($placeholders,
$seeThruUnpub,
$dateSource,
$randomize)
Find the fields that are contained in the custom placeholders or those that are needed in other functions
function arrayUnique($array)
Make fields array unique
function parseCustomPlaceholders($placeholders)
Parse the required fields out of the custom placeholders
function parseDBFields($seeThruUnpub)
Parse out the fields required for each state
function renderQELinks($fields,
$resource,
$QEPrefix,
$placeholders)
Render QE links when needed
function getAuthor($createdby)
Get the author name, or if not available the username
function customSort($data,
$fields,
$order)
Sort resource array if advanced sorting is needed
function userSort($resource,
$sort)
Sort the resource array by a user defined function
function multiSort($resource,
$orderBy)
Sort the resource array by multiple fields Rows->Columns portion by Jon L.
function determineIDs($IDs,
$IDType,
$TVs,
$orderBy,
$depth,
$showPublishedOnly,
$seeThruUnpub,
$hideFolders,
$hidePrivate,
$showInMenuOnly,
$myWhere,
$keywords,
$dateSource,
$limit,
$summarize,
$filter,
$paginate,
$randomize)
Get Document IDs for future use
function weightedRandom($resource,
$field,
$show)
Execute a random order sort
function getParentList()
Get a list of all available parents
function appendTV($tvname = "",
$docIDs  )
Apeend a TV to the documents array
function appendKeywords($resource)
Append keywords’s to the resource array
function fetchKeywords($resource)
Helper function to appendKeywords
function getChildIDs($IDs,
$depth)
Get the IDs ready to be processed Similar to the modx version by the same name but much faster
function getDocuments($ids =  array (),
$fields,  
$TVs,  
$orderBy,  
$published =  1,
$deleted =  0,
$public =  1,
$where =  '',
$limit =  "",
$keywords = 0,
$randomize = 0,
$dateSource = false)
Get documents and append TVs + Prefetch Data, and sort
function cleanIDs($IDs)
Clean the IDs of any dangerous characters
function buildURL($args,  
$id = false,
$dittoIdentifier = false)
Build a URL with regard to Ditto ID
function getParam($param,
$langString)
Get a parameter or use the default language value
function paginate($start,
$stop,
$total,
$summarize,
$tplPaginateNext,
$tplPaginatePrevious,
$tplPaginateNextOff,
$tplPaginatePreviousOff,
$tplPaginatePage,
$tplPaginateCurrentPage,
$paginateAlwaysShowLinks,
$paginateSplitterCharacter)
Paginate the documents
function noResults($text,
$paginate)
Render the noResults output
function relToAbs($text,
$base)
Convert relative urls to absolute URLs Based on script from http://wintermute.com.au/bits/2005-09/php-relative-absolute-links/