Passed
Push — master ( 4c4023...2b0e92 )
by Julito
07:08
created

CSurvey::getCId()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 DateTime;
12
use Doctrine\Common\Collections\ArrayCollection;
13
use Doctrine\Common\Collections\Collection;
14
use Doctrine\ORM\Mapping as ORM;
15
use Symfony\Component\Validator\Constraints as Assert;
16
17
/**
18
 * CSurvey.
19
 *
20
 * @ORM\Table(
21
 *     name="c_survey",
22
 *     indexes={
23
 *         @ORM\Index(name="idx_survey_code", columns={"code"})
24
 *     }
25
 * )
26
 * @ORM\Entity
27
 */
28
class CSurvey extends AbstractResource implements ResourceInterface
29
{
30
    /**
31
     * @ORM\Column(name="iid", type="integer")
32
     * @ORM\Id
33
     * @ORM\GeneratedValue
34
     */
35
    protected int $iid;
36
37
    /**
38
     * @ORM\Column(name="code", type="string", length=20, nullable=true)
39
     */
40
    protected ?string $code = null;
41
42
    /**
43
     * @Assert\NotBlank()
44
     * @ORM\Column(name="title", type="text", nullable=false)
45
     */
46
    protected string $title;
47
48
    /**
49
     * @ORM\Column(name="subtitle", type="text", nullable=true)
50
     */
51
    protected ?string $subtitle;
52
53
    /**
54
     * @ORM\Column(name="author", type="string", length=20, nullable=true)
55
     */
56
    protected ?string $author;
57
58
    /**
59
     * @ORM\Column(name="lang", type="string", length=20, nullable=true)
60
     */
61
    protected ?string $lang;
62
63
    /**
64
     * @ORM\Column(name="avail_from", type="datetime", nullable=true)
65
     */
66
    protected ?DateTime $availFrom = null;
67
68
    /**
69
     * @ORM\Column(name="avail_till", type="datetime", nullable=true)
70
     */
71
    protected ?DateTime $availTill = null;
72
73
    /**
74
     * @ORM\Column(name="is_shared", type="string", length=1, nullable=true)
75
     */
76
    protected ?string $isShared = null;
77
78
    /**
79
     * @ORM\Column(name="template", type="string", length=20, nullable=true)
80
     */
81
    protected ?string $template = null;
82
83
    /**
84
     * @ORM\Column(name="intro", type="text", nullable=true)
85
     */
86
    protected ?string $intro = null;
87
88
    /**
89
     * @ORM\Column(name="surveythanks", type="text", nullable=true)
90
     */
91
    protected ?string $surveyThanks = null;
92
93
    /**
94
     * @ORM\Column(name="creation_date", type="datetime", nullable=false)
95
     */
96
    protected DateTime $creationDate;
97
98
    /**
99
     * @ORM\Column(name="invited", type="integer", nullable=false)
100
     */
101
    protected int $invited;
102
103
    /**
104
     * @ORM\Column(name="answered", type="integer", nullable=false)
105
     */
106
    protected int $answered;
107
108
    /**
109
     * @ORM\Column(name="invite_mail", type="text", nullable=false)
110
     */
111
    protected string $inviteMail;
112
113
    /**
114
     * @ORM\Column(name="reminder_mail", type="text", nullable=false)
115
     */
116
    protected string $reminderMail;
117
118
    /**
119
     * @ORM\Column(name="mail_subject", type="string", length=255, nullable=false)
120
     */
121
    protected string $mailSubject;
122
123
    /**
124
     * @ORM\Column(name="anonymous", type="string", length=10, nullable=false)
125
     */
126
    protected string $anonymous;
127
128
    /**
129
     * @ORM\Column(name="access_condition", type="text", nullable=true)
130
     */
131
    protected ?string $accessCondition = null;
132
133
    /**
134
     * @ORM\Column(name="shuffle", type="boolean", nullable=false)
135
     */
136
    protected bool $shuffle;
137
138
    /**
139
     * @ORM\Column(name="one_question_per_page", type="boolean", nullable=false)
140
     */
141
    protected bool $oneQuestionPerPage;
142
143
    /**
144
     * @ORM\Column(name="survey_version", type="string", length=255, nullable=false)
145
     */
146
    protected string $surveyVersion;
147
148
    /**
149
     * @ORM\Column(name="parent_id", type="integer", nullable=false)
150
     */
151
    protected int $parentId;
152
153
    /**
154
     * @ORM\Column(name="survey_type", type="integer", nullable=false)
155
     */
156
    protected int $surveyType;
157
158
    /**
159
     * @ORM\Column(name="show_form_profile", type="integer", nullable=false)
160
     */
161
    protected int $showFormProfile;
162
163
    /**
164
     * @ORM\Column(name="form_fields", type="text", nullable=false)
165
     */
166
    protected string $formFields;
167
168
    /**
169
     * @ORM\Column(name="visible_results", type="integer", nullable=true)
170
     */
171
    protected ?int $visibleResults = null;
172
173
    /**
174
     * @ORM\Column(name="is_mandatory", type="boolean", options={"default":false})
175
     */
176
    protected bool $isMandatory = false;
177
178
    /**
179
     * @var Collection|CSurveyQuestion[]
180
     *
181
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestion", mappedBy="survey")
182
     */
183
    protected Collection $questions;
184
185
    public function __construct()
186
    {
187
        $this->creationDate = new DateTime();
188
        $this->invited = 0;
189
        $this->answered = 0;
190
        $this->subtitle = '';
191
        $this->author = '';
192
        $this->inviteMail = '';
193
        $this->lang = '';
194
        $this->reminderMail = '';
195
        $this->mailSubject = '';
196
        $this->shuffle = false;
197
        $this->oneQuestionPerPage = false;
198
        $this->surveyVersion = '';
199
        $this->parentId = 0;
200
        $this->surveyType = 0;
201
        $this->questions = new ArrayCollection();
202
    }
203
204
    public function __toString(): string
205
    {
206
        return $this->getCode();
207
    }
208
209
    public function getIid(): int
210
    {
211
        return $this->iid;
212
    }
213
214
    public function setCode(string $code): self
215
    {
216
        $this->code = $code;
217
218
        return $this;
219
    }
220
221
    /**
222
     * Get code.
223
     *
224
     * @return string
225
     */
226
    public function getCode()
227
    {
228
        return $this->code;
229
    }
230
231
    public function setTitle(string $title): self
232
    {
233
        $this->title = $title;
234
235
        return $this;
236
    }
237
238
    /**
239
     * Get title.
240
     *
241
     * @return string
242
     */
243
    public function getTitle()
244
    {
245
        return $this->title;
246
    }
247
248
    public function setSubtitle(string $subtitle): self
249
    {
250
        $this->subtitle = $subtitle;
251
252
        return $this;
253
    }
254
255
    public function getSubtitle(): ?string
256
    {
257
        return $this->subtitle;
258
    }
259
260
    public function setAuthor(string $author): self
261
    {
262
        $this->author = $author;
263
264
        return $this;
265
    }
266
267
    /**
268
     * Get author.
269
     *
270
     * @return string
271
     */
272
    public function getAuthor()
273
    {
274
        return $this->author;
275
    }
276
277
    public function setLang(string $lang): self
278
    {
279
        $this->lang = $lang;
280
281
        return $this;
282
    }
283
284
    /**
285
     * Get lang.
286
     *
287
     * @return string
288
     */
289
    public function getLang()
290
    {
291
        return $this->lang;
292
    }
293
294
    public function setAvailFrom(DateTime $availFrom): self
295
    {
296
        $this->availFrom = $availFrom;
297
298
        return $this;
299
    }
300
301
    public function getAvailFrom(): ?DateTime
302
    {
303
        return $this->availFrom;
304
    }
305
306
    public function setAvailTill(DateTime $availTill): self
307
    {
308
        $this->availTill = $availTill;
309
310
        return $this;
311
    }
312
313
    public function getAvailTill(): ?DateTime
314
    {
315
        return $this->availTill;
316
    }
317
318
    public function setIsShared(string $isShared): self
319
    {
320
        $this->isShared = $isShared;
321
322
        return $this;
323
    }
324
325
    /**
326
     * Get isShared.
327
     *
328
     * @return string
329
     */
330
    public function getIsShared()
331
    {
332
        return $this->isShared;
333
    }
334
335
    public function setTemplate(string $template): self
336
    {
337
        $this->template = $template;
338
339
        return $this;
340
    }
341
342
    /**
343
     * Get template.
344
     *
345
     * @return string
346
     */
347
    public function getTemplate()
348
    {
349
        return $this->template;
350
    }
351
352
    public function setIntro(string $intro): self
353
    {
354
        $this->intro = $intro;
355
356
        return $this;
357
    }
358
359
    /**
360
     * Get intro.
361
     *
362
     * @return string
363
     */
364
    public function getIntro()
365
    {
366
        return $this->intro;
367
    }
368
369
    public function setSurveythanks(string $surveythanks): self
370
    {
371
        $this->surveyThanks = $surveythanks;
372
373
        return $this;
374
    }
375
376
    /**
377
     * Get surveythanks.
378
     *
379
     * @return string
380
     */
381
    public function getSurveythanks()
382
    {
383
        return $this->surveyThanks;
384
    }
385
386
    public function setCreationDate(DateTime $creationDate): self
387
    {
388
        $this->creationDate = $creationDate;
389
390
        return $this;
391
    }
392
393
    /**
394
     * Get creationDate.
395
     *
396
     * @return DateTime
397
     */
398
    public function getCreationDate()
399
    {
400
        return $this->creationDate;
401
    }
402
403
    public function setInvited(int $invited): self
404
    {
405
        $this->invited = $invited;
406
407
        return $this;
408
    }
409
410
    /**
411
     * Get invited.
412
     *
413
     * @return int
414
     */
415
    public function getInvited()
416
    {
417
        return $this->invited;
418
    }
419
420
    public function setAnswered(int $answered): self
421
    {
422
        $this->answered = $answered;
423
424
        return $this;
425
    }
426
427
    /**
428
     * Get answered.
429
     *
430
     * @return int
431
     */
432
    public function getAnswered()
433
    {
434
        return $this->answered;
435
    }
436
437
    public function setInviteMail(string $inviteMail): self
438
    {
439
        $this->inviteMail = $inviteMail;
440
441
        return $this;
442
    }
443
444
    /**
445
     * Get inviteMail.
446
     *
447
     * @return string
448
     */
449
    public function getInviteMail()
450
    {
451
        return $this->inviteMail;
452
    }
453
454
    public function setReminderMail(string $reminderMail): self
455
    {
456
        $this->reminderMail = $reminderMail;
457
458
        return $this;
459
    }
460
461
    /**
462
     * Get reminderMail.
463
     *
464
     * @return string
465
     */
466
    public function getReminderMail()
467
    {
468
        return $this->reminderMail;
469
    }
470
471
    public function setMailSubject(string $mailSubject): self
472
    {
473
        $this->mailSubject = $mailSubject;
474
475
        return $this;
476
    }
477
478
    /**
479
     * Get mailSubject.
480
     *
481
     * @return string
482
     */
483
    public function getMailSubject()
484
    {
485
        return $this->mailSubject;
486
    }
487
488
    public function setAnonymous(string $anonymous): self
489
    {
490
        $this->anonymous = $anonymous;
491
492
        return $this;
493
    }
494
495
    /**
496
     * Get anonymous.
497
     *
498
     * @return string
499
     */
500
    public function getAnonymous()
501
    {
502
        return $this->anonymous;
503
    }
504
505
    public function setAccessCondition(string $accessCondition): self
506
    {
507
        $this->accessCondition = $accessCondition;
508
509
        return $this;
510
    }
511
512
    /**
513
     * Get accessCondition.
514
     *
515
     * @return string
516
     */
517
    public function getAccessCondition()
518
    {
519
        return $this->accessCondition;
520
    }
521
522
    public function setShuffle(bool $shuffle): self
523
    {
524
        $this->shuffle = $shuffle;
525
526
        return $this;
527
    }
528
529
    /**
530
     * Get shuffle.
531
     *
532
     * @return bool
533
     */
534
    public function getShuffle()
535
    {
536
        return $this->shuffle;
537
    }
538
539
    public function setOneQuestionPerPage(bool $oneQuestionPerPage): self
540
    {
541
        $this->oneQuestionPerPage = $oneQuestionPerPage;
542
543
        return $this;
544
    }
545
546
    /**
547
     * Get oneQuestionPerPage.
548
     *
549
     * @return bool
550
     */
551
    public function getOneQuestionPerPage()
552
    {
553
        return $this->oneQuestionPerPage;
554
    }
555
556
    public function setSurveyVersion(string $surveyVersion): self
557
    {
558
        $this->surveyVersion = $surveyVersion;
559
560
        return $this;
561
    }
562
563
    /**
564
     * Get surveyVersion.
565
     *
566
     * @return string
567
     */
568
    public function getSurveyVersion()
569
    {
570
        return $this->surveyVersion;
571
    }
572
573
    public function setParentId(int $parentId): self
574
    {
575
        $this->parentId = $parentId;
576
577
        return $this;
578
    }
579
580
    /**
581
     * Get parentId.
582
     *
583
     * @return int
584
     */
585
    public function getParentId()
586
    {
587
        return $this->parentId;
588
    }
589
590
    public function setSurveyType(int $surveyType): self
591
    {
592
        $this->surveyType = $surveyType;
593
594
        return $this;
595
    }
596
597
    /**
598
     * Get surveyType.
599
     *
600
     * @return int
601
     */
602
    public function getSurveyType()
603
    {
604
        return $this->surveyType;
605
    }
606
607
    public function setShowFormProfile(int $showFormProfile): self
608
    {
609
        $this->showFormProfile = $showFormProfile;
610
611
        return $this;
612
    }
613
614
    /**
615
     * Get showFormProfile.
616
     *
617
     * @return int
618
     */
619
    public function getShowFormProfile()
620
    {
621
        return $this->showFormProfile;
622
    }
623
624
    public function setFormFields(string $formFields): self
625
    {
626
        $this->formFields = $formFields;
627
628
        return $this;
629
    }
630
631
    /**
632
     * Get formFields.
633
     *
634
     * @return string
635
     */
636
    public function getFormFields()
637
    {
638
        return $this->formFields;
639
    }
640
641
    public function setVisibleResults(int $visibleResults): self
642
    {
643
        $this->visibleResults = $visibleResults;
644
645
        return $this;
646
    }
647
648
    /**
649
     * Get visibleResults.
650
     *
651
     * @return int
652
     */
653
    public function getVisibleResults()
654
    {
655
        return $this->visibleResults;
656
    }
657
658
    public function setIsMandatory(bool $isMandatory): self
659
    {
660
        $this->isMandatory = $isMandatory;
661
662
        return $this;
663
    }
664
665
    public function isMandatory(): bool
666
    {
667
        return $this->isMandatory;
668
    }
669
670
    public function getQuestions(): Collection
671
    {
672
        return $this->questions;
673
    }
674
675
    public function setQuestions(Collection $questions): self
676
    {
677
        $this->questions = $questions;
678
679
        return $this;
680
    }
681
682
    public function getResourceIdentifier(): int
683
    {
684
        return $this->getIid();
685
    }
686
687
    public function getResourceName(): string
688
    {
689
        return $this->getCode();
690
    }
691
692
    public function setResourceName(string $name): self
693
    {
694
        return $this->setCode($name);
695
    }
696
}
697