xowf::test_item::Answer_manager method participants_table (public)
<instance of xowf::test_item::Answer_manager> participants_table \ [ -package_id package_id ] -items items \ [ -view_all_method view_all_method ] [ -state state ] wf
Defined in packages/xowf/tcl/test-item-procs.tcl
This method returns an HTML table containing a row for every participant with Name and short summary information. This table provides as well an interface for sending messages to this student.
- Switches:
- -package_id (optional, integer)
- -items (required, object)
- -view_all_method (optional, defaults to
"print-answers"
)- -state (optional, defaults to
"done"
)- Parameters:
- wf (required, object)
- Testcases:
- No testcase defined.
Source code: set form_field_objs {} lappend form_field_objs [$wf create_raw_form_field -name _online-exam-userName -spec text,label=#xowf.participant#] [$wf create_raw_form_field -name _online-exam-fullName -spec label,label=#acs-subsite.Name#,disableOutputEscaping=true] [$wf create_raw_form_field -name _state -spec text,label=#xowf.Status#] [$wf create_raw_form_field -name _online-exam-seconds -spec number,label=#xowf.Seconds#] [$wf create_raw_form_field -name _creation_date -spec date,label=#xowiki.Page-last_modified#] # # Take "orderby" from the query parameter. If not set, order by # the first field. # set orderby [::$package_id query_parameter orderby:token ""] if {$orderby eq "" && [llength $form_field_objs] > 0} { set orderby [[lindex $form_field_objs 0] name],asc } # # Create table widget. # set table_widget [::xowiki::TableWidget create_from_form_fields -package_id $package_id -form_field_objs $form_field_objs -type_map {_online-exam-seconds integer} -orderby $orderby] # # Extend properties of individual answers and add notification # dialogs. # set dialogs "" set user_list {} foreach p [$items children] { #foreach ff_obj $answer_form_field_objs { # $ff_obj object $p # set property [$ff_obj name] # $ff_obj value [$p property $property] #} # # Provide a notification dialog only before the student has # submitted her exam and the exam is published. # if {[$p state] ne "done" && [$wf state] eq "published"} { set dialog_info [::xowiki::includelet::personal-notification-messages modal_message_dialog -to_user_id [$p creation_user]] append dialogs [dict get $dialog_info dialog] \n set notification_dialog_button [dict get $dialog_info link] $p set online-exam-fullName "$notification_dialog_button [$p set online-exam-fullName]</a>" lappend user_list [$p creation_user] } # # Extend every answer with corresponding precomputed extra # "_online-exam-*" values to ease rendering: # set duration [:get_duration [$p get_revision_sets]] $p set_property -new 1 _online-exam-seconds [dict get $duration seconds] } ::xowiki::includelet::personal-notification-messages modal_message_dialog_register_submit -url [$wf pretty_link -query m=send-participant-message] set bulk_notification_HTML "" if {$state eq "done"} { set uc {tcl {[$p state] ne "done"}} } else { set uc {tcl {false}} if {[llength $user_list] > 0} { # # Provide bulk notification message dialog to send message to all users # set dialog_info [::xowiki::includelet::personal-notification-messages modal_message_dialog -to_user_id $user_list] append dialogs [dict get $dialog_info dialog] \n set notification_dialog_button [dict get $dialog_info link] set bulk_notification_HTML "<div class='bulk-personal-notification-message'>$notification_dialog_button #xowiki.Send_message_to# [llength $user_list] #xowf.Participants#</a></div>" } } # # Render table widget with extended properties. # set HTML [$table_widget render_page_items_as_table -package_id $package_id -items $items -form_field_objs $form_field_objs -csv true -uc $uc -view_field _online-exam-userName -view_filter_link [$wf pretty_link -query m=$view_all_method] {*}[expr {[info exists generate] ? [list -generate $generate] : ""}] -return_url [ad_return_url] -return_url_att local_return_url ] $table_widget destroy return $dialogs$HTML$bulk_notification_HTMLXQL Not present: Generic, PostgreSQL, Oracle