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

Class: Console_Table

Source Location: /Console_Table-1.0.7/Table.php

Class Overview




Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]


[ Top ]


Method Detail

Console_Table (Constructor)   [line 137]

Console_Table Console_Table( [integer $align = CONSOLE_TABLE_ALIGN_LEFT])

Constructor.

Parameters:

integer   $align   —  Default alignment

[ Top ]

addCol   [line 284]

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 301]

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 183]

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 251]

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 322]

void addSeparator( )

Adds a horizontal seperator to the table.

[ Top ]

calculateTotalsFor   [line 229]

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 156]

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

Converts an array to a table. Must be
  • 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 332]

void getTable( )


[ Top ]

insertRow   [line 270]

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 207]

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 193]

void setCharset( $charset)

Sets the charset of the provided table data.

Parameters:

   $charset   — 

[ Top ]

setHeaders   [line 239]

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:02:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.