Write tables from arrays or datasets.
Helps building tables by either loading data in one bite via passing an array or CSV file, or by adding the data one row at a time.
package | dstruct_presentation |
---|
__construct(string $class, mixed $dataset, boolean $iscsv)
string
The CSS class to be written to the table
mixed
Either array or db resultset or CSV string
boolean
Data being added is a CSV string.
addCSV(string $data)
string
addHeaders($headers)
array Header titles from left to right
addRow($arraydata)
The array will be added to the end of the current
data, with the fields added as cells from left to right.
There is currently no checking that the array has the correct
number of items.
array
clear(boolean $clearsettings)
Removes all data, counters and header info.
boolean
Clear all CSV settings too.
setEnclosedBy(string $enc)
Default is double quote. Set an empty string if the CSV fields are not enclose.
string
setEncodeOutput(boolean $enc)
Encodes headers and data. Default is FALSE.
boolean
write($tablestart, $tableend) : string
The $tablestart and $tableend params can be used to suppress the
elements.
This can be useful in a number of cases, such as buffering the
output of very long tables.
boolean Include
<
table> in output
boolean Include in output
string
$arraydata : array
$class : string
$csvenclosedby : string
$csvescape : string
$csvhasheader : boolean
$csvline : string
$csvseparator : string
$dbobjectdata : array
todo | check datatype |
---|
$encodeoutput : boolean
$headers : array
$iscsv : boolean
$z : integer