19 declare(strict_types=1);
56 array $environment = null
58 $optional_group = $f->optionalGroup(
60 'highscore_mode' => $f->radio($lng->
txt(
'tst_highscore_mode'),
"")
61 ->withOption((
string) self::HIGHSCORE_SHOW_OWN_TABLE, $lng->
txt(
'tst_highscore_own_table'), $lng->
txt(
'tst_highscore_own_table_description'))
62 ->withOption((
string) self::HIGHSCORE_SHOW_TOP_TABLE, $lng->
txt(
'tst_highscore_top_table'), $lng->
txt(
'tst_highscore_top_table_description'))
63 ->withOption((
string) self::HIGHSCORE_SHOW_ALL_TABLES, $lng->
txt(
'tst_highscore_all_tables'), $lng->
txt(
'tst_highscore_all_tables_description'))
67 'highscore_top_num' => $f->numeric($lng->
txt(
'tst_highscore_top_num'), $lng->
txt(
'tst_highscore_top_num_description'))
70 'highscore_anon' => $f->checkbox(
71 $lng->
txt(
'tst_highscore_anon'),
72 $lng->
txt(
'tst_highscore_anon_description')
74 'highscore_achieved_ts' => $f->checkbox(
75 $lng->
txt(
'tst_highscore_achieved_ts'),
76 $lng->
txt(
'tst_highscore_achieved_ts_description')
78 'highscore_score' => $f->checkbox(
79 $lng->
txt(
'tst_highscore_score'),
80 $lng->
txt(
'tst_highscore_score_description')
82 'highscore_percentage' => $f->checkbox(
83 $lng->
txt(
'tst_highscore_percentage'),
84 $lng->
txt(
'tst_highscore_percentage_description')
86 'highscore_hints' => $f->checkbox(
87 $lng->
txt(
'tst_highscore_hints'),
88 $lng->
txt(
'tst_highscore_hints_description')
90 'highscore_wtime' => $f->checkbox(
91 $lng->
txt(
'tst_highscore_wtime'),
92 $lng->
txt(
'tst_highscore_wtime_description')
96 $lng->
txt(
'tst_highscore_enabled'),
97 $lng->
txt(
'tst_highscore_description')
101 $optional_group = $optional_group->
withValue(null);
104 $fields = [
'highscore' => $optional_group];
105 return $f->section($fields, $lng->
txt(
'tst_results_gamification'))
107 $refinery->custom()->transformation(
109 $settings = clone $this;
111 if (! $v[
'highscore']) {
112 return $settings->withHighscoreEnabled(
false);
116 ->withHighscoreEnabled(
true)
117 ->withHighscoreOwnTable(
118 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_OWN_TABLE ||
119 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
121 ->withHighscoreTopTable(
122 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_TOP_TABLE ||
123 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
125 ->withHighscoreTopNum($v[
'highscore'][
'highscore_top_num'])
126 ->withHighscoreAnon($v[
'highscore'][
'highscore_anon'])
127 ->withHighscoreAchievedTS($v[
'highscore'][
'highscore_achieved_ts'])
128 ->withHighscoreScore($v[
'highscore'][
'highscore_score'])
129 ->withHighscorePercentage($v[
'highscore'][
'highscore_percentage'])
130 ->withHighscoreHints($v[
'highscore'][
'highscore_hints'])
131 ->withHighscoreWTime($v[
'highscore'][
'highscore_wtime']);
163 case self::HIGHSCORE_SHOW_OWN_TABLE:
164 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_own_table');
166 case self::HIGHSCORE_SHOW_TOP_TABLE:
167 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_top_table');
169 case self::HIGHSCORE_SHOW_ALL_TABLES:
170 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_all_tables');
202 $clone = clone $this;
213 $clone = clone $this;
223 $clone = clone $this;
231 return self::HIGHSCORE_SHOW_ALL_TABLES;
235 return self::HIGHSCORE_SHOW_TOP_TABLE;
239 return self::HIGHSCORE_SHOW_OWN_TABLE;
251 $clone = clone $this;
262 $clone = clone $this;
273 $clone = clone $this;
284 $clone = clone $this;
295 $clone = clone $this;
306 $clone = clone $this;
317 $clone = clone $this;
withHighscoreTopTable(bool $highscore_top_table)
toLog(AdditionalInformationGenerator $additional_info)
withHighscoreScore(bool $highscore_score)
withHighscoreTopNum(int $highscore_top_num)
withHighscoreOwnTable(bool $highscore_own_table)
bool $highscore_percentage
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...
withHighscorePercentage(bool $highscore_percentage)
const HIGHSCORE_SHOW_OWN_TABLE
bool $highscore_top_table
bool $highscore_achieved_ts
const HIGHSCORE_SHOW_ALL_TABLES
bool $highscore_own_table
withHighscoreAnon(bool $highscore_anon)
const HIGHSCORE_SHOW_TOP_TABLE
withHighscoreHints(bool $highscore_hints)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
__construct(int $test_id)
withHighscoreWTime(bool $highscore_wtime)
__construct(Container $dic, ilPlugin $plugin)
withHighscoreAchievedTS(bool $highscore_achieved_ts)
withHighscoreEnabled(bool $highscore_enabled)