1
|
|
|
<?php |
2
|
|
|
/* For licensing terms, see /license.txt */ |
3
|
|
|
|
4
|
|
|
namespace Chamilo\CourseBundle\Entity; |
5
|
|
|
|
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* CQuizAnswer. |
10
|
|
|
* |
11
|
|
|
* @ORM\Table( |
12
|
|
|
* name="c_quiz_answer", |
13
|
|
|
* indexes={ |
14
|
|
|
* @ORM\Index(name="c_id", columns={"c_id"}), |
15
|
|
|
* @ORM\Index(name="idx_cqa_q", columns={"question_id"}) |
16
|
|
|
* } |
17
|
|
|
* ) |
18
|
|
|
* @ORM\Entity |
19
|
|
|
*/ |
20
|
|
|
class CQuizAnswer |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var int |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(name="iid", type="integer", options={"unsigned": true}) |
26
|
|
|
* @ORM\Id |
27
|
|
|
* @ORM\GeneratedValue |
28
|
|
|
*/ |
29
|
|
|
protected $iid; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var int |
33
|
|
|
* |
34
|
|
|
* @ORM\Column(name="id_auto", type="integer", options={"unsigned": true, "default": null}) |
35
|
|
|
*/ |
36
|
|
|
protected $idAuto; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var int |
40
|
|
|
* |
41
|
|
|
* @ORM\Column(name="c_id", type="integer", options={"unsigned": true, "default": null}) |
42
|
|
|
*/ |
43
|
|
|
protected $cId; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var int |
47
|
|
|
* @deprecated Now using iid |
48
|
|
|
* @ORM\Column(name="id", type="integer", nullable=true) |
49
|
|
|
*/ |
50
|
|
|
protected $id; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var int |
54
|
|
|
* |
55
|
|
|
* @ORM\Column(name="question_id", type="integer", nullable=false) |
56
|
|
|
*/ |
57
|
|
|
protected $questionId; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string |
61
|
|
|
* |
62
|
|
|
* @ORM\Column(name="answer", type="text", nullable=false) |
63
|
|
|
*/ |
64
|
|
|
protected $answer; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var int |
68
|
|
|
* |
69
|
|
|
* @ORM\Column(name="correct", type="integer", nullable=true) |
70
|
|
|
*/ |
71
|
|
|
protected $correct; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var string |
75
|
|
|
* |
76
|
|
|
* @ORM\Column(name="comment", type="text", nullable=true) |
77
|
|
|
*/ |
78
|
|
|
protected $comment; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var float |
82
|
|
|
* |
83
|
|
|
* @ORM\Column(name="ponderation", type="float", precision=6, scale=2, nullable=false, options={"default": 0}) |
84
|
|
|
*/ |
85
|
|
|
protected $ponderation; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var int |
89
|
|
|
* |
90
|
|
|
* @ORM\Column(name="position", type="integer", nullable=false) |
91
|
|
|
*/ |
92
|
|
|
protected $position; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var string |
96
|
|
|
* |
97
|
|
|
* @ORM\Column(name="hotspot_coordinates", type="text", nullable=true) |
98
|
|
|
*/ |
99
|
|
|
protected $hotspotCoordinates; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var string |
103
|
|
|
* |
104
|
|
|
* @ORM\Column(name="hotspot_type", type="string", length=40, nullable=true) |
105
|
|
|
*/ |
106
|
|
|
protected $hotspotType; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var string |
110
|
|
|
* |
111
|
|
|
* @ORM\Column(name="destination", type="text", nullable=true) |
112
|
|
|
*/ |
113
|
|
|
protected $destination; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @var string |
117
|
|
|
* |
118
|
|
|
* @ORM\Column(name="answer_code", type="string", length=10, nullable=true) |
119
|
|
|
*/ |
120
|
|
|
protected $answerCode; |
121
|
|
|
|
122
|
|
|
public function __construct() |
123
|
|
|
{ |
124
|
|
|
$this->iid = null; |
125
|
|
|
$this->idAuto = 0; |
126
|
|
|
$this->correct = null; |
127
|
|
|
$this->comment = null; |
128
|
|
|
$this->ponderation = 0.0; |
129
|
|
|
$this->hotspotCoordinates = null; |
130
|
|
|
$this->hotspotType = null; |
131
|
|
|
$this->destination = null; |
132
|
|
|
$this->answerCode = null; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Set iid. |
137
|
|
|
* |
138
|
|
|
* @param int $iid |
139
|
|
|
* |
140
|
|
|
* @return CQuizAnswer |
141
|
|
|
*/ |
142
|
|
|
public function setId($iid) |
143
|
|
|
{ |
144
|
|
|
$this->iid = $iid; |
145
|
|
|
|
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Get id. |
151
|
|
|
* |
152
|
|
|
* @return int |
153
|
|
|
*/ |
154
|
|
|
public function getId() |
155
|
|
|
{ |
156
|
|
|
return $this->iid; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* Set questionId. |
161
|
|
|
* |
162
|
|
|
* @param int $questionId |
163
|
|
|
* |
164
|
|
|
* @return CQuizAnswer |
165
|
|
|
*/ |
166
|
|
|
public function setQuestionId($questionId) |
167
|
|
|
{ |
168
|
|
|
$this->questionId = $questionId; |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* Get questionId. |
175
|
|
|
* |
176
|
|
|
* @return int |
177
|
|
|
*/ |
178
|
|
|
public function getQuestionId() |
179
|
|
|
{ |
180
|
|
|
return $this->questionId; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Set answer. |
185
|
|
|
* |
186
|
|
|
* @param string $answer |
187
|
|
|
* |
188
|
|
|
* @return CQuizAnswer |
189
|
|
|
*/ |
190
|
|
|
public function setAnswer($answer) |
191
|
|
|
{ |
192
|
|
|
$this->answer = $answer; |
193
|
|
|
|
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Get answer. |
199
|
|
|
* |
200
|
|
|
* @return string |
201
|
|
|
*/ |
202
|
|
|
public function getAnswer() |
203
|
|
|
{ |
204
|
|
|
return $this->answer; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* Set correct. |
209
|
|
|
* |
210
|
|
|
* @param int $correct |
211
|
|
|
* |
212
|
|
|
* @return CQuizAnswer |
213
|
|
|
*/ |
214
|
|
|
public function setCorrect($correct) |
215
|
|
|
{ |
216
|
|
|
$this->correct = $correct; |
217
|
|
|
|
218
|
|
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Get correct. |
223
|
|
|
* |
224
|
|
|
* @return int |
225
|
|
|
*/ |
226
|
|
|
public function getCorrect() |
227
|
|
|
{ |
228
|
|
|
return $this->correct; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Set comment. |
233
|
|
|
* |
234
|
|
|
* @param string $comment |
235
|
|
|
* |
236
|
|
|
* @return CQuizAnswer |
237
|
|
|
*/ |
238
|
|
|
public function setComment($comment) |
239
|
|
|
{ |
240
|
|
|
$this->comment = $comment; |
241
|
|
|
|
242
|
|
|
return $this; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Get comment. |
247
|
|
|
* |
248
|
|
|
* @return string |
249
|
|
|
*/ |
250
|
|
|
public function getComment() |
251
|
|
|
{ |
252
|
|
|
return $this->comment; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Set weight. |
257
|
|
|
* |
258
|
|
|
* @param float $weight |
259
|
|
|
* |
260
|
|
|
* @return CQuizAnswer |
261
|
|
|
*/ |
262
|
|
|
public function setPonderation($weight) |
263
|
|
|
{ |
264
|
|
|
$this->ponderation = empty($weight) ? 0.0 : $weight; |
265
|
|
|
|
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Get weight. |
271
|
|
|
* |
272
|
|
|
* @return float |
273
|
|
|
*/ |
274
|
|
|
public function getPonderation() |
275
|
|
|
{ |
276
|
|
|
return $this->ponderation; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* Set position. |
281
|
|
|
* |
282
|
|
|
* @param int $position |
283
|
|
|
* |
284
|
|
|
* @return CQuizAnswer |
285
|
|
|
*/ |
286
|
|
|
public function setPosition($position) |
287
|
|
|
{ |
288
|
|
|
$this->position = $position; |
289
|
|
|
|
290
|
|
|
return $this; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* Get position. |
295
|
|
|
* |
296
|
|
|
* @return int |
297
|
|
|
*/ |
298
|
|
|
public function getPosition() |
299
|
|
|
{ |
300
|
|
|
return $this->position; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* Set hotspotCoordinates. |
305
|
|
|
* |
306
|
|
|
* @param string $hotspotCoordinates |
307
|
|
|
* |
308
|
|
|
* @return CQuizAnswer |
309
|
|
|
*/ |
310
|
|
|
public function setHotspotCoordinates($hotspotCoordinates) |
311
|
|
|
{ |
312
|
|
|
$this->hotspotCoordinates = $hotspotCoordinates; |
313
|
|
|
|
314
|
|
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Get hotspotCoordinates. |
319
|
|
|
* |
320
|
|
|
* @return string |
321
|
|
|
*/ |
322
|
|
|
public function getHotspotCoordinates() |
323
|
|
|
{ |
324
|
|
|
return $this->hotspotCoordinates; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* Set hotspotType. |
329
|
|
|
* |
330
|
|
|
* @param string $hotspotType |
331
|
|
|
* |
332
|
|
|
* @return CQuizAnswer |
333
|
|
|
*/ |
334
|
|
|
public function setHotspotType($hotspotType) |
335
|
|
|
{ |
336
|
|
|
$this->hotspotType = $hotspotType; |
337
|
|
|
|
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Get hotspotType. |
343
|
|
|
* |
344
|
|
|
* @return string |
345
|
|
|
*/ |
346
|
|
|
public function getHotspotType() |
347
|
|
|
{ |
348
|
|
|
return $this->hotspotType; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* Set destination. |
353
|
|
|
* |
354
|
|
|
* @param string $destination |
355
|
|
|
* |
356
|
|
|
* @return CQuizAnswer |
357
|
|
|
*/ |
358
|
|
|
public function setDestination($destination) |
359
|
|
|
{ |
360
|
|
|
$this->destination = empty($destination) ? null : $destination; |
361
|
|
|
|
362
|
|
|
return $this; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* Get destination. |
367
|
|
|
* |
368
|
|
|
* @return string |
369
|
|
|
*/ |
370
|
|
|
public function getDestination() |
371
|
|
|
{ |
372
|
|
|
return $this->destination; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Set answerCode. |
377
|
|
|
* |
378
|
|
|
* @param string $answerCode |
379
|
|
|
* |
380
|
|
|
* @return CQuizAnswer |
381
|
|
|
*/ |
382
|
|
|
public function setAnswerCode($answerCode) |
383
|
|
|
{ |
384
|
|
|
$this->answerCode = $answerCode; |
385
|
|
|
|
386
|
|
|
return $this; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* Get answerCode. |
391
|
|
|
* |
392
|
|
|
* @return string |
393
|
|
|
*/ |
394
|
|
|
public function getAnswerCode() |
395
|
|
|
{ |
396
|
|
|
return $this->answerCode; |
397
|
|
|
} |
398
|
|
|
|
399
|
|
|
/** |
400
|
|
|
* Set idAuto. |
401
|
|
|
* |
402
|
|
|
* @param int $idAuto |
403
|
|
|
* |
404
|
|
|
* @return CQuizAnswer |
405
|
|
|
*/ |
406
|
|
|
public function setIdAuto($idAuto) |
407
|
|
|
{ |
408
|
|
|
$this->idAuto = $idAuto; |
409
|
|
|
|
410
|
|
|
return $this; |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Get idAuto. |
415
|
|
|
* |
416
|
|
|
* @return int |
417
|
|
|
*/ |
418
|
|
|
public function getIdAuto() |
419
|
|
|
{ |
420
|
|
|
return $this->idAuto; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* Set cId. |
425
|
|
|
* |
426
|
|
|
* @param int $cId |
427
|
|
|
* |
428
|
|
|
* @return CQuizAnswer |
429
|
|
|
*/ |
430
|
|
|
public function setCId($cId) |
431
|
|
|
{ |
432
|
|
|
$this->cId = $cId; |
433
|
|
|
|
434
|
|
|
return $this; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Get cId. |
439
|
|
|
* |
440
|
|
|
* @return int |
441
|
|
|
*/ |
442
|
|
|
public function getCId() |
443
|
|
|
{ |
444
|
|
|
return $this->cId; |
445
|
|
|
} |
446
|
|
|
} |
447
|
|
|
|