Passed
Push — master ( 891151...7b6b24 )
by Julito
12:45
created

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