PHP Class Contao\DC_Table

Inheritance: extends DataContainer, implements listable, implements editable
Show file Open project: contao/core-bundle Class Usage Examples

Protected Properties

Property Type Description
$arrModule array The current back end module
$bid string ID of the button container
$blnCreateNewVersion boolean True if a new version has to be created
$ctable array Names of the child tables
$current array IDs of all records that are currently displayed
$firstOrderBy string First sorting field
$limit string Limit (database query)
$orderBy array Order by (database query)
$ptable string Name of the parent table
$set array Fields of a new or duplicated record
$total string Total (database query)
$treeView boolean Show the current table as tree

Public Methods

Method Description
__construct ( string $strTable, array $arrModule = [] ) Initialize the object
__get ( string $strKey ) : mixed Return an object property
__set ( string $strKey, mixed $varValue ) Set an object property
ajaxTreeView ( integer $id, integer $level ) : string Generate a particular subpart of the tree and return it as HTML string
copy ( boolean $blnDoNotRedirect = false ) : integer | boolean Duplicate a particular record of the current table
copyAll ( ) Move all selected records
create ( array $set = [] ) Insert a new row into a database table
cut ( boolean $blnDoNotRedirect = false ) Assign a new position to an existing record
cutAll ( ) Move all selected records
delete ( boolean $blnDoNotRedirect = false ) Delete a record of the current table table and save it to tl_undo
deleteAll ( ) Delete all selected records
deleteChilds ( string $table, integer $id, array &$delete ) Recursively get all related table names and records
edit ( integer $intId = null, integer $ajaxId = null ) : string Auto-generate a form to edit the current database record
editAll ( integer $intId = null, integer $ajaxId = null ) : string Auto-generate a form to edit all records that are currently shown
getPalette ( ) : string Return the name of the current palette
move ( ) Change the order of two neighbour database records
overrideAll ( ) : string Auto-generate a form to override all records that are currently shown
show ( ) : string Return all non-excluded fields of a record as HTML table
showAll ( ) : string List all records of a particular table
undo ( ) Restore one or more deleted records

Protected Methods

Method Description
copyChilds ( string $table, integer $insertID, integer $id, integer $parentId ) Duplicate all child records of a duplicated record
filterMenu ( integer $intFilterPanel ) : string Generate the filter panel and return it as HTML string
formatCurrentValue ( string $field, mixed $value, integer $mode ) : string Return the formatted group header as string
formatGroupHeader ( string $field, mixed $value, integer $mode, array $row ) : string Return the formatted group header as string
generateTree ( string $table, integer $id, array $arrPrevNext, boolean $blnHasSorting, integer $intMargin, array $arrClipboard = null, boolean $blnCircularReference = false, boolean $protectedPage = false, boolean $blnNoRecursion = false, array $arrFound = [] ) : string Recursively generate the tree and return it as HTML string
getNewPosition ( string $mode, integer $pid = null, boolean $insertInto = false ) Calculate the new position of a moved or inserted record
limitMenu ( boolean $blnOptional = false ) : string Return a select menu to limit results
listView ( ) : string List all records of the current table and return them as HTML string
paginationMenu ( ) : string Return a pagination menu to browse results
panel ( ) : string Build the sort panel and return it as string
parentView ( ) : string Show header of the parent table and list all records of the current table
reviseTable ( ) Delete all incomplete and unrelated records
save ( mixed $varValue ) Save the current value
searchMenu ( ) : string Return a search form that allows to search results using regular expressions
sortMenu ( ) : string Return a select menu that allows to sort results by a particular field
treeView ( ) : string List all records of the current table as tree and return them as HTML string

Method Details

__construct() public method

Initialize the object
public __construct ( string $strTable, array $arrModule = [] )
$strTable string
$arrModule array

__get() public method

Return an object property
public __get ( string $strKey ) : mixed
$strKey string
return mixed

__set() public method

Set an object property
public __set ( string $strKey, mixed $varValue )
$strKey string
$varValue mixed

ajaxTreeView() public method

Generate a particular subpart of the tree and return it as HTML string
public ajaxTreeView ( integer $id, integer $level ) : string
$id integer
$level integer
return string

copy() public method

Duplicate a particular record of the current table
public copy ( boolean $blnDoNotRedirect = false ) : integer | boolean
$blnDoNotRedirect boolean
return integer | boolean

copyAll() public method

Move all selected records
public copyAll ( )

copyChilds() protected method

Duplicate all child records of a duplicated record
protected copyChilds ( string $table, integer $insertID, integer $id, integer $parentId )
$table string
$insertID integer
$id integer
$parentId integer

create() public method

Insert a new row into a database table
public create ( array $set = [] )
$set array

cut() public method

Assign a new position to an existing record
public cut ( boolean $blnDoNotRedirect = false )
$blnDoNotRedirect boolean

cutAll() public method

Move all selected records
public cutAll ( )

delete() public method

Delete a record of the current table table and save it to tl_undo
public delete ( boolean $blnDoNotRedirect = false )
$blnDoNotRedirect boolean

deleteAll() public method

Delete all selected records
public deleteAll ( )

deleteChilds() public method

Recursively get all related table names and records
public deleteChilds ( string $table, integer $id, array &$delete )
$table string
$id integer
$delete array

edit() public method

Auto-generate a form to edit the current database record
public edit ( integer $intId = null, integer $ajaxId = null ) : string
$intId integer
$ajaxId integer
return string

editAll() public method

Auto-generate a form to edit all records that are currently shown
public editAll ( integer $intId = null, integer $ajaxId = null ) : string
$intId integer
$ajaxId integer
return string

filterMenu() protected method

Generate the filter panel and return it as HTML string
protected filterMenu ( integer $intFilterPanel ) : string
$intFilterPanel integer
return string

formatCurrentValue() protected method

Return the formatted group header as string
protected formatCurrentValue ( string $field, mixed $value, integer $mode ) : string
$field string
$value mixed
$mode integer
return string

formatGroupHeader() protected method

Return the formatted group header as string
protected formatGroupHeader ( string $field, mixed $value, integer $mode, array $row ) : string
$field string
$value mixed
$mode integer
$row array
return string

generateTree() protected method

Recursively generate the tree and return it as HTML string
protected generateTree ( string $table, integer $id, array $arrPrevNext, boolean $blnHasSorting, integer $intMargin, array $arrClipboard = null, boolean $blnCircularReference = false, boolean $protectedPage = false, boolean $blnNoRecursion = false, array $arrFound = [] ) : string
$table string
$id integer
$arrPrevNext array
$blnHasSorting boolean
$intMargin integer
$arrClipboard array
$blnCircularReference boolean
$protectedPage boolean
$blnNoRecursion boolean
$arrFound array
return string

getNewPosition() protected method

Calculate the new position of a moved or inserted record
protected getNewPosition ( string $mode, integer $pid = null, boolean $insertInto = false )
$mode string
$pid integer
$insertInto boolean

getPalette() public method

Return the name of the current palette
public getPalette ( ) : string
return string

limitMenu() protected method

Return a select menu to limit results
protected limitMenu ( boolean $blnOptional = false ) : string
$blnOptional boolean
return string

listView() protected method

List all records of the current table and return them as HTML string
protected listView ( ) : string
return string

move() public method

Change the order of two neighbour database records
public move ( )

overrideAll() public method

Auto-generate a form to override all records that are currently shown
public overrideAll ( ) : string
return string

paginationMenu() protected method

Return a pagination menu to browse results
protected paginationMenu ( ) : string
return string

panel() protected method

Build the sort panel and return it as string
protected panel ( ) : string
return string

parentView() protected method

Show header of the parent table and list all records of the current table
protected parentView ( ) : string
return string

reviseTable() protected method

Delete all incomplete and unrelated records
protected reviseTable ( )

save() protected method

Save the current value
protected save ( mixed $varValue )
$varValue mixed

searchMenu() protected method

Return a search form that allows to search results using regular expressions
protected searchMenu ( ) : string
return string

show() public method

Return all non-excluded fields of a record as HTML table
public show ( ) : string
return string

showAll() public method

List all records of a particular table
public showAll ( ) : string
return string

sortMenu() protected method

Return a select menu that allows to sort results by a particular field
protected sortMenu ( ) : string
return string

treeView() protected method

List all records of the current table as tree and return them as HTML string
protected treeView ( ) : string
return string

undo() public method

Restore one or more deleted records
public undo ( )

Property Details

$arrModule protected property

The current back end module
protected array $arrModule
return array

$bid protected property

ID of the button container
protected string $bid
return string

$blnCreateNewVersion protected property

True if a new version has to be created
protected bool $blnCreateNewVersion
return boolean

$ctable protected property

Names of the child tables
protected array $ctable
return array

$current protected property

IDs of all records that are currently displayed
protected array $current
return array

$firstOrderBy protected property

First sorting field
protected string $firstOrderBy
return string

$limit protected property

Limit (database query)
protected string $limit
return string

$orderBy protected property

Order by (database query)
protected array $orderBy
return array

$ptable protected property

Name of the parent table
protected string $ptable
return string

$set protected property

Fields of a new or duplicated record
protected array $set
return array

$total protected property

Total (database query)
protected string $total
return string

$treeView protected property

Show the current table as tree
protected bool $treeView
return boolean