\CodeIgniter\ViewTable

HTML Table Generating Class

Lets you create tables manually or from database result objects, or arrays.

Summary

Methods
Properties
Constants
__construct()
setTemplate()
setHeading()
setFooting()
makeColumns()
setEmpty()
addRow()
setCaption()
generate()
clear()
$rows
$heading
$footing
$autoHeading
$caption
$template
$newline
$emptyCells
$function
No constants found
_prepArgs()
_setFromDBResult()
_setFromArray()
_compileTemplate()
_defaultTemplate()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$rows

$rows : array

Data for table rows

Type

array

$heading

$heading : array

Data for table heading

Type

array

$footing

$footing : array

Data for table footing

Type

array

$autoHeading

$autoHeading : boolean

Whether or not to automatically create the table header

Type

boolean

$caption

$caption : string

Table caption

Type

string

$template

$template : array

Table layout template

Type

array

$newline

$newline : string

Newline setting

Type

string

$emptyCells

$emptyCells : string

Contents of empty cells

Type

string

$function

$function : \CodeIgniter\View\function

Callback for custom table layout

Type

\CodeIgniter\View\function

Methods

__construct()

__construct(array  $config = array()) : void

Set the template from the table config file if it exists

Parameters

array $config

(default: array())

setTemplate()

setTemplate(array  $template) : boolean

Set the template

Parameters

array $template

Returns

boolean

setHeading()

setHeading(  $args = array()) : \CodeIgniter\View\Table

Set the table heading

Can be passed as an array or discreet params

Parameters

$args

Returns

\CodeIgniter\View\Table

setFooting()

setFooting(  $args = array()) : \CodeIgniter\View\Table

Set the table footing

Can be passed as an array or discreet params

Parameters

$args

Returns

\CodeIgniter\View\Table

makeColumns()

makeColumns(array  $array = array(), integer  $columnLimit) : array

Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.

Parameters

array $array
integer $columnLimit

Returns

array

setEmpty()

setEmpty(mixed  $value) : \CodeIgniter\View\Table

Set "empty" cells

Can be passed as an array or discreet params

Parameters

mixed $value

Returns

\CodeIgniter\View\Table

addRow()

addRow(  $args = array()) : \CodeIgniter\View\Table

Add a table row

Can be passed as an array or discreet params

Parameters

$args

Returns

\CodeIgniter\View\Table

setCaption()

setCaption(string  $caption) : \CodeIgniter\View\Table

Add a table caption

Parameters

string $caption

Returns

\CodeIgniter\View\Table

generate()

generate(mixed  $tableData = null) : string

Generate the table

Parameters

mixed $tableData

Returns

string

clear()

clear() : \CodeIgniter\View\Table

Clears the table arrays. Useful if multiple tables are being generated

Returns

\CodeIgniter\View\Table

_prepArgs()

_prepArgs(  $args) : array

Prep Args

Ensures a standard associative array format for all cell data

Parameters

$args

Returns

array

_setFromDBResult()

_setFromDBResult(\CodeIgniter\Database\BaseResult  $object) : void

Set table data from a database result object

Parameters

\CodeIgniter\Database\BaseResult $object

Database result object

_setFromArray()

_setFromArray(array  $data) : void

Set table data from an array

Parameters

array $data

_compileTemplate()

_compileTemplate() : void

Compile Template

_defaultTemplate()

_defaultTemplate() : array

Default Template

Returns

array