PHP 클래스 CompleteLister, atk4

Also adds support for calculating totals. Use: $list = $this->add('CompleteLister'); $list->setModel('User'); $list->addTotals(); Template (view/users.html):

Users

Joe Blogs

Sample template. Will be ignored

user.
상속: extends Lister
파일 보기 프로젝트 열기: atk4/atk4 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$even_css_class Used CSS class for even rows
$odd_css_class Used CSS class for odd rows
$row_t Item ($item_tag) template
$sep_html Separator
$total_rows integer After rendering will contain data row count
$totals array | boolean Will contain accumulated totals for all fields
$totals_t Template Will be initialized to "totals" template when _addTotals() is called

보호된 프로퍼티들

프로퍼티 타입 설명
$container_tag Template tag for container
$item_tag Template tag for item
$odd_even Is current odd or even row?
$totals_type string Should be changed using addTotals and addGrandTotals methods only

공개 메소드들

메소드 설명
addGrandTotals ( array $fields = UNDEFINED ) Enable totals calculation for specified array of fields.
addTotals ( array $fields = UNDEFINED ) Enable totals calculation for specified array of fields.
defaultTemplate ( ) : array Default template.
formatRow ( ) Format lister row.
formatTotalsRow ( ) Additional formatting for Totals row.
init ( ) Initialization.
removeTotals ( ) Disable totals calculation.
render ( ) Render lister.
renderDataRow ( ) Render data row.
renderRows ( ) Render lister rows.
renderSeparator ( )
renderTotalsRow ( ) Render Totals row.
updateGrandTotals ( ) Calculate grand totals of all rows.
updateTotals ( ) Add current rendered row values to totals.

보호된 메소드들

메소드 설명
_addTotals ( array $fields = UNDEFINED, string $type = null ) Private method to enable / disable totals calculation for specified array of fields.

메소드 상세

_addTotals() 보호된 메소드

If particular fields not specified, then all field totals are calculated. If you only need to count records, then pass null and no fields will be calculated.
protected _addTotals ( array $fields = UNDEFINED, string $type = null )
$fields array optional array of fieldnames
$type string type of totals calculation (null|onRender|onRequest)

addGrandTotals() 공개 메소드

If particular fields not specified, then all field totals are calculated. If you only need to count records, then pass null and no fields will be calculated. Be aware that this method works ONLY for SQL models set as data source because this calculates grand totals using DSQL.
public addGrandTotals ( array $fields = UNDEFINED )
$fields array optional array of fieldnames

addTotals() 공개 메소드

If particular fields not specified, then all field totals are calculated. If you only need to count records, then pass null and no fields will be calculated. Be aware that if you use Paginator, then only records of current page will be calculated. If you need grand totals for all records, then use method addGrandTotals() instead.
public addTotals ( array $fields = UNDEFINED )
$fields array optional array of fieldnames

defaultTemplate() 공개 메소드

Default template.
public defaultTemplate ( ) : array
리턴 array

formatRow() 공개 메소드

Format lister row.
public formatRow ( )

formatTotalsRow() 공개 메소드

Additional formatting for Totals row.
public formatTotalsRow ( )

init() 공개 메소드

Initialization.
public init ( )

removeTotals() 공개 메소드

Disable totals calculation.
public removeTotals ( )

render() 공개 메소드

Render lister.
public render ( )

renderDataRow() 공개 메소드

Render data row.
public renderDataRow ( )

renderRows() 공개 메소드

Render lister rows.
public renderRows ( )

renderSeparator() 공개 메소드

public renderSeparator ( )

renderTotalsRow() 공개 메소드

Render Totals row.
public renderTotalsRow ( )

updateGrandTotals() 공개 메소드

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

updateTotals() 공개 메소드

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

프로퍼티 상세

$container_tag 보호되어 있는 프로퍼티

Template tag for container
protected $container_tag

$even_css_class 공개적으로 프로퍼티

Used CSS class for even rows
public $even_css_class

$item_tag 보호되어 있는 프로퍼티

Template tag for item
protected $item_tag

$odd_css_class 공개적으로 프로퍼티

Used CSS class for odd rows
public $odd_css_class

$odd_even 보호되어 있는 프로퍼티

Is current odd or even row?
protected $odd_even

$row_t 공개적으로 프로퍼티

Item ($item_tag) template
public $row_t

$sep_html 공개적으로 프로퍼티

Separator
public $sep_html

$total_rows 공개적으로 프로퍼티

After rendering will contain data row count
public int $total_rows
리턴 integer

$totals 공개적으로 프로퍼티

Will contain accumulated totals for all fields
public array|bool $totals
리턴 array | boolean

$totals_t 공개적으로 프로퍼티

Will be initialized to "totals" template when _addTotals() is called
public Template $totals_t
리턴 Template

$totals_type 보호되어 있는 프로퍼티

Should be changed using addTotals and addGrandTotals methods only
protected string $totals_type
리턴 string