Completed
Push — master ( 76b5db...d28136 )
by Julito
13:35
created

CQuizQuestion::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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