events_reg_history_bar start_id display_size reg_range_sql max_reg_sql db url { url_vars " " }What it does:
start_id: the reg_id at which you'd like to start viewing your order history display_size: the number of reg_id's you'd like to view in one block reg_range_sql: a sql statement which selects the reg_id's in which you're interested. This select must be ordered in increasing order: order by reg_id asc max_reg_sql: a sql statement which selects the maximum reg_id from the reg_id's in which you're interested. This maximum reg_id must be named, 'max_reg_id' db: database handle url: the url of the page calling this proc url_vars: any variables passwd into url EFFECTS: returns an html bar which will allow the user to view reg_id's in chunks of size display_size. creates in the calling environment several variables: reg_id_sql, reg_range, and events_range_bar. reg_id_sql is a clause to be inserted at the end of your sql query for displaying registration id's in the calling environment. It will restrict the returned reg_id's to be between a certain range, if appropriate. reg_range is the largest reg_id which applies to your order history. events_range_bar is the html bar for selecting which chunk of reg_id's to view.Defined in: /web/philip/tcl/events-defs.tcl
Source code:
#get the maximum reg_id
set selection [ns_db select $db $max_reg_sql]
set reg_range 0
while {[ns_db getrow $db $selection]} {
set_variables_after_query
if {$max_reg_id > $reg_range} {
set reg_range $max_reg_id
}
}
#pass this into the upper calling environment
uplevel "set reg_range $reg_range"
set events_range_bar [events_range_bar $start_id $display_size $reg_range $reg_range_sql $db $url $url_vars]
regsub -all {\"} $events_range_bar {\\"} events_range_bar
#pass this into the upper calling environment
uplevel "set events_range_bar \"$events_range_bar\""
if {$start_id < 0} {
#display all registrations
set reg_id_sql ""
} else {
#end_index comes from events_range_bar
set reg_id_sql "and reg_id >= $start_id and reg_id <= $end_index"
}
#pass this into the upper calling environment
uplevel "set reg_id_sql \"$reg_id_sql\""