%3 ::xowf::test_item::Answer_manager ::xowf::test_item::Answer_manager achieved_points allow_answering answer_form_field_objs answers_panel countdown_timer create_workflow delete_all_answer_data delete_scheduled_atjobs dom class add dom class remove dom node appendXML dom node delete dom node replace dom node replaceXML exam_results export_answer export_file_submission get_IPs get_answer_attributes get_answer_wf get_duration get_exam_results get_label_from_options get_non_empty_file_formfields get_wf_instances grading_dialog_setup grading_scheme grading_table last_time_in_state last_time_switched_to_state marked_results participant_result participants_table postprocess_question_html pretty_formfield_name pretty_period prevent_multiple_tabs recutil_create render_answers render_answers_with_edit_history render_filter_bar render_full_submission_form render_print_button render_proctor_images render_submission=edit_history render_submission=exam_protocol render_submissions=edit_history result_table per_participant result_table per_question results_table revisions_up_to runtime_panel set_exam_results state_periods student_submissions_exist submissions time_window_setup waiting_room_message ::xowf::test_item::AssessmentInterface ::xowf::test_item::AssessmentInterface add_to_fc assert_answer_instance assert_assessment assert_assessment_container export_links list_equal render_feedback_files replace_in_fc ::xowf::test_item::Answer_manager->::xowf::test_item::AssessmentInterface ::xowf::test_item::Question_manager ::xowf::test_item::Question_manager add_seeds aggregated_form combined_question_form current_question_form current_question_name current_question_number current_question_obj current_question_title describe_form disable_text_field_feature disallow_paste disallow_spellcheck disallow_translation exam_base_time exam_configuration_block exam_configuration_modifiable_field_names exam_configuration_popup exam_configuration_render_fields exam_info_block exam_target_time get_pool_questions get_pool_replacement_candidates goto_page hint_box hint_boxes initialize item_substitute_markup load_question_objs max_items minutes_string more_ahead nth_question_form nth_question_obj pagination_actions pagination_button_css_class percent_substitute percent_substitute_in_form points_string pretty_ncorrect pretty_nr_alternatives pretty_shuffle qualified_question_names question_count question_info question_info_block question_is_autograded question_names question_objs question_overview_block question_property question_randomization_ok question_statistics_block question_summary questions_without_minutes render_describe_infos replace_pool_question replace_pool_questions shuffled_index title_infos total total_minutes total_minutes_for_exam total_points ::xowf::test_item::Question_manager->::xowf::test_item::AssessmentInterface ::xowf::test_item::Renaming_form_loader ::xowf::test_item::Renaming_form_loader answer_attributes answer_for_form answers_for_form form_name_based_attribute_stem map_form_constraints name_to_question_obj_dict rename_attributes ::xowf::test_item::Renaming_form_loader->::xowf::test_item::AssessmentInterface ::nx::Object ::nx::Object ::xowf::test_item::AssessmentInterface->::nx::Object

Class ::xowf::test_item::Question_manager

::xowf::test_item::Question_manager[i] create ...

This code manages questions and the information related to a current (selected) question via qthe "position" instance attribute. It provides the following public API: - goto_page - more_ahead - pagination_actions - current_question_form - current_question_obj - current_question_name - current_question_title - nth_question_obj - nth_question_form - exam_configuration_popup - exam_configuration_modifiable_field_names - combined_question_form - question_objs - question_names - question_count - question_property - add_seeds - total_minutes - total_points - questions_without_minutes - total_minutes_for_exam - exam_target_time - exam_base_time - percent_substitute_in_form - item_substitute_markup - describe_form - question_summary - question_info_block - question_statistics_block
Defined in packages/xowf/tcl/test-item-procs.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::xowf::test_item::AssessmentInterface[i]

Methods (to be applied on instances)

  • add_seeds (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> add_seeds \
        [ -obj obj ] [ -seed seed ] [ -number number ]

    Add property "seed" to the provided object, consisting of a list of the specified number of random values starting with a base seed. This can be used to use e.g. per user different random seeds depending on the position of an item.

    Switches:
    -obj (optional, object)
    -seed (optional, integer)
    -number (optional, integer)

    Testcases:
    No testcase defined.
  • aggregated_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> aggregated_form \
        [ -titleless_form ] [ -with_feedback ] [ -with_correction_notes ] \
        [ -with_grading_box with_grading_box ] question_infos

    Compute an aggregated form (containing potentially multiple questions) based on the chunks available in question_infos.

    Switches:
    -titleless_form (optional, defaults to "false")
    -with_feedback (optional, defaults to "false")
    -with_correction_notes (optional, defaults to "false")
    -with_grading_box (optional)
    might be: "hidden" (but included), "true", "" (omitted)
    Parameters:
    question_infos (required)
    Returns:
    HTML form content

    Testcases:
    No testcase defined.
  • combined_question_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> combined_question_form \
        [ -with_numbers ] [ -with_title ] [ -with_minutes ] \
        [ -with_points ] [ -user_specific ] [ -shuffle_id shuffle_id ] \
        [ -user_answers user_answers ] [ -form_objs form_objs ] obj

    For the provided assessment, return a combined question_form as a single (combined) form, containing the content of all question forms. The result is a dict, containing also title information etc. depending on the provided parameters.

    Switches:
    -with_numbers (optional, defaults to "false")
    -with_title (optional, defaults to "false")
    -with_minutes (optional, defaults to "false")
    -with_points (optional, defaults to "false")
    -user_specific (optional, defaults to "false")
    -shuffle_id (optional, integer, defaults to "-1")
    used only for selecting form_objs
    -user_answers (optional, object, accept empty)
    instance of the answer-wf. Needed for user-specific percent substitutions.
    -form_objs (optional, object, accept empty)
    Parameters:
    obj (required, object)
    is the exam

    Testcases:
    No testcase defined.
  • current_question_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> current_question_form \
        [ -with_numbers ] [ -with_title ] obj

    Return the current form object of the provided assessment.

    Switches:
    -with_numbers (optional, defaults to "false")
    -with_title (optional, defaults to "false")
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • current_question_number (scripted, public)

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

    Translate the position of an object into its question number (as e.g. used by current_question_title).

    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • current_question_obj (scripted, public)

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

    Load the current question obj based on the current question name.

    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • current_question_title (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> current_question_title \
        [ -with_numbers ] obj

    In case, with_numbers is provided, return a internationalized title for the question, such as "Question 1".

    Switches:
    -with_numbers (optional, defaults to "false")
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • describe_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> describe_form \
        [ -asHTML ] [ -field_name field_name ] form_obj

    Call for every form field of the form_obj the "describe" method and return these infos in a form of a list.

    Switches:
    -asHTML (optional)
    -field_name (optional)
    Parameters:
    form_obj (required)

    Testcases:
    No testcase defined.
  • disallow_paste (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> disallow_paste \
        form_obj

    This function changes the form_constraints of the provided form object by adding "paste=false" properties to textarea or text_fields entries.

    Parameters:
    form_obj (required, object)

    Testcases:
    No testcase defined.
  • disallow_spellcheck (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> disallow_spellcheck \
        form_obj

    This function changes the form_constraints of the provided form object by adding "spellcheck=false" properties to textarea or text_fields entries.

    Parameters:
    form_obj (required, object)

    Testcases:
    No testcase defined.
  • disallow_translation (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> disallow_translation \
        form_obj

    This function disallows translation of the full page by setting the HTML5 "translate" attribute of the body to "no".

    Parameters:
    form_obj (required, object)

    Testcases:
    No testcase defined.
  • exam_base_time (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> exam_base_time \
        [ -manager manager ] [ -answer_obj answer_obj ]

    Calculate the exam base time for a student. This is the time reference, when the timer starts. Depending on whether the exam is synchronous, the time start is either the time when the exam is opened, or when the student starts the exam.

    Switches:
    -manager (optional, object)
    -answer_obj (optional, object)
    Returns:
    time string as returned from the database

    Testcases:
    No testcase defined.
  • exam_configuration_modifiable_field_names (scripted, public)

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

    Return the names of the modifiable field names in the current state. The state is in essence defined on whether or not students have started to work on this exam. This method can be used to correct small things, even when the students are already working on the exam.

    Parameters:
    obj (required)

    Testcases:
    No testcase defined.
  • exam_configuration_popup (scripted, public)

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

    Render the exam configuration popup, add it as a content_header (to avoid putting it to the main workflow form, since nested FORMS are not allowed) and return the rendering of the button for popping-ip the configuration modal.

    Parameters:
    obj (required)
    Returns:
    HTML

    Testcases:
    No testcase defined.
  • exam_info_block (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> exam_info_block \
        [ -combined_form_info combined_form_info ] obj

    Provide a summative overview of an exam.

    Switches:
    -combined_form_info (optional)
    Parameters:
    obj (required)

    Testcases:
    No testcase defined.
  • exam_target_time (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> exam_target_time \
        [ -manager manager ] [ -base_time base_time ]

    Calculate the exam target time (finishing time) based on the duration of the exam plus the provided base_time (which is in the format returned by SQL)

    Switches:
    -manager (optional, object)
    exam workflow
    -base_time (optional)
    time in SQL format

    Testcases:
    No testcase defined.
  • get_pool_questions (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> get_pool_questions \
        [ -allowed_forms allowed_forms ] [ -field_name field_name ] \
        pool_question_obj exam_question_names

    Obtain for the specs in the pool_question_obj potential replacement items in form of a replacement dict. For raw forms (i.e., not obtained via the renaming form-loader), we have just the plain "answer", which can be provided via the "field_name" attribute.

    Switches:
    -allowed_forms (optional, defaults to "en:edit-interaction.wf")
    -field_name (optional)
    Parameters:
    pool_question_obj (required)
    exam_question_names (required)

    Testcases:
    No testcase defined.
  • goto_page (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> goto_page obj \
        position

    ns_log notice "===== goto_page $position" Set the position (test item number) of the workflow (exam). This sets the question number shown to the user.

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

    Testcases:
    No testcase defined.
  • hint_boxes (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> hint_boxes \
        [ -question_obj question_obj ] [ -with_feedback ] \
        [ -with_correction_notes ]

    Render the hint boxes (feedback and correction notes) for a question object.

    Switches:
    -question_obj (optional, object)
    -with_feedback (optional)
    -with_correction_notes (optional)
    Returns:
    HTML

    Testcases:
    No testcase defined.
  • initialize (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> initialize \
        [ -wfi wfi ]

    Initialize the question manager for a certain workflow instance. This is needed for per-answer-workflow questions (as for pool questions, where different questions are taken for different users).

    Switches:
    -wfi (optional, object)

    Testcases:
    No testcase defined.
  • item_substitute_markup (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> item_substitute_markup \
        [ -obj obj ] [ -form_obj form_obj ] [ -position position ] \
        [ -do_substitutions ]

    Substitute everything item-specific in the text, including markup (handling e.g. images resolving in the context of the original question) and also percent-substitutions (if desired). ns_log notice "=== item_substitute_markup [$form_obj name] do percent subst (have pos [info exists position])"

    Switches:
    -obj (optional, object)
    -form_obj (optional, object)
    -position (optional, integer)
    -do_substitutions (optional, defaults to "1")

    Testcases:
    No testcase defined.
  • load_question_objs (scripted, public)

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

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

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

    Testcases:
    No testcase defined.
  • minutes_string (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> minutes_string \
        form_obj

    Get an attribute of the original question

    Parameters:
    form_obj (required, object)

    Testcases:
    No testcase defined.
  • more_ahead (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> more_ahead \
        [ -position position ] obj

    Return true, when this is for the current user not the last question.

    Switches:
    -position (optional)
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • nth_question_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> nth_question_form \
        [ -position position ] [ -item_nr item_nr ] [ -with_numbers ] \
        [ -with_title ] [ -titleless_form ] [ -with_minutes ] obj

    Return the question_info of the nth form (question) of the assessment. The information added to the title can be optionally included as expressed by the non-positional parameters.

    Switches:
    -position (optional, integer)
    -item_nr (optional, integer)
    -with_numbers (optional, defaults to "false")
    -with_title (optional, defaults to "false")
    -titleless_form (optional, defaults to "false")
    -with_minutes (optional, defaults to "false")
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • nth_question_obj (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> nth_question_obj \
        obj position

    Return the nth question object of an assessment (based on position).

    Parameters:
    obj (required, object)
    position (required, integer)

    Testcases:
    No testcase defined.
  • pagination_actions (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> pagination_actions \
        [ -container container ] [ -question_count question_count ] \
        [ -visited visited ] [ -flagged flagged ] \
        [ -current_position current_position ] [ -CSSclass CSSclass ]

    Create actions used for pagination.

    Switches:
    -container (optional, object)
    -question_count (optional, integer)
    -visited (optional, integer)
    -flagged (optional, integer)
    -current_position (optional, integer)
    -CSSclass (optional, defaults to "btn-sm")

    Testcases:
    No testcase defined.
  • percent_substitute_in_form (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> percent_substitute_in_form \
        [ -obj obj ] [ -form_obj form_obj ] [ -position position ] html

    Perform percent substitution in the provided HTML, form_constraints and disabled_form_constraints and return the result as a dict.

    Switches:
    -obj (optional, object)
    -form_obj (optional, object)
    -position (optional, integer)
    Parameters:
    html (required)

    Testcases:
    No testcase defined.
  • points_string (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> points_string \
        form_obj

    Get an attribute of the original question

    Parameters:
    form_obj (required, object)

    Testcases:
    No testcase defined.
  • question_count (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> question_count \
        [ -all ] obj

    Return the number questions in an exam. It is either the number of defined questions, or it might be restricted by the property max_items (if defined for "obj").

    Switches:
    -all (optional, defaults to "false")
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • question_info (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> question_info \
        [ -numbers numbers ] [ -with_title ] [ -with_minutes ] \
        [ -with_points ] [ -titleless_form ] [ -obj obj ] \
        [ -user_answers user_answers ] [ -no_position ] \
        [ -question_number_label question_number_label ] \
        [ -positions positions ] [ -with_question_count_in_title on|off ] \
        form_objs

    Returns a dict containing "form", "title_infos", "form_constraints" "disabled_form_constraints" "randomization_for_exam" "autograde" and "question_objs". This information is obtained from the provided "form_objs".

    Switches:
    -numbers (optional)
    -with_title (optional, defaults to "false")
    -with_minutes (optional, defaults to "false")
    -with_points (optional, defaults to "false")
    -titleless_form (optional, defaults to "false")
    -obj (optional, object)
    -user_answers (optional, object, accept empty)
    -no_position (optional, defaults to "false")
    -question_number_label (optional, defaults to "#xowf.question#")
    -positions (optional, integer)
    -with_question_count_in_title (optional, boolean, defaults to "false")
    Parameters:
    form_objs (required)
    Returns:
    dict containing "title_infos", "form_constraints", "disabled_form_constraints", "randomization_for_exam", "autograde", "question_forms", "question_objs"

    Testcases:
    No testcase defined.
  • question_info_block (scripted, public)

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

    Provide question info block.

    Parameters:
    obj (required)

    Testcases:
    No testcase defined.
  • question_names (scripted, public)

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

    Return the names of the questions of an assessment.

    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • question_objs (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> question_objs \
        [ -shuffle_id shuffle_id ] obj

    For the provided assessment object, return the question objects in the right order, depending on the shuffle_id.

    Switches:
    -shuffle_id (optional, integer, defaults to "-1")
    Parameters:
    obj (required, object)

    Testcases:
    No testcase defined.
  • question_property (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> question_property \
        form_obj attribute [ default ]

    Get an attribute of the original question

    Parameters:
    form_obj (required, object)
    attribute (required)
    default (optional)

    Testcases:
    No testcase defined.
  • question_statistics_block (scripted, public)

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

    When we have results, we can provide statistics

    Parameters:
    obj (required)

    Testcases:
    No testcase defined.
  • question_summary (scripted, public)

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

    Provide a summary of all questions of an exam.

    Parameters:
    obj (required)

    Testcases:
    No testcase defined.
  • questions_without_minutes (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> questions_without_minutes \
        [ -max_items max_items ] form_info

    Compute the number of questions without provided time

    Switches:
    -max_items (optional, integer, accept empty)
    Parameters:
    form_info (required)

    Testcases:
    No testcase defined.
  • replace_pool_question (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> replace_pool_question \
        [ -position position ] [ -seed seed ] \
        [ -allowed_forms allowed_forms ] [ -field_name field_name ] \
        [ -pool_question_obj pool_question_obj ] \
        [ -exam_question_names exam_question_names ]
    Switches:
    -position (optional)
    -seed (optional)
    -allowed_forms (optional, defaults to "en:edit-interaction.wf")
    -field_name (optional)
    -pool_question_obj (optional)
    -exam_question_names (optional)
    Returns:
    an initialized replacement form obj if this is possible

    Testcases:
    No testcase defined.
  • replace_pool_questions (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> replace_pool_questions \
        [ -answer_obj answer_obj ] [ -exam_obj exam_obj ]

    Replaces all pool questions for the exam by random items. In case there were replacement items, set/update the property "question" for the individual answer_obj.

    Switches:
    -answer_obj (optional, object)
    the workflow instance of the answer workflow
    -exam_obj (optional, object)
    the exam objject to which the answer_object belongs to

    Testcases:
    No testcase defined.
  • shuffled_index (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> shuffled_index \
        [ -shuffle_id shuffle_id ] obj position

    Return the shuffled index position, in case shuffling is turned on.

    Switches:
    -shuffle_id (optional, integer, defaults to "-1")
    Parameters:
    obj (required, object)
    position (required)

    Testcases:
    No testcase defined.
  • total_minutes (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> total_minutes \
        [ -max_items max_items ] form_info

    Compute the duration of an exam based on the form_info dict.

    Switches:
    -max_items (optional, integer, accept empty)
    Parameters:
    form_info (required)

    Testcases:
    No testcase defined.
  • total_minutes_for_exam (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> total_minutes_for_exam \
        [ -manager manager ]

    Compute the total time of an exam, based on the minutes provided by the single questions.

    Switches:
    -manager (optional, object)

    Testcases:
    No testcase defined.
  • total_points (scripted, public)

     <instance of xowf::test_item::Question_manager[i]> total_points \
        [ -max_items max_items ] form_info

    Compute the maximum achievable points of an exam based on the form_info dict.

    Switches:
    -max_items (optional, integer, accept empty)
    Parameters:
    form_info (required)

    Testcases:
    No testcase defined.