Table Class Reference

The table class contains and manages the model of a table, including CSS classes and cell spans. More...

List of all members.

Public Member Functions

 Table ($tableClass="setup", $defaultRowClass="setup", $defaultCellClass="setup", $rows=0, $columns=0)
 addRow ($thisRowClass=null, $headerRow=false, $where=null)
 addRows ($howMany, $theseRowClass=null, $headerRow=false, $where=null)
 setRowHeader ($row, $headerRow=true)
 addColumn ($thisColumnClass=null, $where=null)
 addColumns ($howMany, $theseColumnClass=null, $where=null)
 setContent ($row, $column, $content, $pageData=true)
 setRowContent ($row, $pageData=true)
 setSpan ($row, $column, $rowSpan=null, $colSpan=null)
 setRowSpan ($row, $column, $spanrange=null)
 setColSpan ($row, $column, $spanrange=null)
 setStyleClass ($row, $column, $className=null)
 getContent ($row, $column)
 newRow ($thisRowClass=null, $headerRow=false)
 newCell ($content, $colSpan=null, $styleClass=null)
 render ()


Detailed Description

The table class contains and manages the model of a table, including CSS classes and cell spans.

Sample code for the Table class:

$testtable = new Table("table", "defaultrow", "defaultcell");
$testtable->addRow( null );
$testtable->addRow( "row2" );
$testtable->addRows( 5 );
$testtable->addColumn();
$testtable->addColumn( "column2" );
$testtable->addColumns( 5 );
$testtable->setContent( 0, 0, "0-0" );
$testtable->setContent( 0, 1, "0-1" );
$testtable->setContent( 0, 2, "0-2" );
$testtable->setContent( 0, 3, "0-3" );
$testtable->setContent( 0, 4, "0-4" );
$testtable->setContent( 0, 5, "0-5" );
$testtable->setRowContent( 1, true, "1-0", "1-1", "1-2", "1-3", "1-4", "1-5" );
$testtable->setRowContent( 2, true, "2-0", "2-1", "2-2", "2-3", "2-4", "2-5" );
$testtable->setRowContent( 3, true, "3-0", "3-1", "3-2", "3-3", "3-4", "3-5" );
$testtable->setRowContent( 4, true, "4-0", "4-1", "4-2", "4-3", "4-4", "4-5" );
$testtable->setRowContent( 5, true, "5-0", "5-1", "5-2", "5-3", "5-4", "5-5" );

$testtable->setSpan( 1, 1, null, 3 );
$testtable->setSpan( 2, 1, 2, null );
$testtable->setSpan( 3, 3, 2, 2 );

echo $testtable->render();


$testtable2 = new Table("table", "defaultrow", "defaultcell");
$testtable2->newRow();
$testtable2->newCell("0.0");
$testtable2->newCell("0.1");
$testtable2->newRow();
$testtable2->newCell("1.0");
$testtable2->newCell("1.1", 2);
echo $testtable2->render();

Definition at line 56 of file shared-tablehandler.php.


Member Function Documentation

Table::Table ( tableClass = "setup",
defaultRowClass = "setup",
defaultCellClass = "setup",
rows = 0,
columns = 0 
)

Construct a new table instance

Parameters:
tableClass The table's CSS class
defaultRowClass The default class of news rows
defaultCellClass The fallback class for contained cells. This will be used if the cell has no class assigned, and it is contained in a column with no class assigned
rows How many rows are in this table. Most often this will be 0, to be added later using addRow and addRows
columns How many columns are in this table. Most often this will be 0, to be added later using addColumn and addColumns

Definition at line 79 of file shared-tablehandler.php.

References $i, addColumn(), and addRow().

Here is the call graph for this function:

Table::addRow ( thisRowClass = null,
headerRow = false,
where = null 
)

This will add a range of rows to the table, at an optional specified position

Parameters:
thisRowClass A string describing which class to give the row
headerRow A boolean describing wether this is a header row
where An optional integer describing which row to add the row after. Defaults to the end

Todo:
Make this work!

Definition at line 105 of file shared-tablehandler.php.

References $i.

Referenced by addRows(), newRow(), and Table().

Table::addRows ( howMany,
theseRowClass = null,
headerRow = false,
where = null 
)

This will add a range of rows to the table, at an optional specified position

Parameters:
howMany A string describing how many rows you wish to add to the table
headerRow A boolean describing wether these are header rows
where An optional integer describing which row to add the rows after. Defaults to the end
theseRowClass A string describing which class to give the rows

Definition at line 132 of file shared-tablehandler.php.

References $i, and addRow().

Here is the call graph for this function:

Table::setRowHeader ( row,
headerRow = true 
)

Set wether a row contains a line of headers

Parameters:
row The row to set header status for
headerRow Boolean describing wether the row is a header row or not

Definition at line 153 of file shared-tablehandler.php.

Table::addColumn ( thisColumnClass = null,
where = null 
)

Add a new column to the table as an optional position and with an optional class

Parameters:
thisColumnClass The class to assign to this row
where An optional integer describing which column to add this column after. Defaults to the end

Todo:
Make this work!

Definition at line 164 of file shared-tablehandler.php.

References $i.

Referenced by addColumns(), newCell(), and Table().

Table::addColumns ( howMany,
theseColumnClass = null,
where = null 
)

This will add a range of columns to the table, at an optional specified position

Parameters:
howMany A string describing how many rows you wish to add to the table
theseRowClass A string describing which class to give the rows
where An optional integer describing which row to add the rows after. Defaults to the end

Definition at line 191 of file shared-tablehandler.php.

References $i, and addColumn().

Here is the call graph for this function:

Table::setContent ( row,
column,
content,
pageData = true 
)

Set the contents of the specified cell with either rendered HTML or pagedata

Parameters:
row The cell's identifying row
column The cell's identifying column
content The new content for this cell
pageData Are the contents to be interpreted as pagedata

Definition at line 214 of file shared-tablehandler.php.

Referenced by newCell(), and setRowContent().

Table::setRowContent ( row,
pageData = true 
)

Set the content of an entire row in one go

Parameters:
row The row to set the content of
pageData Are the contents to be interpreted as pagedata
contents All remaining arguments are interpreted as content to set for the cells in the row

Definition at line 227 of file shared-tablehandler.php.

References $contents, and setContent().

Here is the call graph for this function:

Table::setSpan ( row,
column,
rowSpan = null,
colSpan = null 
)

Set the span of a single cell. If one or both of the spanranges is null, the cell is reset to not span

Parameters:
row The cell's identifying row
column The cell's identifying column
rowSpan An integer defining how many rows to span. If null, the cell is reset to not span any rows
colSpan An integer defining how many columns to span. If null, the cell is reset to not span any columns

Definition at line 243 of file shared-tablehandler.php.

Referenced by setColSpan(), and setRowSpan().

Table::setRowSpan ( row,
column,
spanrange = null 
)

Set the row span of a single cell. If spanrange is null, the cell is reset to not span

Parameters:
row The cell's identifying row
column The cell's identifying column
spanrange An integer defining how many rows to span. If null, the cell is reset to not span any rows

Definition at line 302 of file shared-tablehandler.php.

References setSpan().

Here is the call graph for this function:

Table::setColSpan ( row,
column,
spanrange = null 
)

Set the column span of a single cell. If spanrange is null, the cell is reset to not span

Parameters:
row The cell's identifying row
column The cell's identifying column
spanrange An integer defining how many columns to span. If null, the cell is reset to not span any columns

Definition at line 314 of file shared-tablehandler.php.

References setSpan().

Referenced by newCell().

Here is the call graph for this function:

Table::setStyleClass ( row,
column,
className = null 
)

Set the CSS style of a single cell. If className is null, the cell is reset to not have a style set (column class will then override)

Parameters:
row The cell's identifying row
column The cell's identifying column
className A string defining which special class to assign this cell. If null, the cell is reset to fallback style

Definition at line 326 of file shared-tablehandler.php.

Referenced by newCell().

Table::getContent ( row,
column 
)

Get the contents of a specified cell.

Parameters:
row The cell's identifying row
column The cell's identifying column

Definition at line 337 of file shared-tablehandler.php.

Table::newRow ( thisRowClass = null,
headerRow = false 
)

Sequentially create a new row at the end of the table and set the current column to none

Parameters:
thisRowClass A string describing which class to give the row
headerRow A boolean describing wether this is a header row

Definition at line 348 of file shared-tablehandler.php.

References addRow(), and endKey().

Here is the call graph for this function:

Table::newCell ( content,
colSpan = null,
styleClass = null 
)

Sequentially add a new cell and set the contents of it, at the end of the current row

Parameters:
content The contents for the new cell
colSpan Optional. If the cell is to span a number of cells, input it here

Definition at line 361 of file shared-tablehandler.php.

References $i, addColumn(), setColSpan(), setContent(), and setStyleClass().

Here is the call graph for this function:

Table::render (  ) 

This function returns the rendered table

Returns:
Renders the table and returns a string containing this

Definition at line 390 of file shared-tablehandler.php.

References $renderedContent, and parse_page_data().

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Sun Oct 26 20:33:15 2008 for The Travelsized Content Management System by  doxygen 1.5.5