xowf::test_item::Answer_manager method create_workflow (public)

 <instance of xowf::test_item::Answer_manager[i]> create_workflow \
    [ -answer_workflow answer_workflow ] \
    [ -master_workflow master_workflow ] parentObj

Defined in packages/xowf/tcl/test-item-procs.tcl

Create a workflow based on the template provided in this method for answering the question for the students. The name of the workflow is derived from the workflow instance and recorded in the formfield "wfName". :log "create_answer_workflow $parentObj"

Switches:
-answer_workflow
(defaults to "/packages/xowf/lib/online-exam-answer.wf") (optional)
-master_workflow
(defaults to "en:Workflow.form") (optional)
Parameters:
parentObj

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_test_items create_test_items (test xowf) xowf::test_item::Answer_manager instproc create_workflow xowf::test_item::Answer_manager instproc create_workflow test_create_test_items->xowf::test_item::Answer_manager instproc create_workflow xowf::include xowf::include xowf::test_item::Answer_manager instproc create_workflow->xowf::include

Testcases:
create_test_items
Source code:
# first delete workflow and data, when it exists
if {[$parentObj property wfName] ne ""} {
  set wf [:delete_all_answer_data $parentObj]
  if {$wf ne ""} {$wf delete}
}

#
# Create a fresh workflow (e.g. instance of the online-exam,
# inclass-quiz, ...).
#
set wfName [$parentObj name].wf
$parentObj set_property -new 1 wfName $wfName

set wfTitle [$parentObj property _title]
set questionObjs [:QM question_objs $parentObj]

set wfQuestionNames {}
set wfQuestionTitles {}
set attributeNames {}
foreach form_obj $questionObjs {
  lappend attributeNames  [:FL form_name_based_attribute_stem [$form_obj name]]

  lappend wfQuestionNames ../[$form_obj name]
  lappend wfQuestionTitles [$form_obj title]
}
set wfID [$parentObj item_id]

set wfDef [subst -nocommands {
  set wfID $wfID
  set wfQuestionNames [list $wfQuestionNames]
  xowf::include $answer_workflow
}]
set attributeNames [join $attributeNames ,]

#:log "create workflow by filling out form '$master_workflow'"
set WF [::[$parentObj package_id] instantiate_forms  -parent_id    [$parentObj parent_id]  -forms $master_workflow  -default_lang [$parentObj lang]]

set fc {}
lappend fc  "@table:_item_id,_state,$attributeNames,_last_modified"  "@table_properties:view_field=_item_id"  @cr_fields:hidden

set wf [$WF create_form_page_instance  -name                $wfName  -nls_language        [$parentObj nls_language]  -publish_status      ready  -parent_id           [$parentObj item_id]  -package_id          [$parentObj package_id]  -default_variables   [list title $wfTitle]  -instance_attributes [list workflow_definition $wfDef  form_constraints $fc]]
$wf save_new
#ns_log notice "create_answer_workflow $wf DONE [$wf pretty_link] IA <[$wf instance_attributes]>"
#ns_log notice "create_answer_workflow parent $parentObj IA <[$parentObj instance_attributes]>"

set time_window [$parentObj property time_window]
if {$time_window ne ""} {
  :time_window_setup $parentObj -time_window $time_window
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: