atkTableRenderer atkTableRenderer(
[int
$flags = 0], [string
$style = ''], [string
$module = '']
)
|
|
Constructs a new table renderer
Parameters:
|
int |
$flags: |
flags to set (allowed: TBL_HEADER, TBL_FOOTER, TBL_ALTERNATE and TBL_DATA) |
|
string |
$style: |
style class to set for the table |
|
string |
$module: |
module to register style with |
string getAlignment(
int
$row, int
$col
)
|
|
Gets the alignment for a specific cell
Parameters:
|
int |
$row: |
row nuber |
|
int |
$col: |
column number |
API Tags:
Redefined in descendants as:
String getClass(
Integer
$row, Integer
$col
)
|
|
Determines the class to be set for a specific cell
Parameters:
|
Integer |
$row: |
Row number of the cell |
|
Integer |
$col: |
Column number of the cell |
API Tags:
| Return: | Class string of the cell |
bool|string getSpan(
int
$row, int
$col
)
|
|
Gets the spanning for a specific cell
Parameters:
|
int |
$row: |
row number of the cell |
|
int |
$col: |
column number of the cell |
API Tags:
| Return: | spanning or false if nothing found for the cell |
void registerStyle(
string
$style, [string
$module = ""]
)
|
|
Registers a style with the page.
Parameters:
|
string |
$style: |
styleclass name |
|
string |
$module: |
module to look for stylesheets |
String render(
array
$data, [int
$flags = 0], [string
$style = ""], [string
$module = ""]
)
|
|
Render a table.
Example:
$tbl =
&atknew("atk.utils.atktablerenderer");
Parameters:
|
array |
$data: |
A multidimensional array containing the rows and columns with data. The first dimension represents the rows. The second dimension represents the cols. If rows to not contain a complete amount of cols (compared to the other rows), the row is automatically filled upon the right by a spacer cell. |
|
int |
$flags: |
(obsolete). Set flags in constructor or setFlag() One or more bitwise flags that influence the way the table is rendered. Valid flags: - TBL_HEADER: the first row will be rendered as
a table header.
- TBL_FOOTER: the last row will be rendered as a
table footer.
- TBL_ALTERNATE: The rows of the table should
alternate in color.
- TBL_DATA: Alias for TBL_HEADER|TBL_ALTERNATE.
|
|
string |
$style: |
(obsolete) Use the constructor parameter or setTableStyle() The style to render the table in (without .css extension). |
|
string |
$module: |
(obsolete) Use the constructor parameter or setTableStyle() The module where is style is located. |
API Tags:
| Return: | The rendered table. |
void setAlignment(
int
$row, int
$col, int
$alignment
)
|
|
Set the alignment for a particular cell.
Parameters:
|
int |
$row: |
The row to set. |
|
int |
$col: |
The column to set. |
|
int |
$alignment: |
The desired alignment (TBL_LEFT, TBL_RIGHT or TBL_CENTER). |
void setClass(
int
$row, int
$col, string
$class
)
|
|
Set the class for a particular cell.
Parameters:
|
int |
$row: |
The row to set. |
|
int |
$col: |
The column to set. |
|
string |
$class: |
Classname to be used by default for table cells |
void setColAlignment(
int
$col, int
$alignment
)
|
|
Set the alignment for an entire column.
Parameters:
|
int |
$col: |
The column to set. |
|
int |
$alignment: |
The desired alignment (TBL_LEFT, TBL_RIGHT or TBL_CENTER). |
void setColClass(
int
$col, string
$class
)
|
|
Set the class for an entire column.
Parameters:
|
int |
$col: |
The column to set. |
|
string |
$class: |
Classname to be used by default for table cells |
void setColSpan(
int
$row, int
$col, int
$span
)
|
|
Set the colspan for a cel
Parameters:
|
int |
$row: |
The row to set |
|
int |
$col: |
The col to set |
|
int |
$span: |
The span width |
void setDefaultAlignment(
int
$alignment
)
|
|
Set the default alignment for all cells in the table.
Parameters:
|
int |
$alignment: |
The desired alignment (TBL_LEFT, TBL_RIGHT or TBL_CENTER). |
void setDefaultClass(
string
$class
)
|
|
Set the default class for all cells in the table.
Parameters:
|
string |
$class: |
Classname to be used by default for table cells |
void setFlag(
int
$flag
)
|
|
Sets a flag on this object. Allowed: TBL_HEADER, TBL_FOOTER, TBL_ALTERNATE and TBL_DATA
Parameters:
void setRowAlignment(
int
$row, int
$alignment
)
|
|
Set the alignment for an entire row.
Parameters:
|
int |
$row: |
The row to set. |
|
int |
$alignment: |
The desired alignment (TBL_LEFT, TBL_RIGHT or TBL_CENTER). |
void setRowClass(
int
$row, string
$class
)
|
|
Set the class for an entire row.
Parameters:
|
int |
$row: |
The row to set. |
|
string |
$class: |
Classname to be used by default for table cells |
void setRowSpan(
int
$row, int
$col, int
$span
)
|
|
Set the rowspan for a cel
Parameters:
|
int |
$row: |
The row to set |
|
int |
$col: |
The col to set |
|
int |
$span: |
The span width |
void setTableStyle(
string
$class, [string
$module = ""]
)
|
|
Sets the table style class and registers it in the result page
Parameters:
|
string |
$class: |
styleclass name |
|
string |
$module: |
module to look for stylesheets |
string _alignmentStr(
int
$alignment
)
|
|
Gets the alignmentstring for an alignment flag
Parameters:
|
int |
$alignment: |
alignmentflag TBL_[LEFT, RIGHT, CENTER, BOTTOM or MIDDLE] |
API Tags:
| Return: | html alignment for a cell or row |
String _classStr(
String
$class
)
|
|
Constructs the html class attribute string using a classname
Parameters:
API Tags:
| Return: | HTML Class attribute string |
| Access: | private |
string _getIdStr(
array
$data
)
|
|
Gets the cell id string if available.
Parameters:
API Tags:
| Return: | html id string like 'id="1"'; |
int _getMaxCols(
aray
$data, [
$rownr = '']
)
|
|
Gets the maximum number of columns in a row
Parameters:
|
aray |
$data: |
table data |
|
|
$rownr: |
|
API Tags:
| Return: | max number of rows |
Redefined in descendants as:
string _getRowClassStr(
string|int
$row
)
|
|
Gets the styleclass for a rownumber Supports alternating rowclasses if TBL_ALTERNATE is set
Parameters:
|
string|int |
$row: |
row number or rowclassname |
API Tags:
| Return: | html class string like 'class=row1' |
string _getTableStyleStr(
)
|
|
Gets the table style attribute component
string _renderBody(
array
$data, [int
$rowOffset = 0]
)
|
|
Renders the body of the table. The body contains all rows except the header and footer rows. Surrounds the body with tbody tags.
Parameters:
|
array |
$data: |
all body rows |
|
int |
$rowOffset: |
how many header rows are drawn before the body |
API Tags:
Redefined in descendants as:
string _renderCell(
array|string
$data, int
$row, int
$col, string
$type
)
|
|
Renders one cell in the table.
Parameters:
|
array|string |
$data: |
value of the cell |
|
int |
$row: |
row number of current cell |
|
int |
$col: |
column number of current cell |
|
string |
$type: |
type of tag to use. mostly 'td' |
API Tags:
string _renderFillingCell(
int
$colspan, string
$type
)
|
|
Renders a filling cell used to display a correct two-dimensional table.
Parameters:
|
int |
$colspan: |
columns to span |
|
string |
$type: |
tagtype to use |
API Tags:
| Return: | html filling cell |
string _renderFooter(
array
$data, int
$row
)
|
|
Renders one footer row.
Parameters:
|
array |
$data: |
row data |
|
int |
$row: |
rownumber of the footer |
API Tags:
| Return: | rendered footer row |
string _renderHeader(
array
$data, int
$row
)
|
|
Renders one header row.
Parameters:
|
array |
$data: |
row data |
|
int |
$row: |
rownumber of the header, mostly 0 |
API Tags:
| Return: | rendered header row |
string _renderRow(
array
$data, int
$row, [string
$columntype = 'td']
)
|
|
Renders one row in the table.
Parameters:
|
array |
$data: |
rowdata array |
|
int |
$row: |
rownumber |
|
string |
$columntype: |
tagname to use to render columns inside this row |
API Tags:
html _renderTable(
array
$data
)
|
|
Renders the table.
Parameters:
API Tags:
| Return: | of the rendered table |
unknown _renderValue(
array|string
$cell
)
|
|
Renders the value inside one cell.
Supports the cell having id/value. This method only extracts the value.
Parameters:
void _setSpan(
int
$row, int
$col, int
$span, [string
$type = "col"]
)
|
|
Sets spanning on a specifc column.
Parameters:
|
int |
$row: |
row number |
|
int |
$col: |
row column |
|
int |
$span: |
width |
|
string |
$type: |
|
string _spanStr(
array
$span
)
|
|
Gets the span string for a cell
Parameters:
|
array |
$span: |
array containing spanning info |
API Tags:
| Return: | html spanning string |