PHP Класс CI_Table, TastyIgniter

Lets you create tables manually or from database result objects, or arrays.
Автор: ExpressionEngine Dev Team
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
_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

Описание методов

__construct() публичный Метод

Set the template from the table config file if it exists
public __construct ( array $config = [] ) : void
$config array (default: array())
Результат void

_compile_template() защищенный Метод

Compile Template
protected _compile_template ( ) : void
Результат void

_default_template() защищенный Метод

Default Template
protected _default_template ( ) : array
Результат array

_prep_args() защищенный Метод

Ensures a standard associative array format for all cell data
protected _prep_args ( $args ) : array
Результат array

_set_from_array() защищенный Метод

Set table data from an array
protected _set_from_array ( array $data ) : void
$data array
Результат void

_set_from_db_result() защищенный Метод

Set table data from a database result object
protected _set_from_db_result ( $object ) : void
Результат void

add_row() публичный Метод

Can be passed as an array or discreet params
public add_row ( $args = [] ) : CI_Table
Результат CI_Table

clear() публичный Метод

Clears the table arrays. Useful if multiple tables are being generated
public clear ( ) : CI_Table
Результат CI_Table

generate() публичный Метод

Generate the table
public generate ( mixed $table_data = NULL ) : string
$table_data mixed
Результат string

make_columns() публичный Метод

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
Результат array

set_caption() публичный Метод

Add a table caption
public set_caption ( string $caption ) : CI_Table
$caption string
Результат CI_Table

set_empty() публичный Метод

Can be passed as an array or discreet params
public set_empty ( mixed $value ) : CI_Table
$value mixed
Результат CI_Table

set_heading() публичный Метод

Can be passed as an array or discreet params
public set_heading ( $args = [] ) : CI_Table
Результат CI_Table

set_template() публичный Метод

Set the template
public set_template ( array $template ) : boolean
$template array
Результат boolean

Описание свойств

$auto_heading публичное свойство

Whether or not to automatically create the table header
public bool $auto_heading
Результат boolean

$caption публичное свойство

Table caption
public string $caption
Результат string

$empty_cells публичное свойство

Contents of empty cells
public string $empty_cells
Результат string

$function публичное свойство

Callback for custom table layout
public function $function
Результат function

$heading публичное свойство

Data for table heading
public array $heading
Результат array

$newline публичное свойство

Newline setting
public string $newline
Результат string

$rows публичное свойство

Data for table rows
public array $rows
Результат array

$template публичное свойство

Table layout template
public array $template
Результат array