ILIAS  release_8 Revision v8.24
ilObjTestSettingsGamification Class Reference
+ Inheritance diagram for ilObjTestSettingsGamification:
+ Collaboration diagram for ilObjTestSettingsGamification:

Public Member Functions

 __construct (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 
 getHighscoreEnabled ()
 
 withHighscoreEnabled (bool $highscore_enabled)
 
 getHighscoreOwnTable ()
 
 withHighscoreOwnTable (bool $highscore_own_table)
 
 getHighscoreTopTable ()
 
 withHighscoreTopTable (bool $highscore_top_table)
 
 getHighScoreMode ()
 
 getHighscoreTopNum ()
 
 withHighscoreTopNum (int $highscore_top_num)
 
 getHighscoreAnon ()
 
 withHighscoreAnon (bool $highscore_anon)
 
 getHighscoreAchievedTS ()
 
 withHighscoreAchievedTS (bool $highscore_achieved_ts)
 
 getHighscoreScore ()
 
 withHighscoreScore (bool $highscore_score)
 
 getHighscorePercentage ()
 
 withHighscorePercentage (bool $highscore_percentage)
 
 getHighscoreHints ()
 
 withHighscoreHints (bool $highscore_hints)
 
 getHighscoreWTime ()
 
 withHighscoreWTime (bool $highscore_wtime)
 
- Public Member Functions inherited from TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 

Data Fields

const HIGHSCORE_SHOW_OWN_TABLE = 1
 
const HIGHSCORE_SHOW_TOP_TABLE = 2
 
const HIGHSCORE_SHOW_ALL_TABLES = 3
 

Protected Attributes

bool $highscore_enabled = false
 
bool $highscore_anon = true
 
bool $highscore_achieved_ts = true
 
bool $highscore_score = true
 
bool $highscore_percentage = true
 
bool $highscore_hints = true
 
bool $highscore_wtime = true
 
bool $highscore_own_table = true
 
bool $highscore_top_table = true
 
int $highscore_top_num = 10
 
- Protected Attributes inherited from TestSettings
int $test_id
 

Detailed Description

Definition at line 25 of file ilObjTestSettingsGamification.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestSettingsGamification::__construct ( int  $test_id)

Reimplemented from TestSettings.

Definition at line 43 of file ilObjTestSettingsGamification.php.

44 {
46 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References TestSettings\$test_id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHighscoreAchievedTS()

ilObjTestSettingsGamification::getHighscoreAchievedTS ( )

Definition at line 220 of file ilObjTestSettingsGamification.php.

◆ getHighscoreAnon()

ilObjTestSettingsGamification::getHighscoreAnon ( )

Definition at line 209 of file ilObjTestSettingsGamification.php.

209 : bool
210 {
212 }

◆ getHighscoreEnabled()

ilObjTestSettingsGamification::getHighscoreEnabled ( )

Definition at line 149 of file ilObjTestSettingsGamification.php.

149 : bool
150 {
152 }

◆ getHighscoreHints()

ilObjTestSettingsGamification::getHighscoreHints ( )

Definition at line 253 of file ilObjTestSettingsGamification.php.

253 : bool
254 {
256 }

◆ getHighScoreMode()

ilObjTestSettingsGamification::getHighScoreMode ( )

◆ getHighscoreOwnTable()

ilObjTestSettingsGamification::getHighscoreOwnTable ( )

Definition at line 160 of file ilObjTestSettingsGamification.php.

160 : bool
161 {
163 }

◆ getHighscorePercentage()

ilObjTestSettingsGamification::getHighscorePercentage ( )

Definition at line 242 of file ilObjTestSettingsGamification.php.

242 : bool
243 {
245 }

◆ getHighscoreScore()

ilObjTestSettingsGamification::getHighscoreScore ( )

Definition at line 231 of file ilObjTestSettingsGamification.php.

231 : bool
232 {
234 }

◆ getHighscoreTopNum()

ilObjTestSettingsGamification::getHighscoreTopNum ( )

Definition at line 198 of file ilObjTestSettingsGamification.php.

◆ getHighscoreTopTable()

ilObjTestSettingsGamification::getHighscoreTopTable ( )

Definition at line 170 of file ilObjTestSettingsGamification.php.

170 : bool
171 {
173 }

◆ getHighscoreWTime()

ilObjTestSettingsGamification::getHighscoreWTime ( )

Definition at line 264 of file ilObjTestSettingsGamification.php.

264 : bool
265 {
267 }

◆ toForm()

ilObjTestSettingsGamification::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
array  $environment = null 
)

Reimplemented from TestSettings.

Definition at line 48 of file ilObjTestSettingsGamification.php.

53 : FormInput {
54 $optional_group = $f->optionalGroup(
55 [
56 'highscore_mode' => $f->radio($lng->txt('tst_highscore_mode'), "")
57 ->withOption((string) self::HIGHSCORE_SHOW_OWN_TABLE, $lng->txt('tst_highscore_own_table'), $lng->txt('tst_highscore_own_table_description'))
58 ->withOption((string) self::HIGHSCORE_SHOW_TOP_TABLE, $lng->txt('tst_highscore_top_table'), $lng->txt('tst_highscore_top_table_description'))
59 ->withOption((string) self::HIGHSCORE_SHOW_ALL_TABLES, $lng->txt('tst_highscore_all_tables'), $lng->txt('tst_highscore_all_tables_description'))
60 ->withValue($this->getHighScoreMode() > 0 ? (string) $this->getHighScoreMode() : '')
61 ->withRequired(true)
62 ,
63 'highscore_top_num' => $f->numeric($lng->txt('tst_highscore_top_num'), $lng->txt('tst_highscore_top_num_description'))
64 ->withRequired(true)
65 ->withValue($this->getHighscoreTopNum()),
66 'highscore_anon' => $f->checkbox(
67 $lng->txt('tst_highscore_anon'),
68 $lng->txt('tst_highscore_anon_description')
69 )->withValue($this->getHighscoreAnon()),
70 'highscore_achieved_ts' => $f->checkbox(
71 $lng->txt('tst_highscore_achieved_ts'),
72 $lng->txt('tst_highscore_achieved_ts_description')
73 )->withValue($this->getHighscoreAchievedTS()),
74 'highscore_score' => $f->checkbox(
75 $lng->txt('tst_highscore_score'),
76 $lng->txt('tst_highscore_score_description')
77 )->withValue($this->getHighscoreScore()),
78 'highscore_percentage' => $f->checkbox(
79 $lng->txt('tst_highscore_percentage'),
80 $lng->txt('tst_highscore_percentage_description')
81 )->withValue($this->getHighscorePercentage()),
82 'highscore_hints' => $f->checkbox(
83 $lng->txt('tst_highscore_hints'),
84 $lng->txt('tst_highscore_hints_description')
85 )->withValue($this->getHighscoreHints()),
86 'highscore_wtime' => $f->checkbox(
87 $lng->txt('tst_highscore_wtime'),
88 $lng->txt('tst_highscore_wtime_description')
89 )->withValue($this->getHighscoreWTime())
90
91 ],
92 $lng->txt('tst_highscore_enabled'),
93 $lng->txt('tst_highscore_description')
94 );
95
96 if (!$this->getHighscoreEnabled()) {
97 $optional_group = $optional_group->withValue(null);
98 }
99
100 $fields = ['highscore' => $optional_group];
101 return $f->section($fields, $lng->txt('tst_results_gamification'))
102 ->withAdditionalTransformation(
103 $refinery->custom()->transformation(
104 function ($v) {
105 $settings = clone $this;
106
107 if (! $v['highscore']) {
108 return $settings->withHighscoreEnabled(false);
109 }
110
111 return $settings
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
116 )
118 (int) $v['highscore']['highscore_mode'] == self::HIGHSCORE_SHOW_TOP_TABLE ||
119 (int) $v['highscore']['highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
120 )
121 ->withHighscoreTopNum($v['highscore']['highscore_top_num'])
122 ->withHighscoreAnon($v['highscore']['highscore_anon'])
123 ->withHighscoreAchievedTS($v['highscore']['highscore_achieved_ts'])
124 ->withHighscoreScore($v['highscore']['highscore_score'])
125 ->withHighscorePercentage($v['highscore']['highscore_percentage'])
126 ->withHighscoreHints($v['highscore']['highscore_hints'])
127 ->withHighscoreWTime($v['highscore']['highscore_wtime']);
128 }
129 )
130 );
131 }
static return function(ContainerConfigurator $containerConfigurator)
Definition: basic_rector.php:9
withHighscoreOwnTable(bool $highscore_own_table)
withHighscoreTopTable(bool $highscore_top_table)
withHighscoreAchievedTS(bool $highscore_achieved_ts)
withHighscorePercentage(bool $highscore_percentage)
This describes inputs that can be used in forms.
Definition: FormInput.php:32
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
Refinery Factory $refinery
$lng

◆ toStorage()

ilObjTestSettingsGamification::toStorage ( )

Reimplemented from TestSettings.

Definition at line 133 of file ilObjTestSettingsGamification.php.

133 : array
134 {
135 return [
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()]
146 ];
147 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ withHighscoreAchievedTS()

ilObjTestSettingsGamification::withHighscoreAchievedTS ( bool  $highscore_achieved_ts)

Definition at line 224 of file ilObjTestSettingsGamification.php.

224 : self
225 {
226 $clone = clone $this;
227 $clone->highscore_achieved_ts = $highscore_achieved_ts;
228 return $clone;
229 }

◆ withHighscoreAnon()

ilObjTestSettingsGamification::withHighscoreAnon ( bool  $highscore_anon)

Definition at line 213 of file ilObjTestSettingsGamification.php.

213 : self
214 {
215 $clone = clone $this;
216 $clone->highscore_anon = $highscore_anon;
217 return $clone;
218 }

◆ withHighscoreEnabled()

ilObjTestSettingsGamification::withHighscoreEnabled ( bool  $highscore_enabled)

Definition at line 153 of file ilObjTestSettingsGamification.php.

153 : self
154 {
155 $clone = clone $this;
156 $clone->highscore_enabled = $highscore_enabled;
157 return $clone;
158 }

◆ withHighscoreHints()

ilObjTestSettingsGamification::withHighscoreHints ( bool  $highscore_hints)

Definition at line 257 of file ilObjTestSettingsGamification.php.

257 : self
258 {
259 $clone = clone $this;
260 $clone->highscore_hints = $highscore_hints;
261 return $clone;
262 }

◆ withHighscoreOwnTable()

ilObjTestSettingsGamification::withHighscoreOwnTable ( bool  $highscore_own_table)

Definition at line 164 of file ilObjTestSettingsGamification.php.

164 : self
165 {
166 $clone = clone $this;
167 $clone->highscore_own_table = $highscore_own_table;
168 return $clone;
169 }

◆ withHighscorePercentage()

ilObjTestSettingsGamification::withHighscorePercentage ( bool  $highscore_percentage)

Definition at line 246 of file ilObjTestSettingsGamification.php.

246 : self
247 {
248 $clone = clone $this;
249 $clone->highscore_percentage = $highscore_percentage;
250 return $clone;
251 }

◆ withHighscoreScore()

ilObjTestSettingsGamification::withHighscoreScore ( bool  $highscore_score)

Definition at line 235 of file ilObjTestSettingsGamification.php.

235 : self
236 {
237 $clone = clone $this;
238 $clone->highscore_score = $highscore_score;
239 return $clone;
240 }

◆ withHighscoreTopNum()

ilObjTestSettingsGamification::withHighscoreTopNum ( int  $highscore_top_num)

Definition at line 202 of file ilObjTestSettingsGamification.php.

202 : self
203 {
204 $clone = clone $this;
205 $clone->highscore_top_num = $highscore_top_num;
206 return $clone;
207 }

◆ withHighscoreTopTable()

ilObjTestSettingsGamification::withHighscoreTopTable ( bool  $highscore_top_table)

Definition at line 174 of file ilObjTestSettingsGamification.php.

174 : self
175 {
176 $clone = clone $this;
177 $clone->highscore_top_table = $highscore_top_table;
178 return $clone;
179 }

◆ withHighscoreWTime()

ilObjTestSettingsGamification::withHighscoreWTime ( bool  $highscore_wtime)

Definition at line 268 of file ilObjTestSettingsGamification.php.

268 : self
269 {
270 $clone = clone $this;
271 $clone->highscore_wtime = $highscore_wtime;
272 return $clone;
273 }

Field Documentation

◆ $highscore_achieved_ts

bool ilObjTestSettingsGamification::$highscore_achieved_ts = true
protected

Definition at line 33 of file ilObjTestSettingsGamification.php.

◆ $highscore_anon

bool ilObjTestSettingsGamification::$highscore_anon = true
protected

Definition at line 32 of file ilObjTestSettingsGamification.php.

◆ $highscore_enabled

bool ilObjTestSettingsGamification::$highscore_enabled = false
protected

Definition at line 31 of file ilObjTestSettingsGamification.php.

◆ $highscore_hints

bool ilObjTestSettingsGamification::$highscore_hints = true
protected

Definition at line 36 of file ilObjTestSettingsGamification.php.

◆ $highscore_own_table

bool ilObjTestSettingsGamification::$highscore_own_table = true
protected

Definition at line 38 of file ilObjTestSettingsGamification.php.

◆ $highscore_percentage

bool ilObjTestSettingsGamification::$highscore_percentage = true
protected

Definition at line 35 of file ilObjTestSettingsGamification.php.

◆ $highscore_score

bool ilObjTestSettingsGamification::$highscore_score = true
protected

Definition at line 34 of file ilObjTestSettingsGamification.php.

◆ $highscore_top_num

int ilObjTestSettingsGamification::$highscore_top_num = 10
protected

Definition at line 40 of file ilObjTestSettingsGamification.php.

◆ $highscore_top_table

bool ilObjTestSettingsGamification::$highscore_top_table = true
protected

Definition at line 39 of file ilObjTestSettingsGamification.php.

◆ $highscore_wtime

bool ilObjTestSettingsGamification::$highscore_wtime = true
protected

Definition at line 37 of file ilObjTestSettingsGamification.php.

◆ HIGHSCORE_SHOW_ALL_TABLES

const ilObjTestSettingsGamification::HIGHSCORE_SHOW_ALL_TABLES = 3

Definition at line 29 of file ilObjTestSettingsGamification.php.

◆ HIGHSCORE_SHOW_OWN_TABLE

const ilObjTestSettingsGamification::HIGHSCORE_SHOW_OWN_TABLE = 1

Definition at line 27 of file ilObjTestSettingsGamification.php.

◆ HIGHSCORE_SHOW_TOP_TABLE

const ilObjTestSettingsGamification::HIGHSCORE_SHOW_TOP_TABLE = 2

Definition at line 28 of file ilObjTestSettingsGamification.php.


The documentation for this class was generated from the following file: