template::paginator::get_groups (public)

 template::paginator::get_groups name group count

Defined in packages/acs-templating/tcl/paginator-procs.tcl

Determines the set of groups to which a group belongs, and calculates the starting page of each group in that set.

Parameters:
name - The reference to the paginator object.
group - A number ranging from one to the number of page groups in the query result.
count - The desired size of the group set.
Returns:
A Tcl list of page numbers.

Partial Call Graph (max 5 caller/called nodes):
%3 template::paginator::get_reference template::paginator::get_reference (private) template::paginator::get_groups template::paginator::get_groups template::paginator::get_groups->template::paginator::get_reference

Testcases:
No testcase defined.
Source code:
    get_reference

    set group_count $properties(group_count)
    set page_count $properties(page_count)
    set group_size $properties(groupsize)
    set page_size $properties(pagesize)

    if { $group > $group_count } {
        if { $group_count == 0 } {
            return ""
        }
        error "Group out of bounds ($group > $group_count)"
    }

    set first [expr {($group - 1 - (($group - 1) % $count)) / $count + 1}]

    set start [expr {($first - 1) * $group_size + 1}]
    set end [expr {$start + $group_size * $page_size - 1}]

    if { $end > $page_count } { set end $page_count) }

    set pages [list]

    for { set i $start } { $i <= $end } { incr i $group_size } {
        lappend pages $i
    }

    return $pages
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-templating/tcl/paginator-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: