xowf::test_item::Answer_manager method render_proctor_images (protected)
<instance of xowf::test_item::Answer_manager> render_proctor_images \ [ -submission submission ] [ -revisions revisions ] \ [ -examWf examWf ] [ -revision_id revision_id ]
Defined in packages/xowf/tcl/test-item-procs.tcl
Render proctor images the provided submission.
- Switches:
- -submission (optional, object)
- -revisions (optional)
- -examWf (optional, object)
- -revision_id (optional)
- Returns:
- HTML
- Testcases:
- No testcase defined.
Source code: set user_id [$submission creation_user] set img_url [$examWf pretty_link -query m=proctor-image&user_id=$user_id] set proctoring_dir [proctoring::folder -object_id [$examWf item_id] -user_id $user_id] set files [glob -nocomplain -directory $proctoring_dir *.*] #ns_log notice "proctoring_dir $proctoring_dir files $files" if {$revision_id ne ""} { set filtered_revisions [:revisions_up_to $revisions $revision_id] } else { set filtered_revisions $revisions } set start_date [ns_set get [lindex $filtered_revisions 0] creation_date] set end_date [ns_set get [lindex $filtered_revisions end] last_modified] set start_clock [clock scan [::xo::db::tcl_date $start_date tz_var]] set end_clock [clock scan [::xo::db::tcl_date $end_date tz_var]] set image "" #ns_log notice "start date $start_date end_date $end_date / $start_clock $end_clock" foreach f $files { #ns_log notice "check: $f" if {[regexp {/([^/]+)-(\d+|\d+[.]\d+)[.](webm|png|jpeg)$} $f . type stamp ext]} { set inWindow [expr {$stamp >= $start_clock && $stamp <= $end_clock}] ns_log notice "parsed $type $stamp $ext $inWindow $stamp " [clock format $stamp -format {%m-%d %H:%M:%S}] >= $start_clock ([expr {$stamp >= $start_clock}]) && $stamp <= $end_clock ([expr {$stamp <= $end_clock}]) if {$inWindow} { dict set image $stamp $type $ext } } } set markup "" foreach ts [lsort -integer [dict keys $image]] { #ns_log notice "ts $ts [dict get $image $ts]" append markup [subst {<div>[clock format $ts -format {%Y-%m-%d %H:%M:%S}]</div>}] append markup {<div style="display: flex">} foreach type {camera-image desktop-image} { if {[dict exists $image $ts $type]} { set ext [dict get $image $ts $type] append markup [subst {<img height="240" src="$img_url&type=$type&ts=$ts&e=$ext">}] } } if {[dict exists $image $ts camera-audio]} { set ext [dict get $image $ts camera-audio] append markup [subst {<audio controls src="$img_url&type=camera-audio&ts=$ts&e=$ext" type="video/webm"></audio>}] } append markup </div>\n } return $markupXQL Not present: Generic, PostgreSQL, Oracle