|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource; |
|
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
|
11
|
|
|
use Chamilo\CoreBundle\Entity\ResourceShowCourseResourcesInSessionInterface; |
|
12
|
|
|
use Chamilo\CoreBundle\Entity\TrackEExercise; |
|
13
|
|
|
use Chamilo\CourseBundle\Repository\CQuizRepository; |
|
14
|
|
|
use DateTime; |
|
15
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
16
|
|
|
use Doctrine\Common\Collections\Collection; |
|
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
18
|
|
|
use Stringable; |
|
19
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
20
|
|
|
use Symfony\Component\Uid\Uuid; |
|
21
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Course quizzes. |
|
25
|
|
|
*/ |
|
26
|
|
|
#[ORM\Table(name: 'c_quiz')] |
|
27
|
|
|
#[ORM\Entity(repositoryClass: CQuizRepository::class)] |
|
28
|
|
|
class CQuiz extends AbstractResource implements ResourceInterface, ResourceShowCourseResourcesInSessionInterface, Stringable |
|
29
|
|
|
{ |
|
30
|
|
|
public const ALL_ON_ONE_PAGE = 1; |
|
31
|
|
|
public const ONE_PER_PAGE = 2; |
|
32
|
|
|
|
|
33
|
|
|
#[Groups(['track_e_exercise:read'])] |
|
34
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
|
35
|
|
|
#[ORM\Id] |
|
36
|
|
|
#[ORM\GeneratedValue] |
|
37
|
|
|
protected ?int $iid = null; |
|
38
|
|
|
|
|
39
|
|
|
#[Assert\NotBlank] |
|
40
|
|
|
#[ORM\Column(name: 'title', type: 'text', nullable: false)] |
|
41
|
|
|
protected string $title; |
|
42
|
|
|
|
|
43
|
|
|
#[ORM\Column(name: 'description', type: 'text', nullable: true)] |
|
44
|
|
|
protected ?string $description = null; |
|
45
|
|
|
|
|
46
|
|
|
#[ORM\Column(name: 'sound', type: 'string', length: 255, nullable: true)] |
|
47
|
|
|
protected ?string $sound = null; |
|
48
|
|
|
|
|
49
|
|
|
#[ORM\Column(name: 'type', type: 'integer', nullable: false)] |
|
50
|
|
|
protected int $type; |
|
51
|
|
|
|
|
52
|
|
|
#[ORM\Column(name: 'random', type: 'integer', nullable: false)] |
|
53
|
|
|
protected int $random; |
|
54
|
|
|
|
|
55
|
|
|
#[ORM\Column(name: 'random_answers', type: 'boolean', nullable: false)] |
|
56
|
|
|
protected bool $randomAnswers; |
|
57
|
|
|
|
|
58
|
|
|
#[ORM\Column(name: 'active', type: 'integer', nullable: false)] |
|
59
|
|
|
protected int $active; |
|
60
|
|
|
|
|
61
|
|
|
#[ORM\Column(name: 'results_disabled', type: 'integer', nullable: false)] |
|
62
|
|
|
protected int $resultsDisabled; |
|
63
|
|
|
|
|
64
|
|
|
#[ORM\Column(name: 'access_condition', type: 'text', nullable: true)] |
|
65
|
|
|
protected ?string $accessCondition = null; |
|
66
|
|
|
|
|
67
|
|
|
#[ORM\Column(name: 'max_attempt', type: 'integer', nullable: false)] |
|
68
|
|
|
protected int $maxAttempt; |
|
69
|
|
|
|
|
70
|
|
|
#[ORM\Column(name: 'start_time', type: 'datetime', nullable: true)] |
|
71
|
|
|
protected ?DateTime $startTime = null; |
|
72
|
|
|
|
|
73
|
|
|
#[ORM\Column(name: 'end_time', type: 'datetime', nullable: true)] |
|
74
|
|
|
protected ?DateTime $endTime = null; |
|
75
|
|
|
|
|
76
|
|
|
#[ORM\Column(name: 'feedback_type', type: 'integer', nullable: false)] |
|
77
|
|
|
protected int $feedbackType; |
|
78
|
|
|
|
|
79
|
|
|
#[ORM\Column(name: 'expired_time', type: 'integer', nullable: false)] |
|
80
|
|
|
protected int $expiredTime; |
|
81
|
|
|
|
|
82
|
|
|
#[ORM\Column(name: 'propagate_neg', type: 'integer', nullable: false)] |
|
83
|
|
|
protected int $propagateNeg; |
|
84
|
|
|
|
|
85
|
|
|
#[ORM\Column(name: 'save_correct_answers', type: 'integer', nullable: true)] |
|
86
|
|
|
protected ?int $saveCorrectAnswers; |
|
87
|
|
|
|
|
88
|
|
|
#[ORM\Column(name: 'review_answers', type: 'integer', nullable: false)] |
|
89
|
|
|
protected int $reviewAnswers; |
|
90
|
|
|
|
|
91
|
|
|
#[ORM\Column(name: 'random_by_category', type: 'integer', nullable: false)] |
|
92
|
|
|
protected int $randomByCategory; |
|
93
|
|
|
|
|
94
|
|
|
#[ORM\Column(name: 'text_when_finished', type: 'text', nullable: true)] |
|
95
|
|
|
protected ?string $textWhenFinished = null; |
|
96
|
|
|
|
|
97
|
|
|
#[ORM\Column(name: 'text_when_finished_failure', type: 'text', nullable: true)] |
|
98
|
|
|
protected ?string $textWhenFinishedFailure = null; |
|
99
|
|
|
|
|
100
|
|
|
#[ORM\Column(name: 'display_category_name', type: 'integer', nullable: false)] |
|
101
|
|
|
protected int $displayCategoryName; |
|
102
|
|
|
|
|
103
|
|
|
#[ORM\Column(name: 'pass_percentage', type: 'integer', nullable: true)] |
|
104
|
|
|
protected ?int $passPercentage = null; |
|
105
|
|
|
|
|
106
|
|
|
#[ORM\Column(name: 'prevent_backwards', type: 'integer', nullable: false, options: ['default' => 0])] |
|
107
|
|
|
protected int $preventBackwards; |
|
108
|
|
|
|
|
109
|
|
|
#[ORM\Column(name: 'question_selection_type', type: 'integer', nullable: true)] |
|
110
|
|
|
protected ?int $questionSelectionType = null; |
|
111
|
|
|
|
|
112
|
|
|
#[ORM\Column(name: 'hide_question_number', type: 'integer', nullable: false, options: ['default' => 0])] |
|
113
|
|
|
protected int $hideQuestionNumber; |
|
114
|
|
|
|
|
115
|
|
|
#[ORM\Column(name: 'hide_question_title', type: 'boolean', nullable: false)] |
|
116
|
|
|
protected bool $hideQuestionTitle; |
|
117
|
|
|
|
|
118
|
|
|
#[ORM\ManyToOne(targetEntity: CQuizCategory::class, cascade: ['persist'])] |
|
119
|
|
|
#[ORM\JoinColumn(name: 'quiz_category_id', referencedColumnName: 'id', onDelete: 'SET NULL')] |
|
120
|
|
|
protected ?CQuizCategory $quizCategory = null; |
|
121
|
|
|
|
|
122
|
|
|
#[ORM\Column(name: 'show_previous_button', type: 'boolean', nullable: false, options: ['default' => 1])] |
|
123
|
|
|
protected bool $showPreviousButton; |
|
124
|
|
|
|
|
125
|
|
|
#[ORM\Column(name: 'notifications', type: 'string', length: 255, nullable: true)] |
|
126
|
|
|
protected ?string $notifications; |
|
127
|
|
|
|
|
128
|
|
|
#[ORM\Column(name: 'autolaunch', type: 'boolean', nullable: true, options: ['default' => 0])] |
|
129
|
|
|
protected ?bool $autoLaunch; |
|
130
|
|
|
|
|
131
|
|
|
#[ORM\Column(name: 'hide_attempts_table', type: 'boolean', nullable: false, options: ['default' => 0])] |
|
132
|
|
|
protected bool $hideAttemptsTable; |
|
133
|
|
|
|
|
134
|
|
|
#[ORM\Column(name: 'page_result_configuration', type: 'array')] |
|
135
|
|
|
protected array $pageResultConfiguration = []; |
|
136
|
|
|
|
|
137
|
|
|
#[ORM\Column(name: 'display_chart_degree_certainty', type: 'integer', options: ['default' => 0])] |
|
138
|
|
|
protected int $displayChartDegreeCertainty = 0; |
|
139
|
|
|
|
|
140
|
|
|
#[ORM\Column(name: 'send_email_chart_degree_certainty', type: 'integer', options: ['default' => 0])] |
|
141
|
|
|
protected int $sendEmailChartDegreeCertainty = 0; |
|
142
|
|
|
|
|
143
|
|
|
#[ORM\Column(name: 'not_display_balance_percentage_categorie_question', type: 'integer', options: ['default' => 0])] |
|
144
|
|
|
protected int $notDisplayBalancePercentageCategorieQuestion = 0; |
|
145
|
|
|
|
|
146
|
|
|
#[ORM\Column(name: 'display_chart_degree_certainty_category', type: 'integer', options: ['default' => 0])] |
|
147
|
|
|
protected int $displayChartDegreeCertaintyCategory = 0; |
|
148
|
|
|
|
|
149
|
|
|
#[ORM\Column(name: 'gather_questions_categories', type: 'integer', options: ['default' => 0])] |
|
150
|
|
|
protected int $gatherQuestionsCategories = 0; |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @var Collection<int, CQuizRelQuestion> |
|
154
|
|
|
*/ |
|
155
|
|
|
#[ORM\OneToMany(mappedBy: 'quiz', targetEntity: CQuizRelQuestion::class, cascade: ['persist'], orphanRemoval: true)] |
|
156
|
|
|
protected Collection $questions; |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @var Collection<int, CQuizRelQuestionCategory> |
|
160
|
|
|
*/ |
|
161
|
|
|
#[ORM\OneToMany(mappedBy: 'quiz', targetEntity: CQuizRelQuestionCategory::class, cascade: ['persist'])] |
|
162
|
|
|
protected Collection $questionsCategories; |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* @var Collection<int, TrackEExercise> |
|
166
|
|
|
*/ |
|
167
|
|
|
#[ORM\OneToMany(mappedBy: 'quiz', targetEntity: TrackEExercise::class)] |
|
168
|
|
|
protected Collection $attempts; |
|
169
|
|
|
|
|
170
|
|
|
#[ORM\Column(name: 'duration', type: 'integer', nullable: true)] |
|
171
|
|
|
protected ?int $duration = null; |
|
172
|
|
|
|
|
173
|
|
|
public function __construct() |
|
174
|
|
|
{ |
|
175
|
|
|
$this->questions = new ArrayCollection(); |
|
176
|
|
|
$this->questionsCategories = new ArrayCollection(); |
|
177
|
|
|
$this->hideQuestionTitle = false; |
|
178
|
|
|
$this->hideQuestionNumber = 0; |
|
179
|
|
|
$this->type = self::ONE_PER_PAGE; |
|
180
|
|
|
$this->showPreviousButton = true; |
|
181
|
|
|
$this->notifications = ''; |
|
182
|
|
|
$this->autoLaunch = false; |
|
183
|
|
|
$this->preventBackwards = 0; |
|
184
|
|
|
$this->random = 0; |
|
185
|
|
|
$this->randomAnswers = false; |
|
186
|
|
|
$this->active = 1; |
|
187
|
|
|
$this->resultsDisabled = 0; |
|
188
|
|
|
$this->maxAttempt = 1; |
|
189
|
|
|
$this->feedbackType = 0; |
|
190
|
|
|
$this->expiredTime = 0; |
|
191
|
|
|
$this->propagateNeg = 0; |
|
192
|
|
|
$this->saveCorrectAnswers = 0; |
|
193
|
|
|
$this->reviewAnswers = 0; |
|
194
|
|
|
$this->randomByCategory = 0; |
|
195
|
|
|
$this->displayCategoryName = 0; |
|
196
|
|
|
$this->hideAttemptsTable = false; |
|
197
|
|
|
$this->pageResultConfiguration = []; |
|
198
|
|
|
$this->attempts = new ArrayCollection(); |
|
199
|
|
|
$this->hideAttemptsTable = false; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
public function __toString(): string |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->getTitle(); |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* @return ArrayCollection<int, CQuizRelQuestion> |
|
209
|
|
|
*/ |
|
210
|
|
|
public function getQuestions(): Collection |
|
211
|
|
|
{ |
|
212
|
|
|
return $this->questions instanceof ArrayCollection ? |
|
213
|
|
|
$this->questions : |
|
214
|
|
|
new ArrayCollection($this->questions->toArray()); |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function setTitle(string $title): self |
|
218
|
|
|
{ |
|
219
|
|
|
$this->title = $title; |
|
220
|
|
|
|
|
221
|
|
|
return $this; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
public function getTitle(): string |
|
225
|
|
|
{ |
|
226
|
|
|
return $this->title; |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
public function setDescription(string $description): self |
|
230
|
|
|
{ |
|
231
|
|
|
$this->description = $description; |
|
232
|
|
|
|
|
233
|
|
|
return $this; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* Get description. |
|
238
|
|
|
* |
|
239
|
|
|
* @return string |
|
240
|
|
|
*/ |
|
241
|
|
|
public function getDescription() |
|
242
|
|
|
{ |
|
243
|
|
|
return $this->description; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
public function setSound(string $sound): self |
|
247
|
|
|
{ |
|
248
|
|
|
$this->sound = $sound; |
|
249
|
|
|
|
|
250
|
|
|
return $this; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
public function getSound(): ?string |
|
254
|
|
|
{ |
|
255
|
|
|
return $this->sound; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
public function setType(int $type): self |
|
259
|
|
|
{ |
|
260
|
|
|
$this->type = $type; |
|
261
|
|
|
|
|
262
|
|
|
return $this; |
|
263
|
|
|
} |
|
264
|
|
|
|
|
265
|
|
|
public function getType(): int |
|
266
|
|
|
{ |
|
267
|
|
|
return $this->type; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
public function setRandom(int $random): self |
|
271
|
|
|
{ |
|
272
|
|
|
$this->random = $random; |
|
273
|
|
|
|
|
274
|
|
|
return $this; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
/** |
|
278
|
|
|
* Get random. |
|
279
|
|
|
* |
|
280
|
|
|
* @return int |
|
281
|
|
|
*/ |
|
282
|
|
|
public function getRandom() |
|
283
|
|
|
{ |
|
284
|
|
|
return $this->random; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
public function setRandomAnswers(bool $randomAnswers): self |
|
288
|
|
|
{ |
|
289
|
|
|
$this->randomAnswers = $randomAnswers; |
|
290
|
|
|
|
|
291
|
|
|
return $this; |
|
292
|
|
|
} |
|
293
|
|
|
|
|
294
|
|
|
public function getRandomAnswers(): bool |
|
295
|
|
|
{ |
|
296
|
|
|
return $this->randomAnswers; |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
public function setActive(int $active): self |
|
300
|
|
|
{ |
|
301
|
|
|
$this->active = $active; |
|
302
|
|
|
|
|
303
|
|
|
return $this; |
|
304
|
|
|
} |
|
305
|
|
|
|
|
306
|
|
|
public function getActive(): int |
|
307
|
|
|
{ |
|
308
|
|
|
return $this->active; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
public function setResultsDisabled(int $resultsDisabled): self |
|
312
|
|
|
{ |
|
313
|
|
|
$this->resultsDisabled = $resultsDisabled; |
|
314
|
|
|
|
|
315
|
|
|
return $this; |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
public function getResultsDisabled(): int |
|
319
|
|
|
{ |
|
320
|
|
|
return $this->resultsDisabled; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
public function setAccessCondition(string $accessCondition): self |
|
324
|
|
|
{ |
|
325
|
|
|
$this->accessCondition = $accessCondition; |
|
326
|
|
|
|
|
327
|
|
|
return $this; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
public function getAccessCondition(): ?string |
|
331
|
|
|
{ |
|
332
|
|
|
return $this->accessCondition; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
public function setMaxAttempt(int $maxAttempt): self |
|
336
|
|
|
{ |
|
337
|
|
|
$this->maxAttempt = $maxAttempt; |
|
338
|
|
|
|
|
339
|
|
|
return $this; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
public function getMaxAttempt(): int |
|
343
|
|
|
{ |
|
344
|
|
|
return $this->maxAttempt; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
public function setStartTime(?DateTime $startTime): self |
|
348
|
|
|
{ |
|
349
|
|
|
$this->startTime = $startTime; |
|
350
|
|
|
|
|
351
|
|
|
return $this; |
|
352
|
|
|
} |
|
353
|
|
|
|
|
354
|
|
|
public function getStartTime(): ?DateTime |
|
355
|
|
|
{ |
|
356
|
|
|
return $this->startTime; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
public function setEndTime(?DateTime $endTime): self |
|
360
|
|
|
{ |
|
361
|
|
|
$this->endTime = $endTime; |
|
362
|
|
|
|
|
363
|
|
|
return $this; |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
public function getEndTime(): ?DateTime |
|
367
|
|
|
{ |
|
368
|
|
|
return $this->endTime; |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
public function setFeedbackType(int $feedbackType): self |
|
372
|
|
|
{ |
|
373
|
|
|
$this->feedbackType = $feedbackType; |
|
374
|
|
|
|
|
375
|
|
|
return $this; |
|
376
|
|
|
} |
|
377
|
|
|
|
|
378
|
|
|
public function getFeedbackType(): int |
|
379
|
|
|
{ |
|
380
|
|
|
return $this->feedbackType; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
public function setExpiredTime(int $expiredTime): self |
|
384
|
|
|
{ |
|
385
|
|
|
$this->expiredTime = $expiredTime; |
|
386
|
|
|
|
|
387
|
|
|
return $this; |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
public function getExpiredTime(): int |
|
391
|
|
|
{ |
|
392
|
|
|
return $this->expiredTime; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
public function setPropagateNeg(int $propagateNeg): self |
|
396
|
|
|
{ |
|
397
|
|
|
$this->propagateNeg = $propagateNeg; |
|
398
|
|
|
|
|
399
|
|
|
return $this; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
/** |
|
403
|
|
|
* Get propagateNeg. |
|
404
|
|
|
*/ |
|
405
|
|
|
public function getPropagateNeg(): int |
|
406
|
|
|
{ |
|
407
|
|
|
return $this->propagateNeg; |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
public function setSaveCorrectAnswers(int $saveCorrectAnswers): self |
|
411
|
|
|
{ |
|
412
|
|
|
$this->saveCorrectAnswers = $saveCorrectAnswers; |
|
413
|
|
|
|
|
414
|
|
|
return $this; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
public function getSaveCorrectAnswers(): ?int |
|
418
|
|
|
{ |
|
419
|
|
|
return $this->saveCorrectAnswers; |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
public function setReviewAnswers(int $reviewAnswers): self |
|
423
|
|
|
{ |
|
424
|
|
|
$this->reviewAnswers = $reviewAnswers; |
|
425
|
|
|
|
|
426
|
|
|
return $this; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
/** |
|
430
|
|
|
* Get reviewAnswers. |
|
431
|
|
|
*/ |
|
432
|
|
|
public function getReviewAnswers(): int |
|
433
|
|
|
{ |
|
434
|
|
|
return $this->reviewAnswers; |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
public function setRandomByCategory(int $randomByCategory): self |
|
438
|
|
|
{ |
|
439
|
|
|
$this->randomByCategory = $randomByCategory; |
|
440
|
|
|
|
|
441
|
|
|
return $this; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
/** |
|
445
|
|
|
* Get randomByCategory. |
|
446
|
|
|
*/ |
|
447
|
|
|
public function getRandomByCategory(): int |
|
448
|
|
|
{ |
|
449
|
|
|
return $this->randomByCategory; |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
/** |
|
453
|
|
|
* Set text to display to user when they succeed to the test or, when no pass percentage has been set, when the |
|
454
|
|
|
* test is finished. |
|
455
|
|
|
*/ |
|
456
|
|
|
public function setTextWhenFinished(string $textWhenFinished): self |
|
457
|
|
|
{ |
|
458
|
|
|
$this->textWhenFinished = $textWhenFinished; |
|
459
|
|
|
|
|
460
|
|
|
return $this; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* Get text to display to user when they succeed to the test or, when no pass percentage has been set, when the |
|
465
|
|
|
* test is finished. |
|
466
|
|
|
*/ |
|
467
|
|
|
public function getTextWhenFinished(): ?string |
|
468
|
|
|
{ |
|
469
|
|
|
return $this->textWhenFinished; |
|
470
|
|
|
} |
|
471
|
|
|
|
|
472
|
|
|
/** |
|
473
|
|
|
* Set text to display to user when they fail to the test (when pass percentage has been set). |
|
474
|
|
|
*/ |
|
475
|
|
|
public function setTextWhenFinishedFailure(?string $textWhenFinished): self |
|
476
|
|
|
{ |
|
477
|
|
|
$this->textWhenFinishedFailure = $textWhenFinished; |
|
478
|
|
|
|
|
479
|
|
|
return $this; |
|
480
|
|
|
} |
|
481
|
|
|
|
|
482
|
|
|
/** |
|
483
|
|
|
* Get text to display to user when they fail to the test (when pass percentage has been set). |
|
484
|
|
|
*/ |
|
485
|
|
|
public function getTextWhenFinishedFailure(): ?string |
|
486
|
|
|
{ |
|
487
|
|
|
if (empty($this->textWhenFinishedFailure)) { |
|
488
|
|
|
return ''; |
|
489
|
|
|
} |
|
490
|
|
|
|
|
491
|
|
|
return $this->textWhenFinishedFailure; |
|
492
|
|
|
} |
|
493
|
|
|
|
|
494
|
|
|
public function setDisplayCategoryName(int $displayCategoryName): self |
|
495
|
|
|
{ |
|
496
|
|
|
$this->displayCategoryName = $displayCategoryName; |
|
497
|
|
|
|
|
498
|
|
|
return $this; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* Get displayCategoryName. |
|
503
|
|
|
*/ |
|
504
|
|
|
public function getDisplayCategoryName(): int |
|
505
|
|
|
{ |
|
506
|
|
|
return $this->displayCategoryName; |
|
507
|
|
|
} |
|
508
|
|
|
|
|
509
|
|
|
public function setPassPercentage(int $passPercentage): self |
|
510
|
|
|
{ |
|
511
|
|
|
$this->passPercentage = $passPercentage; |
|
512
|
|
|
|
|
513
|
|
|
return $this; |
|
514
|
|
|
} |
|
515
|
|
|
|
|
516
|
|
|
/** |
|
517
|
|
|
* Get passPercentage. |
|
518
|
|
|
*/ |
|
519
|
|
|
public function getPassPercentage(): ?int |
|
520
|
|
|
{ |
|
521
|
|
|
return $this->passPercentage; |
|
522
|
|
|
} |
|
523
|
|
|
|
|
524
|
|
|
public function getQuizCategory(): ?CQuizCategory |
|
525
|
|
|
{ |
|
526
|
|
|
return $this->quizCategory; |
|
527
|
|
|
} |
|
528
|
|
|
|
|
529
|
|
|
public function setQuizCategory(CQuizCategory $quizCategory): self |
|
530
|
|
|
{ |
|
531
|
|
|
$this->quizCategory = $quizCategory; |
|
532
|
|
|
|
|
533
|
|
|
return $this; |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
public function getQuestionSelectionType(): ?int |
|
537
|
|
|
{ |
|
538
|
|
|
return $this->questionSelectionType; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
public function setQuestionSelectionType(int $questionSelectionType): self |
|
542
|
|
|
{ |
|
543
|
|
|
$this->questionSelectionType = $questionSelectionType; |
|
544
|
|
|
|
|
545
|
|
|
return $this; |
|
546
|
|
|
} |
|
547
|
|
|
|
|
548
|
|
|
public function isHideQuestionTitle(): bool |
|
549
|
|
|
{ |
|
550
|
|
|
return $this->hideQuestionTitle; |
|
551
|
|
|
} |
|
552
|
|
|
|
|
553
|
|
|
public function setHideQuestionTitle(bool $hideQuestionTitle): self |
|
554
|
|
|
{ |
|
555
|
|
|
$this->hideQuestionTitle = $hideQuestionTitle; |
|
556
|
|
|
|
|
557
|
|
|
return $this; |
|
558
|
|
|
} |
|
559
|
|
|
|
|
560
|
|
|
public function isShowPreviousButton(): bool |
|
561
|
|
|
{ |
|
562
|
|
|
return $this->showPreviousButton; |
|
563
|
|
|
} |
|
564
|
|
|
|
|
565
|
|
|
public function setShowPreviousButton(bool $showPreviousButton): self |
|
566
|
|
|
{ |
|
567
|
|
|
$this->showPreviousButton = $showPreviousButton; |
|
568
|
|
|
|
|
569
|
|
|
return $this; |
|
570
|
|
|
} |
|
571
|
|
|
|
|
572
|
|
|
public function getNotifications(): string |
|
573
|
|
|
{ |
|
574
|
|
|
return $this->notifications; |
|
|
|
|
|
|
575
|
|
|
} |
|
576
|
|
|
|
|
577
|
|
|
public function setNotifications(string $notifications): self |
|
578
|
|
|
{ |
|
579
|
|
|
$this->notifications = $notifications; |
|
580
|
|
|
|
|
581
|
|
|
return $this; |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
public function getIid(): ?int |
|
585
|
|
|
{ |
|
586
|
|
|
return $this->iid; |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
public function getPreventBackwards(): int |
|
590
|
|
|
{ |
|
591
|
|
|
return $this->preventBackwards; |
|
592
|
|
|
} |
|
593
|
|
|
|
|
594
|
|
|
public function setPreventBackwards(int $preventBackwards): self |
|
595
|
|
|
{ |
|
596
|
|
|
$this->preventBackwards = $preventBackwards; |
|
597
|
|
|
|
|
598
|
|
|
return $this; |
|
599
|
|
|
} |
|
600
|
|
|
|
|
601
|
|
|
public function isAutoLaunch(): bool |
|
602
|
|
|
{ |
|
603
|
|
|
return $this->autoLaunch; |
|
|
|
|
|
|
604
|
|
|
} |
|
605
|
|
|
|
|
606
|
|
|
public function setAutoLaunch(bool $autoLaunch): self |
|
607
|
|
|
{ |
|
608
|
|
|
$this->autoLaunch = $autoLaunch; |
|
609
|
|
|
|
|
610
|
|
|
return $this; |
|
611
|
|
|
} |
|
612
|
|
|
|
|
613
|
|
|
public function getPageResultConfiguration(): array |
|
614
|
|
|
{ |
|
615
|
|
|
return $this->pageResultConfiguration; |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
public function setPageResultConfiguration(array $pageResultConfiguration): self |
|
619
|
|
|
{ |
|
620
|
|
|
$this->pageResultConfiguration = $pageResultConfiguration; |
|
621
|
|
|
|
|
622
|
|
|
return $this; |
|
623
|
|
|
} |
|
624
|
|
|
|
|
625
|
|
|
public function getDisplayChartDegreeCertainty(): int |
|
626
|
|
|
{ |
|
627
|
|
|
return $this->displayChartDegreeCertainty; |
|
628
|
|
|
} |
|
629
|
|
|
|
|
630
|
|
|
public function setDisplayChartDegreeCertainty(int $displayChartDegreeCertainty): self |
|
631
|
|
|
{ |
|
632
|
|
|
$this->displayChartDegreeCertainty = $displayChartDegreeCertainty; |
|
633
|
|
|
|
|
634
|
|
|
return $this; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
public function getSendEmailChartDegreeCertainty(): int |
|
638
|
|
|
{ |
|
639
|
|
|
return $this->sendEmailChartDegreeCertainty; |
|
640
|
|
|
} |
|
641
|
|
|
|
|
642
|
|
|
public function setSendEmailChartDegreeCertainty(int $sendEmailChartDegreeCertainty): self |
|
643
|
|
|
{ |
|
644
|
|
|
$this->sendEmailChartDegreeCertainty = $sendEmailChartDegreeCertainty; |
|
645
|
|
|
|
|
646
|
|
|
return $this; |
|
647
|
|
|
} |
|
648
|
|
|
|
|
649
|
|
|
public function getNotDisplayBalancePercentageCategorieQuestion(): int |
|
650
|
|
|
{ |
|
651
|
|
|
return $this->notDisplayBalancePercentageCategorieQuestion; |
|
652
|
|
|
} |
|
653
|
|
|
|
|
654
|
|
|
public function setNotDisplayBalancePercentageCategorieQuestion(int $notDisplayBalancePercentageCategorieQuestion): self |
|
655
|
|
|
{ |
|
656
|
|
|
$this->notDisplayBalancePercentageCategorieQuestion = $notDisplayBalancePercentageCategorieQuestion; |
|
657
|
|
|
|
|
658
|
|
|
return $this; |
|
659
|
|
|
} |
|
660
|
|
|
|
|
661
|
|
|
public function getDisplayChartDegreeCertaintyCategory(): int |
|
662
|
|
|
{ |
|
663
|
|
|
return $this->displayChartDegreeCertaintyCategory; |
|
664
|
|
|
} |
|
665
|
|
|
|
|
666
|
|
|
public function setDisplayChartDegreeCertaintyCategory(int $displayChartDegreeCertaintyCategory): self |
|
667
|
|
|
{ |
|
668
|
|
|
$this->displayChartDegreeCertaintyCategory = $displayChartDegreeCertaintyCategory; |
|
669
|
|
|
|
|
670
|
|
|
return $this; |
|
671
|
|
|
} |
|
672
|
|
|
|
|
673
|
|
|
public function getGatherQuestionsCategories(): int |
|
674
|
|
|
{ |
|
675
|
|
|
return $this->gatherQuestionsCategories; |
|
676
|
|
|
} |
|
677
|
|
|
|
|
678
|
|
|
public function setGatherQuestionsCategories(int $gatherQuestionsCategories): self |
|
679
|
|
|
{ |
|
680
|
|
|
$this->gatherQuestionsCategories = $gatherQuestionsCategories; |
|
681
|
|
|
|
|
682
|
|
|
return $this; |
|
683
|
|
|
} |
|
684
|
|
|
|
|
685
|
|
|
/** |
|
686
|
|
|
* Returns the sum of question's ponderation. |
|
687
|
|
|
*/ |
|
688
|
|
|
public function getMaxScore(): int |
|
689
|
|
|
{ |
|
690
|
|
|
$maxScore = 0; |
|
691
|
|
|
foreach ($this->questions as $relQuestion) { |
|
692
|
|
|
$maxScore += $relQuestion->getQuestion()->getPonderation(); |
|
693
|
|
|
} |
|
694
|
|
|
|
|
695
|
|
|
return $maxScore; |
|
696
|
|
|
} |
|
697
|
|
|
|
|
698
|
|
|
public function getAutoLaunch(): ?bool |
|
699
|
|
|
{ |
|
700
|
|
|
return $this->autoLaunch; |
|
701
|
|
|
} |
|
702
|
|
|
|
|
703
|
|
|
public function getHideQuestionNumber(): ?int |
|
704
|
|
|
{ |
|
705
|
|
|
return $this->hideQuestionNumber; |
|
706
|
|
|
} |
|
707
|
|
|
|
|
708
|
|
|
public function setHideQuestionNumber(int $hideQuestionNumber): self |
|
709
|
|
|
{ |
|
710
|
|
|
$this->hideQuestionNumber = $hideQuestionNumber; |
|
711
|
|
|
|
|
712
|
|
|
return $this; |
|
713
|
|
|
} |
|
714
|
|
|
|
|
715
|
|
|
public function isHideAttemptsTable(): bool |
|
716
|
|
|
{ |
|
717
|
|
|
return $this->hideAttemptsTable; |
|
718
|
|
|
} |
|
719
|
|
|
|
|
720
|
|
|
public function setHideAttemptsTable(bool $hideAttemptsTable): self |
|
721
|
|
|
{ |
|
722
|
|
|
$this->hideAttemptsTable = $hideAttemptsTable; |
|
723
|
|
|
|
|
724
|
|
|
return $this; |
|
725
|
|
|
} |
|
726
|
|
|
|
|
727
|
|
|
/** |
|
728
|
|
|
* @return Collection<int, CQuizRelQuestionCategory> |
|
729
|
|
|
*/ |
|
730
|
|
|
public function getQuestionsCategories(): Collection |
|
731
|
|
|
{ |
|
732
|
|
|
return $this->questionsCategories instanceof ArrayCollection ? |
|
733
|
|
|
$this->questionsCategories : |
|
734
|
|
|
new ArrayCollection($this->questionsCategories->toArray()); |
|
735
|
|
|
} |
|
736
|
|
|
|
|
737
|
|
|
public function getDuration(): ?int |
|
738
|
|
|
{ |
|
739
|
|
|
return $this->duration; |
|
740
|
|
|
} |
|
741
|
|
|
|
|
742
|
|
|
public function setDuration(?int $duration): self |
|
743
|
|
|
{ |
|
744
|
|
|
$this->duration = $duration; |
|
745
|
|
|
|
|
746
|
|
|
return $this; |
|
747
|
|
|
} |
|
748
|
|
|
|
|
749
|
|
|
public function getResourceIdentifier(): int|Uuid |
|
750
|
|
|
{ |
|
751
|
|
|
return $this->getIid(); |
|
|
|
|
|
|
752
|
|
|
} |
|
753
|
|
|
|
|
754
|
|
|
public function getResourceName(): string |
|
755
|
|
|
{ |
|
756
|
|
|
return $this->getTitle(); |
|
757
|
|
|
} |
|
758
|
|
|
|
|
759
|
|
|
public function setResourceName(string $name): self |
|
760
|
|
|
{ |
|
761
|
|
|
return $this->setTitle($name); |
|
762
|
|
|
} |
|
763
|
|
|
|
|
764
|
|
|
/** |
|
765
|
|
|
* @return Collection<int, TrackEExercise> |
|
766
|
|
|
*/ |
|
767
|
|
|
public function getAttempts(): Collection |
|
768
|
|
|
{ |
|
769
|
|
|
return $this->attempts; |
|
770
|
|
|
} |
|
771
|
|
|
} |
|
772
|
|
|
|