19 declare(strict_types=1);
55 ?array $environment =
null 57 $optional_group = $f->optionalGroup(
59 'highscore_mode' => $f->radio($lng->
txt(
'tst_highscore_mode'),
"")
60 ->withOption((
string) self::HIGHSCORE_SHOW_OWN_TABLE, $lng->
txt(
'tst_highscore_own_table'), $lng->
txt(
'tst_highscore_own_table_description'))
61 ->withOption((
string) self::HIGHSCORE_SHOW_TOP_TABLE, $lng->
txt(
'tst_highscore_top_table'), $lng->
txt(
'tst_highscore_top_table_description'))
62 ->withOption((
string) self::HIGHSCORE_SHOW_ALL_TABLES, $lng->
txt(
'tst_highscore_all_tables'), $lng->
txt(
'tst_highscore_all_tables_description'))
66 'highscore_top_num' => $f->numeric($lng->
txt(
'tst_highscore_top_num'), $lng->
txt(
'tst_highscore_top_num_description'))
69 'highscore_anon' => $f->checkbox(
70 $lng->
txt(
'tst_highscore_anon'),
71 $lng->
txt(
'tst_highscore_anon_description')
73 'highscore_achieved_ts' => $f->checkbox(
74 $lng->
txt(
'tst_highscore_achieved_ts'),
75 $lng->
txt(
'tst_highscore_achieved_ts_description')
77 'highscore_score' => $f->checkbox(
78 $lng->
txt(
'tst_highscore_score'),
79 $lng->
txt(
'tst_highscore_score_description')
81 'highscore_percentage' => $f->checkbox(
82 $lng->
txt(
'tst_highscore_percentage'),
83 $lng->
txt(
'tst_highscore_percentage_description')
85 'highscore_wtime' => $f->checkbox(
86 $lng->
txt(
'tst_highscore_wtime'),
87 $lng->
txt(
'tst_highscore_wtime_description')
91 $lng->
txt(
'tst_highscore_enabled'),
92 $lng->
txt(
'tst_highscore_description')
99 $fields = [
'highscore' => $optional_group];
100 return $f->section($fields, $lng->
txt(
'tst_results_gamification'))
102 $refinery->custom()->transformation(
104 $settings = clone $this;
106 if (! $v[
'highscore']) {
107 return $settings->withHighscoreEnabled(
false);
111 ->withHighscoreEnabled(
true)
112 ->withHighscoreOwnTable(
113 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_OWN_TABLE ||
114 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
116 ->withHighscoreTopTable(
117 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_TOP_TABLE ||
118 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
120 ->withHighscoreTopNum($v[
'highscore'][
'highscore_top_num'])
121 ->withHighscoreAnon($v[
'highscore'][
'highscore_anon'])
122 ->withHighscoreAchievedTS($v[
'highscore'][
'highscore_achieved_ts'])
123 ->withHighscoreScore($v[
'highscore'][
'highscore_score'])
124 ->withHighscorePercentage($v[
'highscore'][
'highscore_percentage'])
125 ->withHighscoreWTime($v[
'highscore'][
'highscore_wtime']);
156 case self::HIGHSCORE_SHOW_OWN_TABLE:
157 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_own_table');
159 case self::HIGHSCORE_SHOW_TOP_TABLE:
160 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_top_table');
162 case self::HIGHSCORE_SHOW_ALL_TABLES:
163 $highscore_mode = $additional_info->
getTagForLangVar(
'tst_highscore_all_tables');
193 $clone = clone $this;
204 $clone = clone $this;
214 $clone = clone $this;
222 return self::HIGHSCORE_SHOW_ALL_TABLES;
226 return self::HIGHSCORE_SHOW_TOP_TABLE;
230 return self::HIGHSCORE_SHOW_OWN_TABLE;
242 $clone = clone $this;
253 $clone = clone $this;
264 $clone = clone $this;
275 $clone = clone $this;
286 $clone = clone $this;
297 $clone = clone $this;
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
withHighscoreAnon(bool $highscore_anon)
const HIGHSCORE_SHOW_TOP_TABLE
__construct(int $test_id)
withHighscoreWTime(bool $highscore_wtime)
__construct(Container $dic, ilPlugin $plugin)
withHighscoreAchievedTS(bool $highscore_achieved_ts)
withHighscoreEnabled(bool $highscore_enabled)