apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Console_Table

Source Location: /Console_Table-1.1.1/Table.php

Class Overview




Methods


Inherited Variables

Inherited Methods


Class Details

[line 48]


[ Top ]


Method Detail

Console_Table (Constructor)   [line 154]

Console_Table Console_Table( [integer $align = CONSOLE_TABLE_ALIGN_LEFT], [string $border = CONSOLE_TABLE_BORDER_ASCII], [integer $padding = 1], [string $charset = null])

Constructor.

Parameters:

integer   $align   —  Default alignment. One of CONSOLE_TABLE_ALIGN_LEFT, CONSOLE_TABLE_ALIGN_CENTER or CONSOLE_TABLE_ALIGN_RIGHT.
string   $border   —  The character used for table borders or CONSOLE_TABLE_BORDER_ASCII.
integer   $padding   —  How many spaces to use to pad the table.
string   $charset   —  A charset supported by the mbstring PHP extension.

[ Top ]

addCol   [line 312]

void addCol( array $col_data, [integer $col_id = 0], [integer $row_id = 0])

Adds a column to the table.

Parameters:

array   $col_data   —  The data of the column.
integer   $col_id   —  The column index to populate.
integer   $row_id   —  If starting row is not zero, specify it here.

[ Top ]

addData   [line 329]

void addData( array $data, [integer $col_id = 0], [integer $row_id = 0])

Adds data to the table.

Parameters:

array   $data   —  A two dimensional array with the table data.
integer   $col_id   —  Starting column number.
integer   $row_id   —  Starting row number.

[ Top ]

addFilter   [line 207]

void addFilter( integer $col, &$callback, mixed $callback)

Adds a filter to a column.

Filters are standard PHP callbacks which are run on the data before table generation is performed. Filters are applied in the order they are added. The callback function must accept a single argument, which is a single table cell.


Parameters:

integer   $col   —  Column to apply filter to.
mixed   $callback   —  PHP callback to apply.
   &$callback   — 

[ Top ]

addRow   [line 279]

void addRow( array $row, [boolean $append = true])

Adds a row to the table.

Parameters:

array   $row   —  The row data to add.
boolean   $append   —  Whether to append or prepend the row.

[ Top ]

addSeparator   [line 350]

void addSeparator( )

Adds a horizontal seperator to the table.

[ Top ]

calculateTotalsFor   [line 257]

void calculateTotalsFor( array $cols)

Specifies which columns are to have totals calculated for them and added as a new row at the bottom.

Parameters:

array   $cols   —  Array of column numbers (starting with 0).

[ Top ]

fromArray   [line 180]

Console_Table|string fromArray( array $headers, array $data, [boolean $returnObject = false])

Converts an array to a table.
  • Return: A Console_Table object or the generated table.

Parameters:

array   $headers   —  Headers for the table.
array   $data   —  A two dimensional array with the table data.
boolean   $returnObject   —  Whether to return the Console_Table object instead of the rendered table.

[ Top ]

getTable   [line 360]

void getTable( )


[ Top ]

insertRow   [line 298]

void insertRow( array $row, [integer $row_id = 0])

Inserts a row after a given row number in the table.

If $row_id is not given it will prepend the row.


Parameters:

array   $row   —  The data to insert.
integer   $row_id   —  Row number to insert before.

[ Top ]

setAlign   [line 235]

void setAlign( integer $col_id, [integer $align = CONSOLE_TABLE_ALIGN_LEFT])

Sets the alignment for the columns.

Parameters:

integer   $col_id   —  The column number.
integer   $align   —  Alignment to set for this column. One of CONSOLE_TABLE_ALIGN_LEFT CONSOLE_TABLE_ALIGN_CENTER CONSOLE_TABLE_ALIGN_RIGHT.

[ Top ]

setCharset   [line 218]

void setCharset( string $charset)

Sets the charset of the provided table data.

Parameters:

string   $charset   —  A charset supported by the mbstring PHP extension.

[ Top ]

setHeaders   [line 267]

void setHeaders( array $headers)

Sets the headers for the columns.

Parameters:

array   $headers   —  The column headers.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:19:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.