19declare(strict_types=1);
52 array $environment =
null
54 $optional_group =
$f->optionalGroup(
56 'highscore_mode' =>
$f->radio(
$lng->txt(
'tst_highscore_mode'),
"")
63 'highscore_top_num' =>
$f->numeric(
$lng->txt(
'tst_highscore_top_num'),
$lng->txt(
'tst_highscore_top_num_description'))
66 'highscore_anon' =>
$f->checkbox(
67 $lng->txt(
'tst_highscore_anon'),
68 $lng->txt(
'tst_highscore_anon_description')
70 'highscore_achieved_ts' =>
$f->checkbox(
71 $lng->txt(
'tst_highscore_achieved_ts'),
72 $lng->txt(
'tst_highscore_achieved_ts_description')
74 'highscore_score' =>
$f->checkbox(
75 $lng->txt(
'tst_highscore_score'),
76 $lng->txt(
'tst_highscore_score_description')
78 'highscore_percentage' =>
$f->checkbox(
79 $lng->txt(
'tst_highscore_percentage'),
80 $lng->txt(
'tst_highscore_percentage_description')
82 'highscore_hints' =>
$f->checkbox(
83 $lng->txt(
'tst_highscore_hints'),
84 $lng->txt(
'tst_highscore_hints_description')
86 'highscore_wtime' =>
$f->checkbox(
87 $lng->txt(
'tst_highscore_wtime'),
88 $lng->txt(
'tst_highscore_wtime_description')
92 $lng->txt(
'tst_highscore_enabled'),
93 $lng->txt(
'tst_highscore_description')
97 $optional_group = $optional_group->withValue(
null);
100 $fields = [
'highscore' => $optional_group];
101 return $f->section($fields,
$lng->txt(
'tst_results_gamification'))
102 ->withAdditionalTransformation(
107 if (! $v[
'highscore']) {
108 return $settings->withHighscoreEnabled(
false);
112 ->withHighscoreEnabled(
true)
114 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_OWN_TABLE ||
115 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
118 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_TOP_TABLE ||
119 (
int) $v[
'highscore'][
'highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
136 'highscore_enabled' => [
'integer', (
int) $this->getHighscoreEnabled()],
137 'highscore_anon' => [
'integer', (
int) $this->getHighscoreAnon()],
138 'highscore_achieved_ts' => [
'integer', (
int) $this->getHighscoreAchievedTS()],
139 'highscore_score' => [
'integer', (
int) $this->getHighscoreScore()],
140 'highscore_percentage' => [
'integer', (
int) $this->getHighscorePercentage()],
141 'highscore_hints' => [
'integer', (
int) $this->getHighscoreHints()],
142 'highscore_wtime' => [
'integer', (
int) $this->getHighscoreWTime()],
143 'highscore_own_table' => [
'integer', (
int) $this->getHighscoreOwnTable()],
144 'highscore_top_table' => [
'integer', (
int) $this->getHighscoreTopTable()],
145 'highscore_top_num' => [
'integer', $this->getHighscoreTopNum()]
151 return $this->highscore_enabled;
155 $clone = clone $this;
156 $clone->highscore_enabled = $highscore_enabled;
162 return $this->highscore_own_table;
166 $clone = clone $this;
167 $clone->highscore_own_table = $highscore_own_table;
172 return $this->highscore_top_table;
176 $clone = clone $this;
177 $clone->highscore_top_table = $highscore_top_table;
183 if ($this->getHighscoreTopTable() && $this->getHighscoreOwnTable()) {
184 return self::HIGHSCORE_SHOW_ALL_TABLES;
187 if ($this->getHighscoreTopTable()) {
188 return self::HIGHSCORE_SHOW_TOP_TABLE;
191 if ($this->getHighscoreOwnTable()) {
192 return self::HIGHSCORE_SHOW_OWN_TABLE;
200 return $this->highscore_top_num;
204 $clone = clone $this;
205 $clone->highscore_top_num = $highscore_top_num;
211 return $this->highscore_anon;
215 $clone = clone $this;
216 $clone->highscore_anon = $highscore_anon;
222 return $this->highscore_achieved_ts;
226 $clone = clone $this;
227 $clone->highscore_achieved_ts = $highscore_achieved_ts;
233 return $this->highscore_score;
237 $clone = clone $this;
238 $clone->highscore_score = $highscore_score;
244 return $this->highscore_percentage;
248 $clone = clone $this;
249 $clone->highscore_percentage = $highscore_percentage;
255 return $this->highscore_hints;
259 $clone = clone $this;
260 $clone->highscore_hints = $highscore_hints;
266 return $this->highscore_wtime;
270 $clone = clone $this;
271 $clone->highscore_wtime = $highscore_wtime;
static return function(ContainerConfigurator $containerConfigurator)
withHighscoreOwnTable(bool $highscore_own_table)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
withHighscoreTopTable(bool $highscore_top_table)
bool $highscore_achieved_ts
__construct(int $test_id)
withHighscoreHints(bool $highscore_hints)
withHighscoreWTime(bool $highscore_wtime)
const HIGHSCORE_SHOW_TOP_TABLE
withHighscoreScore(bool $highscore_score)
bool $highscore_percentage
withHighscoreEnabled(bool $highscore_enabled)
withHighscoreAnon(bool $highscore_anon)
const HIGHSCORE_SHOW_ALL_TABLES
bool $highscore_top_table
bool $highscore_own_table
withHighscoreTopNum(int $highscore_top_num)
withHighscoreAchievedTS(bool $highscore_achieved_ts)
const HIGHSCORE_SHOW_OWN_TABLE
withHighscorePercentage(bool $highscore_percentage)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Refinery Factory $refinery