ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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)

Definition at line 43 of file ilObjTestSettingsGamification.php.

References ILIAS\GlobalScreen\Provider\__construct().

44  {
46  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getHighscoreAchievedTS()

ilObjTestSettingsGamification::getHighscoreAchievedTS ( )

Definition at line 220 of file ilObjTestSettingsGamification.php.

References $highscore_achieved_ts.

Referenced by toForm(), and toStorage().

220  : bool
221  {
223  }
+ Here is the caller graph for this function:

◆ getHighscoreAnon()

ilObjTestSettingsGamification::getHighscoreAnon ( )

Definition at line 209 of file ilObjTestSettingsGamification.php.

References $highscore_anon.

Referenced by toForm(), and toStorage().

209  : bool
210  {
211  return $this->highscore_anon;
212  }
+ Here is the caller graph for this function:

◆ getHighscoreEnabled()

ilObjTestSettingsGamification::getHighscoreEnabled ( )

Definition at line 149 of file ilObjTestSettingsGamification.php.

References $highscore_enabled.

Referenced by toForm(), and toStorage().

149  : bool
150  {
152  }
+ Here is the caller graph for this function:

◆ getHighscoreHints()

ilObjTestSettingsGamification::getHighscoreHints ( )

Definition at line 253 of file ilObjTestSettingsGamification.php.

References $highscore_hints.

Referenced by toForm(), and toStorage().

253  : bool
254  {
255  return $this->highscore_hints;
256  }
+ Here is the caller graph for this function:

◆ getHighScoreMode()

ilObjTestSettingsGamification::getHighScoreMode ( )

Definition at line 181 of file ilObjTestSettingsGamification.php.

References getHighscoreOwnTable(), and getHighscoreTopTable().

Referenced by toForm().

181  : int
182  {
183  if ($this->getHighscoreTopTable() && $this->getHighscoreOwnTable()) {
184  return self::HIGHSCORE_SHOW_ALL_TABLES;
185  }
186 
187  if ($this->getHighscoreTopTable()) {
188  return self::HIGHSCORE_SHOW_TOP_TABLE;
189  }
190 
191  if ($this->getHighscoreOwnTable()) {
192  return self::HIGHSCORE_SHOW_OWN_TABLE;
193  }
194 
195  return 0;
196  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHighscoreOwnTable()

ilObjTestSettingsGamification::getHighscoreOwnTable ( )

Definition at line 160 of file ilObjTestSettingsGamification.php.

References $highscore_own_table.

Referenced by getHighScoreMode(), and toStorage().

160  : bool
161  {
163  }
+ Here is the caller graph for this function:

◆ getHighscorePercentage()

ilObjTestSettingsGamification::getHighscorePercentage ( )

Definition at line 242 of file ilObjTestSettingsGamification.php.

References $highscore_percentage.

Referenced by toForm(), and toStorage().

242  : bool
243  {
245  }
+ Here is the caller graph for this function:

◆ getHighscoreScore()

ilObjTestSettingsGamification::getHighscoreScore ( )

Definition at line 231 of file ilObjTestSettingsGamification.php.

References $highscore_score.

Referenced by toForm(), and toStorage().

231  : bool
232  {
233  return $this->highscore_score;
234  }
+ Here is the caller graph for this function:

◆ getHighscoreTopNum()

ilObjTestSettingsGamification::getHighscoreTopNum ( )

Definition at line 198 of file ilObjTestSettingsGamification.php.

References $highscore_top_num.

Referenced by toForm(), and toStorage().

198  : int
199  {
201  }
+ Here is the caller graph for this function:

◆ getHighscoreTopTable()

ilObjTestSettingsGamification::getHighscoreTopTable ( )

Definition at line 170 of file ilObjTestSettingsGamification.php.

References $highscore_top_table.

Referenced by getHighScoreMode(), and toStorage().

170  : bool
171  {
173  }
+ Here is the caller graph for this function:

◆ getHighscoreWTime()

ilObjTestSettingsGamification::getHighscoreWTime ( )

Definition at line 264 of file ilObjTestSettingsGamification.php.

References $highscore_wtime.

Referenced by toForm(), and toStorage().

264  : bool
265  {
266  return $this->highscore_wtime;
267  }
+ Here is the caller graph for this function:

◆ toForm()

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

Definition at line 48 of file ilObjTestSettingsGamification.php.

References ILIAS\LTI\ToolProvider\$settings, getHighscoreAchievedTS(), getHighscoreAnon(), getHighscoreEnabled(), getHighscoreHints(), getHighScoreMode(), getHighscorePercentage(), getHighscoreScore(), getHighscoreTopNum(), getHighscoreWTime(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), ILIAS\UI\Implementation\Component\Input\withValue(), and ILIAS\UI\Component\Input\Input\withValue().

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'))
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)
113  ->withHighscoreOwnTable(
114  (int) $v['highscore']['highscore_mode'] == self::HIGHSCORE_SHOW_OWN_TABLE ||
115  (int) $v['highscore']['highscore_mode'] == self::HIGHSCORE_SHOW_ALL_TABLES
116  )
117  ->withHighscoreTopTable(
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  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$lng
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
This describes inputs that can be used in forms.
Definition: FormInput.php:31
Refinery Factory $refinery
+ Here is the call graph for this function:

◆ toStorage()

ilObjTestSettingsGamification::toStorage ( )

Definition at line 133 of file ilObjTestSettingsGamification.php.

References getHighscoreAchievedTS(), getHighscoreAnon(), getHighscoreEnabled(), getHighscoreHints(), getHighscoreOwnTable(), getHighscorePercentage(), getHighscoreScore(), getHighscoreTopNum(), getHighscoreTopTable(), getHighscoreWTime(), and ILIAS\Repository\int().

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  }
+ Here is the call graph for this function:

◆ withHighscoreAchievedTS()

ilObjTestSettingsGamification::withHighscoreAchievedTS ( bool  $highscore_achieved_ts)

Definition at line 224 of file ilObjTestSettingsGamification.php.

References $highscore_achieved_ts.

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.

References $highscore_anon.

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.

References $highscore_enabled.

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.

References $highscore_hints.

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.

References $highscore_own_table.

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.

References $highscore_percentage.

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.

References $highscore_score.

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.

References $highscore_top_num.

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.

References $highscore_top_table.

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.

References $highscore_wtime.

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

◆ $highscore_anon

bool ilObjTestSettingsGamification::$highscore_anon = true
protected

Definition at line 32 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreAnon(), and withHighscoreAnon().

◆ $highscore_enabled

bool ilObjTestSettingsGamification::$highscore_enabled = false
protected

Definition at line 31 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreEnabled(), and withHighscoreEnabled().

◆ $highscore_hints

bool ilObjTestSettingsGamification::$highscore_hints = true
protected

Definition at line 36 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreHints(), and withHighscoreHints().

◆ $highscore_own_table

bool ilObjTestSettingsGamification::$highscore_own_table = true
protected

◆ $highscore_percentage

bool ilObjTestSettingsGamification::$highscore_percentage = true
protected

◆ $highscore_score

bool ilObjTestSettingsGamification::$highscore_score = true
protected

Definition at line 34 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreScore(), and withHighscoreScore().

◆ $highscore_top_num

int ilObjTestSettingsGamification::$highscore_top_num = 10
protected

Definition at line 40 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreTopNum(), and withHighscoreTopNum().

◆ $highscore_top_table

bool ilObjTestSettingsGamification::$highscore_top_table = true
protected

◆ $highscore_wtime

bool ilObjTestSettingsGamification::$highscore_wtime = true
protected

Definition at line 37 of file ilObjTestSettingsGamification.php.

Referenced by getHighscoreWTime(), and withHighscoreWTime().

◆ 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: