xowf::test_item::Answer_manager method runtime_panel (public)
<instance of xowf::test_item::Answer_manager> runtime_panel \ [ -revision_id revision_id ] [ -view view ] \ [ -grading_info grading_info ] answerObj
Defined in packages/xowf/tcl/test-item-procs.tcl
Return statistics for the provided object in the form of HTML: - minimal statistics: when view default - statistics with clickable revisions: when view = revision_overview - per-revision statistics: when view = revision_overview and revision_id is provided
- Switches:
- -revision_id (optional)
- -view (optional, defaults to
"default"
)- -grading_info (optional)
- Parameters:
- answerObj (required, object)
- Returns:
- HTML block
- Testcases:
- No testcase defined.
Source code: set revision_sets [$answerObj get_revision_sets] set parent_revision_sets [[$answerObj parent_id] get_revision_sets] set item_id [$answerObj item_id] set live_revision_id [xo::dc get_value -prepare integer live_revision_id { select live_revision from cr_items where item_id = :item_id }] set current_question [expr {[dict get [$answerObj instance_attributes] position] + 1}] set page_info "#xowf.question#: $current_question" if {$view eq "default"} { set url [ad_return_url]&id=$item_id set revisionDetails "#xowf.nr_changes#: <a href='[ns_quotehtml $url]'>[llength $revision_sets]</a><br>" } elseif {$view eq "student"} { set revisionDetails "" } elseif {$view eq "revision_overview"} { set displayed_revision_info "" set live_revision_info "" set make_live_info "" set baseUrl [ns_conn url] set filtered_revision_sets [:revisions_up_to $revision_sets $revision_id] set c 0 foreach s $revision_sets { set rid [ns_set get $s revision_id] incr c if {$rid == $live_revision_id} { set liveCSSclass "live" set live_revision_info "#xowf.Live_revision#: $c" } else { set liveCSSclass "other" } set revision_url $baseUrl?[::xo::update_query [ns_conn query] rid $rid] if {$rid == [$answerObj revision_id]} { set suffix "*" set displayed_revision_info "#xowf.Displayed_revision#: $c" if {$rid ne $live_revision_id} { set query [::xo::update_query [ns_conn query] m make-live-revision] set query [::xo::update_query $query revision_id $rid] set query [::xo::update_query $query local_return_url [ad_return_url]] set live_revision_link $baseUrl?$query set make_live_info [subst { <a class="button" href="[ns_quotehtml $live_revision_link]">#xowf.Make_live_revision#</a> }] lappend revision_list "<span class='current'>$c</span>" } else { lappend revision_list "<span class='$liveCSSclass'>$c</span>" } } else { lappend revision_list [subst { <a class="$liveCSSclass" title="#xowf.Goto_this_revision#" href="[ns_quotehtml $revision_url]">$c</a> }] } } set revision_sets $filtered_revision_sets set revisionDetails [subst {#xowiki.revisions#: [join $revision_list {, }] <div class="revision-details right">$displayed_revision_info<br>$live_revision_info<br> $make_live_info </div> <br> }] } if {$revision_id eq ""} { set revision_sets [:revisions_up_to $revision_sets $live_revision_id] } set toClock [clock scan [::xo::db::tcl_date [ns_set get [lindex $revision_sets end] last_modified] tz]] set last_published [:last_time_switched_to_state $parent_revision_sets -state published -before $toClock] #ns_log notice "LAST PUBLISHED $last_published" set duration [:get_duration -exam_published_time $last_published $revision_sets] set state [$answerObj state] if {$state eq "done"} { set submission_info "#xowf.submitted#" } else { set submission_info "#xowf.not_submitted# ($page_info)" } if {[dict exists $duration examPublished]} { set publishedInfo "#xowf.Exam_published#: <span class='data'>[dict get $duration examPublished]</span><br>" set extraDurationInfo " - #xowf.since_published#: [dict get $duration examPublishedDuration]" } else { set publishedInfo "" set extraDurationInfo "" } if {$view eq "student"} { set IPinfo "" set statusInfo "" set extraDurationInfo "" set publishedInfo "" } else { set IPinfo [subst {IP: <span class="data">[:get_IPs $revision_sets]</span>}] set statusInfo "#xowf.Status#: <span class='data'>$submission_info</span><br>" } if {$grading_info ne ""} { set achievedPointsInfo [subst { #xowf.Achieved_points#: <span class='data achieved-points'>$grading_info</span><br> }] } else { set achievedPointsInfo "" } set HTML [subst { $publishedInfo $revisionDetails $statusInfo #xowf.Duration#: <span class="data">[dict get $duration from] - [dict get $duration to] ([dict get $duration duration]$extraDurationInfo)</span><br> $achievedPointsInfo $IPinfo }] return $HTMLXQL Not present: Generic, PostgreSQL, Oracle