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

Class: Console_Table

Source Location: /Console_Table-1.0.2/Table.php

Class Overview




Methods


Inherited Variables

Inherited Methods


Class Details

[line 45]


[ Top ]


Method Detail

Console_Table (Constructor)   [line 131]

Console_Table Console_Table( [int $align = CONSOLE_TABLE_ALIGN_LEFT])

Constructor

Parameters:

int   $align   —  Default alignment

[ Top ]

addCol   [line 271]

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. Can be numeric or associative array
integer   $col_id   —  The column index to populate
integer   $row_id   —  If starting row is not zero, specify it here

[ Top ]

addData   [line 291]

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

Adds data to the table. Argument should be a two dimensional array containing the data to be added.

Parameters:

array   $data   —  The data to add to the table
integer   $col_id   —  Optional starting column ID
integer   $row_id   —  Optional starting row ID

[ Top ]

addFilter   [line 179]

void addFilter( int $col, &$callback, callback $callback)

Adds a filter to the object. Filters are standard php callbacks which are run on the data before table generation is performed. Filters are applied in the order they're added. the callback function must accept a single argument, which is a single table cell.

Parameters:

int   $col   —  Column to apply filter to
callback   $callback   —  PHP callback to apply
   &$callback   — 

[ Top ]

addRow   [line 241]

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

Adds a row to the table

Parameters:

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

[ Top ]

addSeparator   [line 308]

void addSeparator( )

Adds a Horizontal Seperator to the table

[ Top ]

calculateTotalsFor   [line 217]

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 IDs (0 is first column, 1 is second etc)

[ Top ]

fromArray   [line 153]

void fromArray( array $headers, array $data, [bool $returnObject = false])

Converts an array to a table. Must be a two dimensional array.

(Static)


Parameters:

array   $headers   —  Headers for the table
array   $data   —  Data for the table
bool   $returnObject   —  Whether to return the Console_Table object (default: No)

[ Top ]

getTable   [line 318]

void getTable( )

Returns the table in wonderful

ASCII art


[ Top ]

insertRow   [line 256]

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

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

Sets the alignment for the columns

Parameters:

integer   $col_id   —  Column ID
integer   $align   —  Alignment to set for this column -1 = left, 0 = center, 1 = right OR use the constants: CONSOLE_TABLE_ALIGN_LEFT CONSOLE_TABLE_ALIGN_CENTER CONSOLE_TABLE_ALIGN_RIGHT

[ Top ]

setHeaders   [line 228]

void setHeaders( array $headers)

Sets the headers for the columns

Parameters:

array   $headers   —  The column headers

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:17:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.