PHP Class Grid_Advanced, atk4

Inheritance: extends Grid_Basic
Afficher le fichier Open project: atk4/atk4 Class Usage Examples

Méthodes publiques

Свойство Type Description
$_url
$data Static data source?
$js_widget JavaScript widget
$js_widget_arguments
$paginator Paginator Paginator object.
$paginator_class string Paginator class name.
$quick_search QuickSearch QuickSearch object.
$quick_search_class string QuickSearch class name.
$sortby Sorting
$sortby_db

Protected Properties

Свойство Type Description
$tdparam array This should be a hash: 'param_name'=>'param_value' Following parameters treated and processed in a special way: 1) 'style': nested array, style parameter. items of this nested array converted to a form of style: style="param_name: param_value; param_name: param_value". All the rest are not checked and simply converted to a form of param_name="param_value" This is a tree-like array with the following structure: array( [level1] => dataset_row = array( [level2] => field = array( [level3] => tdparam_elements = array( param_name => param_value ) ) ) )

Méthodes publiques

Méthode Description
_performDelete ( string $id ) Delete record from DB.
addOrder ( ) : Order Adds column ordering object.
addPaginator ( integer $rows = 25, array $options = null, string $class = null ) : Paginator Adds paginator to the grid.
addQuickSearch ( array $fields, array $options = null, string $class = null, string $spot = null ) : QuickSearch Adds QuickSearch to the grid.
addSelectable ( mixed $field ) Adds column with checkboxes on the basis of Model definition.
applySorting ( Iterator $i, string $field, string | boolean $desc ) Apply sorting on particular field.
applyTDParams ( string $field, SQLite &$row_template = null ) Apply TD parameters to appropriate template.
enablePaginator ( integer $rows = 25, array $options = null ) Add default paginator to the grid.
enableQuickSearch ( array $fields, array $options = null ) Adds default QuickSearch to the grid.
formatTotalsRow ( ) Additional formatting for Totals row.
format_boolean ( string $field ) Format field as boolean.
format_button ( string $field ) Format field as button.
format_checkbox ( string $field ) Format field as checkbox.
format_confirm ( string $field ) Format field as confirm button.
format_date ( string $field ) Format field as date.
format_datetime ( string $field ) Format field as datetime.
format_delete ( string $field ) Format field as delete button.
format_expander ( string $field, array $column ) Format expander.
format_float ( string $field ) Format field as real number with 2 digit precision.
format_fullwidth ( string $field ) Format field as full width field.
format_html ( string $field ) Format field as HTML without encoding. Use with care.
format_image ( string $field ) Format field as HTML image tag.
format_link ( string $field ) Format field as link.
format_money ( string $field ) Format field as money with 2 digit precision.
format_nl2br ( string $field ) Format field as New-Line to BR-eak.
format_nowrap ( string $field ) Format field as no-wrap field.
format_number ( string $field ) Format field as number.
format_object ( string $field ) Format field as object.
format_password ( string $field ) Format password field.
format_prompt ( string $field ) Format field as prompt button.
format_real ( $field )
format_shorttext ( string $field ) Format shorttext field.
format_template ( string $field ) Format field using template.
format_time ( string $field ) Format field as time.
format_timestamp ( string $field ) Format field as timestamp.
format_totals_checkbox ( string $field, array $column ) Additional formatting of checkbox fields column for totals row.
format_totals_delete ( string $field, array $column ) Additional formatting of delete button fields for totals row.
format_totals_expander ( string $field, array $column ) Additional formatting of expander fields for totals row.
format_totals_money ( string $field ) Additional formatting of money fields for totals row.
format_totals_number ( string $field ) Additional formatting of number fields for totals row.
format_totals_real ( string $field ) Additional formatting of real number fields for totals row.
format_totals_template ( string $field, array $column ) Additional formatting of custom template fields for totals row.
format_wrap ( string $field ) Format field as wrap field.
getCurrentIndex ( string $idfield = 'id' ) : mixed Returns ID of record.
getIterator ( ) : mixed Returns data source iterator.
init ( ) Initialization.
init_boolean ( string $field ) Initialize column as boolean.
init_button ( string $field ) Initialize buttons column.
init_confirm ( string $field ) Initialize confirm buttons column.
init_delete ( string $field ) Initialize column with delete buttons.
init_expander ( string $field ) Initialize expander.
init_float ( string $field ) Initialize column as real number.
init_fullwidth ( string $field ) Initialize column as fullwidth.
init_link ( string $field ) Initialize column with links using template.
init_money ( string $field ) Initialize column as money.
init_prompt ( string $field ) Initialize prompt buttons column.
init_real ( $field )
makeSortable ( string $db_sort = null ) Make sortable.
render ( ) Render grid.
renderTotalsRow ( ) Render Totals row.
setTDParam ( string $field, string $path, string $value ) Sets TD params.
setTemplate ( string $template, $field = null ) This allows you to use Template.
setTotalsTitle ( string $field, string $title = 'Total: %s row%s' ) Sets totals title field and text.
staticSortCompare ( string $str1, string $str2 ) : integer Compare two strings and return: < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
updateGrandTotals ( ) Calculate grand totals of all rows.
updateTotals ( ) Add current rendered row values to totals.

Method Details

_performDelete() public méthode

Formatter init_delete() calls this to delete current record from DB
public _performDelete ( string $id )
$id string ID of record

addOrder() public méthode

With it you can reorder your columns
public addOrder ( ) : Order
Résultat Order

addPaginator() public méthode

Adds paginator to the grid.
public addPaginator ( integer $rows = 25, array $options = null, string $class = null ) : Paginator
$rows integer row count per page
$options array optional options array
$class string optional paginator class name
Résultat Paginator

addQuickSearch() public méthode

Adds QuickSearch to the grid.
public addQuickSearch ( array $fields, array $options = null, string $class = null, string $spot = null ) : QuickSearch
$fields array array of fieldnames used in quick search
$options array optional options array
$class string optional quick search object class
$spot string optional template spot
Résultat QuickSearch

addSelectable() public méthode

Adds column with checkboxes on the basis of Model definition.
public addSelectable ( mixed $field )
$field mixed should be Form_Field object or jQuery selector of 1 field. When passing it as jQuery selector don't forget to use hash sign like "#myfield"

applySorting() public méthode

Apply sorting on particular field.
public applySorting ( Iterator $i, string $field, string | boolean $desc )
$i Iterator
$field string
$desc string | boolean

applyTDParams() public méthode

You can pass row template to use too. That's useful to set up totals rows, for example.
public applyTDParams ( string $field, SQLite &$row_template = null )
$field string Fieldname
$row_template SQLite Optional row template

enablePaginator() public méthode

Add default paginator to the grid.
public enablePaginator ( integer $rows = 25, array $options = null )
$rows integer row count per page
$options array optional options array

enableQuickSearch() public méthode

Adds default QuickSearch to the grid.
public enableQuickSearch ( array $fields, array $options = null )
$fields array array of fieldnames used in quick search
$options array optional options array

formatTotalsRow() public méthode

Extends CompleteLister formatTotalsRow method. Note: in this method you should only add *additional* formatting of totals row because standard row formatting will be already applied by calling parent::formatTotalsRow().
public formatTotalsRow ( )

format_boolean() public méthode

Format field as boolean.
public format_boolean ( string $field )
$field string

format_button() public méthode

Format field as button.
public format_button ( string $field )
$field string

format_checkbox() public méthode

Format field as checkbox.
public format_checkbox ( string $field )
$field string

format_confirm() public méthode

Format field as confirm button.
public format_confirm ( string $field )
$field string

format_date() public méthode

Format field as date.
public format_date ( string $field )
$field string

format_datetime() public méthode

Format field as datetime.
public format_datetime ( string $field )
$field string

format_delete() public méthode

Format field as delete button.
public format_delete ( string $field )
$field string

format_expander() public méthode

Format expander.
public format_expander ( string $field, array $column )
$field string field name
$column array column configuration

format_float() public méthode

Format field as real number with 2 digit precision.
public format_float ( string $field )
$field string

format_fullwidth() public méthode

Format field as full width field.
public format_fullwidth ( string $field )
$field string

format_html() public méthode

Format field as HTML without encoding. Use with care.
public format_html ( string $field )
$field string

format_image() public méthode

Format field as HTML image tag.
public format_image ( string $field )
$field string

format_money() public méthode

Format field as money with 2 digit precision.
public format_money ( string $field )
$field string

format_nl2br() public méthode

Format field as New-Line to BR-eak.
public format_nl2br ( string $field )
$field string

format_nowrap() public méthode

Format field as no-wrap field.
public format_nowrap ( string $field )
$field string

format_number() public méthode

Format field as number.
public format_number ( string $field )
$field string

format_object() public méthode

Format field as object.
public format_object ( string $field )
$field string

format_password() public méthode

Format password field.
public format_password ( string $field )
$field string

format_prompt() public méthode

Format field as prompt button.
public format_prompt ( string $field )
$field string

format_real() public méthode

public format_real ( $field )

format_shorttext() public méthode

Format shorttext field.
public format_shorttext ( string $field )
$field string

format_template() public méthode

Format field using template.
public format_template ( string $field )
$field string

format_time() public méthode

Format field as time.
public format_time ( string $field )
$field string

format_timestamp() public méthode

Format field as timestamp.
public format_timestamp ( string $field )
$field string

format_totals_checkbox() public méthode

Basically we remove everything from such field
public format_totals_checkbox ( string $field, array $column )
$field string field name
$column array column configuration

format_totals_delete() public méthode

Basically we remove everything from such field
public format_totals_delete ( string $field, array $column )
$field string field name
$column array column configuration

format_totals_expander() public méthode

Basically we remove everything from such field
public format_totals_expander ( string $field, array $column )
$field string field name
$column array column configuration

format_totals_money() public méthode

Additional formatting of money fields for totals row.
public format_totals_money ( string $field )
$field string

format_totals_number() public méthode

Additional formatting of number fields for totals row.
public format_totals_number ( string $field )
$field string

format_totals_real() public méthode

Additional formatting of real number fields for totals row.
public format_totals_real ( string $field )
$field string

format_totals_template() public méthode

Basically we remove everything from such field
public format_totals_template ( string $field, array $column )
$field string field name
$column array column configuration

format_wrap() public méthode

Format field as wrap field.
public format_wrap ( string $field )
$field string

getCurrentIndex() public méthode

Returns ID of record.
public getCurrentIndex ( string $idfield = 'id' ) : mixed
$idfield string ID field name
Résultat mixed

getIterator() public méthode

Returns data source iterator.
public getIterator ( ) : mixed
Résultat mixed

init() public méthode

Initialization.
public init ( )

init_boolean() public méthode

Initialize column as boolean.
public init_boolean ( string $field )
$field string

init_button() public méthode

Initialize buttons column.
public init_button ( string $field )
$field string

init_confirm() public méthode

Initialize confirm buttons column.
public init_confirm ( string $field )
$field string

init_delete() public méthode

Initialize column with delete buttons.
public init_delete ( string $field )
$field string

init_expander() public méthode

Initialize expander.
public init_expander ( string $field )
$field string field name

init_float() public méthode

Initialize column as real number.
public init_float ( string $field )
$field string

init_fullwidth() public méthode

Initialize column as fullwidth.
public init_fullwidth ( string $field )
$field string

init_money() public méthode

Initialize column as money.
public init_money ( string $field )
$field string

init_prompt() public méthode

Initialize prompt buttons column.
public init_prompt ( string $field )
$field string

init_real() public méthode

public init_real ( $field )

makeSortable() public méthode

Make sortable.
public makeSortable ( string $db_sort = null )
$db_sort string

render() public méthode

Render grid.
public render ( )

renderTotalsRow() public méthode

Render Totals row.
public renderTotalsRow ( )

setTDParam() public méthode

Sets TD params.
public setTDParam ( string $field, string $path, string $value )
$field string
$path string
$value string

setTemplate() public méthode

This allows you to use Template.
public setTemplate ( string $template, $field = null )
$template string template as a string

setTotalsTitle() public méthode

Sets totals title field and text.
public setTotalsTitle ( string $field, string $title = 'Total: %s row%s' )
$field string
$title string

staticSortCompare() public méthode

Note that this comparison is case sensitive
public staticSortCompare ( string $str1, string $str2 ) : integer
$str1 string
$str2 string
Résultat integer

updateGrandTotals() public méthode

Called one time on rendering phase - before renderRows() call.
public updateGrandTotals ( )

updateTotals() public méthode

Called before each formatRow() call.
public updateTotals ( )

Property Details

$_url public_oe property

public $_url

$data public_oe property

Static data source?
public $data

$js_widget public_oe property

JavaScript widget
public $js_widget

$js_widget_arguments public_oe property

public $js_widget_arguments

$paginator public_oe property

Paginator object.
See also: addPaginator()
public Paginator $paginator
Résultat Paginator

$paginator_class public_oe property

Paginator class name.
See also: enablePaginator()
public string $paginator_class
Résultat string

$quick_search_class public_oe property

QuickSearch class name.
See also: enableQuickSearch()
public string $quick_search_class
Résultat string

$sortby public_oe property

Sorting
public $sortby

$sortby_db public_oe property

public $sortby_db

$tdparam protected_oe property

This should be a hash: 'param_name'=>'param_value' Following parameters treated and processed in a special way: 1) 'style': nested array, style parameter. items of this nested array converted to a form of style: style="param_name: param_value; param_name: param_value". All the rest are not checked and simply converted to a form of param_name="param_value" This is a tree-like array with the following structure: array( [level1] => dataset_row = array( [level2] => field = array( [level3] => tdparam_elements = array( param_name => param_value ) ) ) )
protected array $tdparam
Résultat array