PHP Class CI_Table, TastyIgniter

Lets you create tables manually or from database result objects, or arrays.
Author: ExpressionEngine Dev Team
Afficher le fichier Open project: tastyigniter/tastyigniter Class Usage Examples

Méthodes publiques

Свойство Type Description
$auto_heading boolean Whether or not to automatically create the table header
$caption string Table caption
$empty_cells string Contents of empty cells
$function function Callback for custom table layout
$heading array Data for table heading
$newline string Newline setting
$rows array Data for table rows
$template array Table layout template

Méthodes publiques

Méthode Description
__construct ( array $config = [] ) : void Set the template from the table config file if it exists
add_row ( $args = [] ) : CI_Table Add a table row
clear ( ) : CI_Table Clears the table arrays. Useful if multiple tables are being generated
generate ( mixed $table_data = NULL ) : string Generate the table
make_columns ( array $array = [], integer $col_limit ) : array Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.
set_caption ( string $caption ) : CI_Table Add a table caption
set_empty ( mixed $value ) : CI_Table Set "empty" cells
set_heading ( $args = [] ) : CI_Table Set the table heading
set_template ( array $template ) : boolean Set the template

Méthodes protégées

Méthode Description
_compile_template ( ) : void Compile Template
_default_template ( ) : array Default Template
_prep_args ( $args ) : array Prep Args
_set_from_array ( array $data ) : void Set table data from an array
_set_from_db_result ( $object ) : void Set table data from a database result object

Method Details

__construct() public méthode

Set the template from the table config file if it exists
public __construct ( array $config = [] ) : void
$config array (default: array())
Résultat void

_compile_template() protected méthode

Compile Template
protected _compile_template ( ) : void
Résultat void

_default_template() protected méthode

Default Template
protected _default_template ( ) : array
Résultat array

_prep_args() protected méthode

Ensures a standard associative array format for all cell data
protected _prep_args ( $args ) : array
Résultat array

_set_from_array() protected méthode

Set table data from an array
protected _set_from_array ( array $data ) : void
$data array
Résultat void

_set_from_db_result() protected méthode

Set table data from a database result object
protected _set_from_db_result ( $object ) : void
Résultat void

add_row() public méthode

Can be passed as an array or discreet params
public add_row ( $args = [] ) : CI_Table
Résultat CI_Table

clear() public méthode

Clears the table arrays. Useful if multiple tables are being generated
public clear ( ) : CI_Table
Résultat CI_Table

generate() public méthode

Generate the table
public generate ( mixed $table_data = NULL ) : string
$table_data mixed
Résultat string

make_columns() public méthode

Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.
public make_columns ( array $array = [], integer $col_limit ) : array
$array array
$col_limit integer
Résultat array

set_caption() public méthode

Add a table caption
public set_caption ( string $caption ) : CI_Table
$caption string
Résultat CI_Table

set_empty() public méthode

Can be passed as an array or discreet params
public set_empty ( mixed $value ) : CI_Table
$value mixed
Résultat CI_Table

set_heading() public méthode

Can be passed as an array or discreet params
public set_heading ( $args = [] ) : CI_Table
Résultat CI_Table

set_template() public méthode

Set the template
public set_template ( array $template ) : boolean
$template array
Résultat boolean

Property Details

$auto_heading public_oe property

Whether or not to automatically create the table header
public bool $auto_heading
Résultat boolean

$caption public_oe property

Table caption
public string $caption
Résultat string

$empty_cells public_oe property

Contents of empty cells
public string $empty_cells
Résultat string

$function public_oe property

Callback for custom table layout
public function $function
Résultat function

$heading public_oe property

Data for table heading
public array $heading
Résultat array

$newline public_oe property

Newline setting
public string $newline
Résultat string

$rows public_oe property

Data for table rows
public array $rows
Résultat array

$template public_oe property

Table layout template
public array $template
Résultat array