xowf::test_item::Question_manager method load_question_objs (public)

 <instance of xowf::test_item::Question_manager[i]> load_question_objs \
    obj names

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

Load the question objects for the provided question names and return the question objs.

Parameters:
obj (required, object)
names (required)

Testcases:
No testcase defined.
Source code:
set parent_id [$obj parent_id]
#
# Make sure to have names pointing to a folder.
# In case, '$ref' refers to a site-wide page, a prefix with
# the parent name would not help. In these cases, we expect
# to have the parent obj not instantiated.
#
if {[nsf::is object ::$parent_id]} {
  set names [lmap ref $names {
    if {![string match "*/*" $ref]} {
      set ref [::$parent_id name]/$ref
    }
    set ref
  }]
}
#ns_log notice "XXX [$obj name] load_question_objs names = <$names>"
#xo::show_stack
set questionNames [join $names |]
set questionForms [::[$obj package_id] instantiate_forms  -default_lang [$obj lang]  -forms $questionNames]

if {[llength $questionForms] < [llength $names]} {
  if {[llength $names] == 1} {
    ns_log warning "load_question_objs: question '$names' could not be loaded"
  } else {
    set loaded [llength $questionForms]
    set out_of [llength $names]
    ns_log warning "load_question_objs: only $loaded out of $out_of from '$names' could be loaded"
  }
}
return $questionForms
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: