19 declare(strict_types=1);
    44         protected int $question_title_output_mode,
    45         protected bool $autosave_enabled,
    46         protected int $autosave_interval,
    47         protected bool $shuffle_questions,
    48         protected bool $question_hints_enabled,
    49         protected bool $instant_feedback_points_enabled,
    50         protected bool $instant_feedback_generic_enabled,
    51         protected bool $instant_feedback_specific_enabled,
    52         protected bool $instant_feedback_solution_enabled,
    53         protected bool $force_instant_feedback_on_next_question,
    54         protected bool $lock_answer_on_instant_feedback,
    55         protected bool $lock_answer_on_next_question
    68         array $environment = null
    70         $inputs[
'title_output'] = $f->radio(
    71             $lng->
txt(
'tst_title_output'),
    72             $lng->
txt(
'tst_title_output_info')
    73         )->withOption(
'0', $lng->
txt(
'tst_title_output_full'))
    74         ->withOption(
'1', $lng->
txt(
'tst_title_output_hide_points'))
    75         ->withOption(
'3', $lng->
txt(
'tst_title_output_only_points'))
    76         ->withOption(
'2', $lng->
txt(
'tst_title_output_no_title'))
    82         $inputs[
'shuffle_questions'] = $f->checkbox(
    83             $lng->
txt(
'tst_shuffle_questions'),
    84             $lng->
txt(
'tst_shuffle_questions_description')
    87         $inputs[
'offer_hints'] = $f->checkbox(
    88             $lng->
txt(
'tst_setting_offer_hints_label'),
    89             $lng->
txt(
'tst_setting_offer_hints_info')
    92         if ($environment[
'participant_data_exists']) {
    93             $inputs[
'shuffle_questions'] = 
$inputs[
'shuffle_questions']->withDisabled(
true);
    94             $inputs[
'offer_hints'] = 
$inputs[
'offer_hints']->withDisabled(
true);
   100         $section = $f->section(
$inputs, $lng->
txt(
'tst_presentation_properties'))
   111         $trafo = $refinery->custom()->transformation(
   112             static function (?array $vs): array {
   115                         'autosave_enabled' => 
false,
   116                         'autosave_interval' => self::DEFAULT_AUTOSAVE_INTERVAL
   121                     'autosave_enabled' => 
true,
   122                     'autosave_interval' => $vs[
'autosave_interval'] * 1000
   126         $sub_inputs_autosave[
'autosave_interval'] = $f->numeric($lng->
txt(
'autosave_ival'), $lng->
txt(
'seconds'))
   128             ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
   135         $autosave_input = $f->optionalGroup(
   136             $sub_inputs_autosave,
   137             $lng->
txt(
'autosave'),
   138             $lng->
txt(
'autosave_info')
   140             ->withAdditionalTransformation($trafo);
   143             return $autosave_input;
   146         return $autosave_input->withValue([
'autosave_interval' => $this->
getAutosaveInterval() / 1000]);
   155         $constraint = $refinery->custom()->constraint(
   156             fn(?array $vs) => $vs === null
   157                 || $vs[
'enabled_feedback_types'][
'instant_feedback_specific'] === null
   158                     && $vs[
'enabled_feedback_types'][
'instant_feedback_generic'] === null
   159                     && $vs[
'enabled_feedback_types'][
'instant_feedback_points'] === null
   160                     && $vs[
'enabled_feedback_types'][
'instant_feedback_solution'] === null
   161                     && $vs[
'feedback_trigger'] === null
   163                     $vs[
'enabled_feedback_types'][
'instant_feedback_specific'] === 
true   164                     || $vs[
'enabled_feedback_types'][
'instant_feedback_generic'] === 
true   165                     || $vs[
'enabled_feedback_types'][
'instant_feedback_points'] === 
true   166                     || $vs[
'enabled_feedback_types'][
'instant_feedback_solution'] === 
true   168                     && $vs[
'feedback_trigger'] !== 
'',
   169             $lng->
txt(
'select_at_least_one_feedback_type_and_trigger')
   171         $trafo = $refinery->custom()->transformation(
   172             static function (?array $vs): array {
   175                         'enabled_feedback_types' => [
   176                             'instant_feedback_specific' => 
false,
   177                             'instant_feedback_generic' => 
false,
   178                             'instant_feedback_points' => 
false,
   179                             'instant_feedback_solution' => false
   181                         'feedback_on_next_question' => false
   185                 $vs[
'feedback_on_next_question'] = $vs[
'feedback_trigger'] === 
'1';
   190         $instant_feedback = $f->optionalGroup(
   192             $lng->
txt(
'tst_instant_feedback'),
   193             $lng->
txt(
'tst_instant_feedback_desc')
   195             ->withAdditionalTransformation($constraint)
   196             ->withAdditionalTransformation($trafo);
   199             $instant_feedback = $instant_feedback->withValue(
   201                     'enabled_feedback_types' => [
   212         if (!$environment[
'participant_data_exists']) {
   213             return $instant_feedback;
   216         return $instant_feedback->withDisabled(
true);
   224         $feedback_options = [
   225             'instant_feedback_points' => $f->checkbox(
   226                 $lng->
txt(
'tst_instant_feedback_results'),
   227                 $lng->
txt(
'tst_instant_feedback_results_desc')
   229             'instant_feedback_generic' => $f->checkbox(
   230                 $lng->
txt(
'tst_instant_feedback_answer_generic'),
   231                 $lng->
txt(
'tst_instant_feedback_answer_generic_desc')
   233             'instant_feedback_specific' => $f->checkbox(
   234                 $lng->
txt(
'tst_instant_feedback_answer_specific'),
   235                 $lng->
txt(
'tst_instant_feedback_answer_specific_desc')
   237             'instant_feedback_solution' => $f->checkbox(
   238                 $lng->
txt(
'tst_instant_feedback_solution'),
   239                 $lng->
txt(
'tst_instant_feedback_solution_desc')
   243         $sub_inputs_feedback[
'enabled_feedback_types'] = $f->group(
   245             $lng->
txt(
'tst_instant_feedback_contents')
   248         $sub_inputs_feedback[
'feedback_trigger'] = $f->radio(
   249             $lng->
txt(
'tst_instant_feedback_trigger')
   252             $lng->
txt(
'tst_instant_feedback_trigger_manual'),
   253             $lng->
txt(
'tst_instant_feedback_trigger_manual_desc')
   256             $lng->
txt(
'tst_instant_feedback_trigger_forced'),
   257             $lng->
txt(
'tst_instant_feedback_trigger_forced_desc')
   260         if (!$environment[
'participant_data_exists']) {
   261             $sub_inputs_feedback[
'feedback_trigger'] = $sub_inputs_feedback[
'feedback_trigger']
   262                 ->withRequired(
true);
   264         return $sub_inputs_feedback;
   275         $lock_answers = $f->radio(
   276             $lng->
txt(
'tst_answer_fixation_handling')
   278             self::ANSWER_FIXATION_NONE,
   279             $lng->
txt(
'tst_answer_fixation_none'),
   280             $lng->
txt(
'tst_answer_fixation_none_desc')
   282             self::ANSWER_FIXATION_ON_INSTANT_FEEDBACK,
   283             $lng->
txt(
'tst_answer_fixation_on_instant_feedback'),
   284             $lng->
txt(
'tst_answer_fixation_on_instant_feedback_desc')
   286             self::ANSWER_FIXATION_ON_FOLLOWUP_QUESTION,
   287             $lng->
txt(
'tst_answer_fixation_on_followup_question'),
   288             $lng->
txt(
'tst_answer_fixation_on_followup_question_desc')
   290             self::ANSWER_FIXATION_ON_IFB_OR_FUQST,
   291             $lng->
txt(
'tst_answer_fixation_on_instantfb_or_followupqst'),
   292             $lng->
txt(
'tst_answer_fixation_on_instantfb_or_followupqst_desc')
   297         if (!$environment[
'participant_data_exists']) {
   298             return $lock_answers;
   301         return $lock_answers->withDisabled(
true);
   306         return $refinery->custom()->transformation(
   307             static function (?
string $v): array {
   308                 if ($v === null || $v === self::ANSWER_FIXATION_NONE) {
   310                         'lock_answer_on_instant_feedback' => 
false,
   311                         'lock_answer_on_next_question' => false
   315                 if ($v === self::ANSWER_FIXATION_ON_INSTANT_FEEDBACK) {
   317                         'lock_answer_on_instant_feedback' => 
true,
   318                         'lock_answer_on_next_question' => false
   321                 if ($v === self::ANSWER_FIXATION_ON_FOLLOWUP_QUESTION) {
   323                         'lock_answer_on_instant_feedback' => 
false,
   324                         'lock_answer_on_next_question' => true
   329                     'lock_answer_on_instant_feedback' => 
true,
   330                     'lock_answer_on_next_question' => true
   340         return $refinery->custom()->constraint(
   341             function ($vs): 
bool {
   342                 if ($vs[
'shuffle_questions'] === 
true   343                     && $vs[
'lock_answers'][
'lock_answer_on_next_question']) {
   348             $lng->
txt(
'tst_settings_conflict_shuffle_and_lock'),
   411                 : $additional_info->
getTagForLangVar(
'tst_instant_feedback_trigger_manual');
   414         $lock_answers = $additional_info->
getTagForLangVar(
'tst_answer_fixation_none');
   417             $lock_answers = $additional_info->
getTagForLangVar(
'tst_answer_fixation_on_instantfb_or_followupqst');
   419             $lock_answers = $additional_info->
getTagForLangVar(
'tst_answer_fixation_on_instant_feedback');
   421             $lock_answers = $additional_info->
getTagForLangVar(
'tst_answer_fixation_on_followup_question');
   430         return $this->question_title_output_mode;
   435         $clone = clone $this;
   436         $clone->question_title_output_mode = $question_title_output_mode;
   442         return $this->autosave_enabled;
   447         $clone = clone $this;
   448         $clone->autosave_enabled = $autosave_enabled;
   454         return $this->autosave_interval;
   459         $clone = clone $this;
   460         $clone->autosave_interval = $autosave_interval;
   466         return $this->shuffle_questions;
   471         $clone = clone $this;
   472         $clone->shuffle_questions = $shuffle_questions;
   478         return $this->question_hints_enabled;
   483         $clone = clone $this;
   484         $clone->question_hints_enabled = $question_hints_enabled;
   490         return $this->instant_feedback_points_enabled;
   495         $clone = clone $this;
   496         $clone->instant_feedback_points_enabled = $instant_feedback_points_enabled;
   502         return $this->instant_feedback_generic_enabled;
   507         $clone = clone $this;
   508         $clone->instant_feedback_generic_enabled = $instant_feedback_generic_enabled;
   514         return $this->instant_feedback_specific_enabled;
   519         $clone = clone $this;
   520         $clone->instant_feedback_specific_enabled = $instant_feedback_specific_enabled;
   526         return $this->instant_feedback_solution_enabled;
   531         $clone = clone $this;
   532         $clone->instant_feedback_solution_enabled = $instant_feedback_solution_enabled;
   546         return $this->force_instant_feedback_on_next_question;
   551         $clone = clone $this;
   552         $clone->force_instant_feedback_on_next_question = $force_instant_feedback_on_next_question;
   558         return $this->lock_answer_on_instant_feedback;
   563         $clone = clone $this;
   564         $clone->lock_answer_on_instant_feedback = $lock_answer_on_instant_feedback;
   570         return $this->lock_answer_on_next_question;
   575         $clone = clone $this;
   576         $clone->lock_answer_on_next_question = $lock_answer_on_next_question;
   584             return self::ANSWER_FIXATION_ON_IFB_OR_FUQST;
   588             return self::ANSWER_FIXATION_ON_INSTANT_FEEDBACK;
   592             return self::ANSWER_FIXATION_ON_FOLLOWUP_QUESTION;
   595         return self::ANSWER_FIXATION_NONE;
 
getInstantFeedbackSpecificEnabled()
 
getForceInstantFeedbackOnNextQuestion()
 
getLockAnswerOnNextQuestionEnabled()
 
withShuffleQuestions(bool $shuffle_questions)
 
getLockAnswerOnInstantFeedbackEnabled()
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
withLockAnswerOnInstantFeedbackEnabled(bool $lock_answer_on_instant_feedback)
 
getInputInstantFeedback(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment)
 
const ANSWER_FIXATION_ON_FOLLOWUP_QUESTION
 
withQuestionHintsEnabled(bool $question_hints_enabled)
 
getTransformationLockAnswers(Refinery $refinery)
 
A constraint encodes some resrtictions on values. 
 
getInstantFeedbackGenericEnabled()
 
toLog(AdditionalInformationGenerator $additional_info)
 
withInstantFeedbackGenericEnabled(bool $instant_feedback_generic_enabled)
 
withInstantFeedbackSpecificEnabled(bool $instant_feedback_specific_enabled)
 
const DEFAULT_AUTOSAVE_INTERVAL
 
getInputAutosave(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
 
getAnswerFixationSettingsAsFormValue()
 
getQuestionTitleOutputMode()
 
const ANSWER_FIXATION_ON_INSTANT_FEEDBACK
 
isAnyInstantFeedbackOptionEnabled()
 
getInstantFeedbackPointsEnabled()
 
getSubInputInstantFeedback(\ilLanguage $lng, FieldFactory $f, array $environment)
 
withQuestionTitleOutputMode(int $question_title_output_mode)
 
withLockAnswerOnNextQuestionEnabled(bool $lock_answer_on_next_question)
 
getInstantFeedbackSolutionEnabled()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
withAutosaveEnabled(bool $autosave_enabled)
 
const ANSWER_FIXATION_ON_IFB_OR_FUQST
 
__construct(Container $dic, ilPlugin $plugin)
 
getShuffleAndLockAnswersConstraint(\ilLanguage $lng, Refinery $refinery)
 
const ANSWER_FIXATION_NONE
 
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
__construct(int $test_id, protected int $question_title_output_mode, protected bool $autosave_enabled, protected int $autosave_interval, protected bool $shuffle_questions, protected bool $question_hints_enabled, protected bool $instant_feedback_points_enabled, protected bool $instant_feedback_generic_enabled, protected bool $instant_feedback_specific_enabled, protected bool $instant_feedback_solution_enabled, protected bool $force_instant_feedback_on_next_question, protected bool $lock_answer_on_instant_feedback, protected bool $lock_answer_on_next_question)
 
withForceInstantFeedbackOnNextQuestion(bool $force_instant_feedback_on_next_question)
 
getInputLockAnswers(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment)
 
getQuestionHintsEnabled()
 
withAutosaveInterval(int $autosave_interval)
 
withInstantFeedbackSolutionEnabled(bool $instant_feedback_solution_enabled)
 
withInstantFeedbackPointsEnabled(bool $instant_feedback_points_enabled)