Completed
Push — master ( ac9b94...2050b8 )
by Julito
11:32
created

CSurvey::getLang()   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
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\AbstractResource;
8
use Chamilo\CoreBundle\Entity\ResourceInterface;
9
use Doctrine\ORM\Mapping as ORM;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
/**
13
 * CSurvey.
14
 *
15
 * @ORM\Table(
16
 *  name="c_survey",
17
 *  indexes={
18
 *     @ORM\Index(name="course", columns={"c_id"}),
19
 *     @ORM\Index(name="session_id", columns={"session_id"}),
20
 *     @ORM\Index(name="idx_survey_code", columns={"code"})
21
 *  }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CSurvey extends AbstractResource implements ResourceInterface
26
{
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(name="iid", type="integer")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     */
34
    protected $iid;
35
36
    /**
37
     * @var int
38
     *
39
     * @ORM\Column(name="c_id", type="integer")
40
     */
41
    protected $cId;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(name="code", type="string", length=20, nullable=true)
47
     */
48
    protected $code;
49
50
    /**
51
     * @var string
52
     * @Assert\NotBlank()
53
     * @ORM\Column(name="title", type="text", nullable=true)
54
     */
55
    protected $title;
56
57
    /**
58
     * @var string
59
     *
60
     * @ORM\Column(name="subtitle", type="text", nullable=true)
61
     */
62
    protected $subtitle;
63
64
    /**
65
     * @var string
66
     *
67
     * @ORM\Column(name="author", type="string", length=20, nullable=true)
68
     */
69
    protected $author;
70
71
    /**
72
     * @var string
73
     *
74
     * @ORM\Column(name="lang", type="string", length=20, nullable=true)
75
     */
76
    protected $lang;
77
78
    /**
79
     * @var \DateTime
80
     *
81
     * @ORM\Column(name="avail_from", type="datetime", nullable=true)
82
     */
83
    protected $availFrom;
84
85
    /**
86
     * @var \DateTime
87
     *
88
     * @ORM\Column(name="avail_till", type="datetime", nullable=true)
89
     */
90
    protected $availTill;
91
92
    /**
93
     * @var string
94
     *
95
     * @ORM\Column(name="is_shared", type="string", length=1, nullable=true)
96
     */
97
    protected $isShared;
98
99
    /**
100
     * @var string
101
     *
102
     * @ORM\Column(name="template", type="string", length=20, nullable=true)
103
     */
104
    protected $template;
105
106
    /**
107
     * @var string
108
     *
109
     * @ORM\Column(name="intro", type="text", nullable=true)
110
     */
111
    protected $intro;
112
113
    /**
114
     * @var string
115
     *
116
     * @ORM\Column(name="surveythanks", type="text", nullable=true)
117
     */
118
    protected $surveyThanks;
119
120
    /**
121
     * @var \DateTime
122
     *
123
     * @ORM\Column(name="creation_date", type="datetime", nullable=false)
124
     */
125
    protected $creationDate;
126
127
    /**
128
     * @var int
129
     *
130
     * @ORM\Column(name="invited", type="integer", nullable=false)
131
     */
132
    protected $invited;
133
134
    /**
135
     * @var int
136
     *
137
     * @ORM\Column(name="answered", type="integer", nullable=false)
138
     */
139
    protected $answered;
140
141
    /**
142
     * @var string
143
     *
144
     * @ORM\Column(name="invite_mail", type="text", nullable=false)
145
     */
146
    protected $inviteMail;
147
148
    /**
149
     * @var string
150
     *
151
     * @ORM\Column(name="reminder_mail", type="text", nullable=false)
152
     */
153
    protected $reminderMail;
154
155
    /**
156
     * @var string
157
     *
158
     * @ORM\Column(name="mail_subject", type="string", length=255, nullable=false)
159
     */
160
    protected $mailSubject;
161
162
    /**
163
     * @var string
164
     *
165
     * @ORM\Column(name="anonymous", type="string", length=10, nullable=false)
166
     */
167
    protected $anonymous;
168
169
    /**
170
     * @var string
171
     *
172
     * @ORM\Column(name="access_condition", type="text", nullable=true)
173
     */
174
    protected $accessCondition;
175
176
    /**
177
     * @var bool
178
     *
179
     * @ORM\Column(name="shuffle", type="boolean", nullable=false)
180
     */
181
    protected $shuffle;
182
183
    /**
184
     * @var bool
185
     *
186
     * @ORM\Column(name="one_question_per_page", type="boolean", nullable=false)
187
     */
188
    protected $oneQuestionPerPage;
189
190
    /**
191
     * @var string
192
     *
193
     * @ORM\Column(name="survey_version", type="string", length=255, nullable=false)
194
     */
195
    protected $surveyVersion;
196
197
    /**
198
     * @var int
199
     *
200
     * @ORM\Column(name="parent_id", type="integer", nullable=false)
201
     */
202
    protected $parentId;
203
204
    /**
205
     * @var int
206
     *
207
     * @ORM\Column(name="survey_type", type="integer", nullable=false)
208
     */
209
    protected $surveyType;
210
211
    /**
212
     * @var int
213
     *
214
     * @ORM\Column(name="show_form_profile", type="integer", nullable=false)
215
     */
216
    protected $showFormProfile;
217
218
    /**
219
     * @var string
220
     *
221
     * @ORM\Column(name="form_fields", type="text", nullable=false)
222
     */
223
    protected $formFields;
224
225
    /**
226
     * @var int
227
     *
228
     * @ORM\Column(name="session_id", type="integer", nullable=false)
229
     */
230
    protected $sessionId;
231
232
    /**
233
     * @var int
234
     *
235
     * @ORM\Column(name="visible_results", type="integer", nullable=true)
236
     */
237
    protected $visibleResults;
238
239
    /**
240
     * @var bool
241
     *
242
     * @ORM\Column(name="is_mandatory", type="boolean", options={"default":false})
243
     */
244
    protected $isMandatory = false;
245
246
    /**
247
     * CSurvey constructor.
248
     */
249
    public function __construct()
250
    {
251
        $this->creationDate = new \DateTime();
252
        $this->invited = 0;
253
        $this->answered = 0;
254
        $this->surveyId = 0;
255
        $this->inviteMail = '';
256
        $this->reminderMail = '';
257
        $this->mailSubject = '';
258
        $this->shuffle = 0;
0 ignored issues
show
Documentation Bug introduced by
The property $shuffle was declared of type boolean, but 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
259
        $this->oneQuestionPerPage = 0;
0 ignored issues
show
Documentation Bug introduced by
The property $oneQuestionPerPage was declared of type boolean, but 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
260
        $this->surveyVersion = '';
261
        $this->parentId = 0;
262
        $this->surveyType = 0;
263
    }
264
265
    public function getIid(): int
266
    {
267
        return $this->iid;
268
    }
269
270
    public function setIid(int $iid): self
271
    {
272
        $this->iid = $iid;
273
274
        return $this;
275
    }
276
277
    /**
278
     * Set code.
279
     *
280
     * @param string $code
281
     *
282
     * @return CSurvey
283
     */
284
    public function setCode($code)
285
    {
286
        $this->code = $code;
287
288
        return $this;
289
    }
290
291
    /**
292
     * Get code.
293
     *
294
     * @return string
295
     */
296
    public function getCode()
297
    {
298
        return $this->code;
299
    }
300
301
    /**
302
     * Set title.
303
     *
304
     * @param string $title
305
     *
306
     * @return CSurvey
307
     */
308
    public function setTitle($title)
309
    {
310
        $this->title = $title;
311
312
        return $this;
313
    }
314
315
    /**
316
     * Get title.
317
     *
318
     * @return string
319
     */
320
    public function getTitle()
321
    {
322
        return $this->title;
323
    }
324
325
    /**
326
     * Set subtitle.
327
     *
328
     * @param string $subtitle
329
     *
330
     * @return CSurvey
331
     */
332
    public function setSubtitle($subtitle)
333
    {
334
        $this->subtitle = $subtitle;
335
336
        return $this;
337
    }
338
339
    /**
340
     * Get subtitle.
341
     *
342
     * @return string
343
     */
344
    public function getSubtitle()
345
    {
346
        return $this->subtitle;
347
    }
348
349
    /**
350
     * Set author.
351
     *
352
     * @param string $author
353
     *
354
     * @return CSurvey
355
     */
356
    public function setAuthor($author)
357
    {
358
        $this->author = $author;
359
360
        return $this;
361
    }
362
363
    /**
364
     * Get author.
365
     *
366
     * @return string
367
     */
368
    public function getAuthor()
369
    {
370
        return $this->author;
371
    }
372
373
    /**
374
     * Set lang.
375
     *
376
     * @param string $lang
377
     *
378
     * @return CSurvey
379
     */
380
    public function setLang($lang)
381
    {
382
        $this->lang = $lang;
383
384
        return $this;
385
    }
386
387
    /**
388
     * Get lang.
389
     *
390
     * @return string
391
     */
392
    public function getLang()
393
    {
394
        return $this->lang;
395
    }
396
397
    /**
398
     * Set availFrom.
399
     *
400
     * @param \DateTime $availFrom
401
     *
402
     * @return CSurvey
403
     */
404
    public function setAvailFrom($availFrom)
405
    {
406
        $this->availFrom = $availFrom;
407
408
        return $this;
409
    }
410
411
    /**
412
     * Get availFrom.
413
     *
414
     * @return \DateTime
415
     */
416
    public function getAvailFrom()
417
    {
418
        return $this->availFrom;
419
    }
420
421
    /**
422
     * Set availTill.
423
     *
424
     * @param \DateTime $availTill
425
     *
426
     * @return CSurvey
427
     */
428
    public function setAvailTill($availTill)
429
    {
430
        $this->availTill = $availTill;
431
432
        return $this;
433
    }
434
435
    /**
436
     * Get availTill.
437
     *
438
     * @return \DateTime
439
     */
440
    public function getAvailTill()
441
    {
442
        return $this->availTill;
443
    }
444
445
    /**
446
     * Set isShared.
447
     *
448
     * @param string $isShared
449
     *
450
     * @return CSurvey
451
     */
452
    public function setIsShared($isShared)
453
    {
454
        $this->isShared = $isShared;
455
456
        return $this;
457
    }
458
459
    /**
460
     * Get isShared.
461
     *
462
     * @return string
463
     */
464
    public function getIsShared()
465
    {
466
        return $this->isShared;
467
    }
468
469
    /**
470
     * Set template.
471
     *
472
     * @param string $template
473
     *
474
     * @return CSurvey
475
     */
476
    public function setTemplate($template)
477
    {
478
        $this->template = $template;
479
480
        return $this;
481
    }
482
483
    /**
484
     * Get template.
485
     *
486
     * @return string
487
     */
488
    public function getTemplate()
489
    {
490
        return $this->template;
491
    }
492
493
    /**
494
     * Set intro.
495
     *
496
     * @param string $intro
497
     *
498
     * @return CSurvey
499
     */
500
    public function setIntro($intro)
501
    {
502
        $this->intro = $intro;
503
504
        return $this;
505
    }
506
507
    /**
508
     * Get intro.
509
     *
510
     * @return string
511
     */
512
    public function getIntro()
513
    {
514
        return $this->intro;
515
    }
516
517
    /**
518
     * Set surveythanks.
519
     *
520
     * @param string $surveythanks
521
     *
522
     * @return CSurvey
523
     */
524
    public function setSurveythanks($surveythanks)
525
    {
526
        $this->surveyThanks = $surveythanks;
527
528
        return $this;
529
    }
530
531
    /**
532
     * Get surveythanks.
533
     *
534
     * @return string
535
     */
536
    public function getSurveythanks()
537
    {
538
        return $this->surveyThanks;
539
    }
540
541
    /**
542
     * Set creationDate.
543
     *
544
     * @param \DateTime $creationDate
545
     *
546
     * @return CSurvey
547
     */
548
    public function setCreationDate($creationDate)
549
    {
550
        $this->creationDate = $creationDate;
551
552
        return $this;
553
    }
554
555
    /**
556
     * Get creationDate.
557
     *
558
     * @return \DateTime
559
     */
560
    public function getCreationDate()
561
    {
562
        return $this->creationDate;
563
    }
564
565
    /**
566
     * Set invited.
567
     *
568
     * @param int $invited
569
     *
570
     * @return CSurvey
571
     */
572
    public function setInvited($invited)
573
    {
574
        $this->invited = $invited;
575
576
        return $this;
577
    }
578
579
    /**
580
     * Get invited.
581
     *
582
     * @return int
583
     */
584
    public function getInvited()
585
    {
586
        return $this->invited;
587
    }
588
589
    /**
590
     * Set answered.
591
     *
592
     * @param int $answered
593
     *
594
     * @return CSurvey
595
     */
596
    public function setAnswered($answered)
597
    {
598
        $this->answered = $answered;
599
600
        return $this;
601
    }
602
603
    /**
604
     * Get answered.
605
     *
606
     * @return int
607
     */
608
    public function getAnswered()
609
    {
610
        return $this->answered;
611
    }
612
613
    /**
614
     * Set inviteMail.
615
     *
616
     * @param string $inviteMail
617
     *
618
     * @return CSurvey
619
     */
620
    public function setInviteMail($inviteMail)
621
    {
622
        $this->inviteMail = $inviteMail;
623
624
        return $this;
625
    }
626
627
    /**
628
     * Get inviteMail.
629
     *
630
     * @return string
631
     */
632
    public function getInviteMail()
633
    {
634
        return $this->inviteMail;
635
    }
636
637
    /**
638
     * Set reminderMail.
639
     *
640
     * @param string $reminderMail
641
     *
642
     * @return CSurvey
643
     */
644
    public function setReminderMail($reminderMail)
645
    {
646
        $this->reminderMail = $reminderMail;
647
648
        return $this;
649
    }
650
651
    /**
652
     * Get reminderMail.
653
     *
654
     * @return string
655
     */
656
    public function getReminderMail()
657
    {
658
        return $this->reminderMail;
659
    }
660
661
    /**
662
     * Set mailSubject.
663
     *
664
     * @param string $mailSubject
665
     *
666
     * @return CSurvey
667
     */
668
    public function setMailSubject($mailSubject)
669
    {
670
        $this->mailSubject = $mailSubject;
671
672
        return $this;
673
    }
674
675
    /**
676
     * Get mailSubject.
677
     *
678
     * @return string
679
     */
680
    public function getMailSubject()
681
    {
682
        return $this->mailSubject;
683
    }
684
685
    /**
686
     * Set anonymous.
687
     *
688
     * @param string $anonymous
689
     *
690
     * @return CSurvey
691
     */
692
    public function setAnonymous($anonymous)
693
    {
694
        $this->anonymous = $anonymous;
695
696
        return $this;
697
    }
698
699
    /**
700
     * Get anonymous.
701
     *
702
     * @return string
703
     */
704
    public function getAnonymous()
705
    {
706
        return $this->anonymous;
707
    }
708
709
    /**
710
     * Set accessCondition.
711
     *
712
     * @param string $accessCondition
713
     *
714
     * @return CSurvey
715
     */
716
    public function setAccessCondition($accessCondition)
717
    {
718
        $this->accessCondition = $accessCondition;
719
720
        return $this;
721
    }
722
723
    /**
724
     * Get accessCondition.
725
     *
726
     * @return string
727
     */
728
    public function getAccessCondition()
729
    {
730
        return $this->accessCondition;
731
    }
732
733
    /**
734
     * Set shuffle.
735
     *
736
     * @param bool $shuffle
737
     *
738
     * @return CSurvey
739
     */
740
    public function setShuffle($shuffle)
741
    {
742
        $this->shuffle = $shuffle;
743
744
        return $this;
745
    }
746
747
    /**
748
     * Get shuffle.
749
     *
750
     * @return bool
751
     */
752
    public function getShuffle()
753
    {
754
        return $this->shuffle;
755
    }
756
757
    /**
758
     * Set oneQuestionPerPage.
759
     *
760
     * @param bool $oneQuestionPerPage
761
     *
762
     * @return CSurvey
763
     */
764
    public function setOneQuestionPerPage($oneQuestionPerPage)
765
    {
766
        $this->oneQuestionPerPage = $oneQuestionPerPage;
767
768
        return $this;
769
    }
770
771
    /**
772
     * Get oneQuestionPerPage.
773
     *
774
     * @return bool
775
     */
776
    public function getOneQuestionPerPage()
777
    {
778
        return $this->oneQuestionPerPage;
779
    }
780
781
    /**
782
     * Set surveyVersion.
783
     *
784
     * @param string $surveyVersion
785
     *
786
     * @return CSurvey
787
     */
788
    public function setSurveyVersion($surveyVersion)
789
    {
790
        $this->surveyVersion = $surveyVersion;
791
792
        return $this;
793
    }
794
795
    /**
796
     * Get surveyVersion.
797
     *
798
     * @return string
799
     */
800
    public function getSurveyVersion()
801
    {
802
        return $this->surveyVersion;
803
    }
804
805
    /**
806
     * Set parentId.
807
     *
808
     * @param int $parentId
809
     *
810
     * @return CSurvey
811
     */
812
    public function setParentId($parentId)
813
    {
814
        $this->parentId = $parentId;
815
816
        return $this;
817
    }
818
819
    /**
820
     * Get parentId.
821
     *
822
     * @return int
823
     */
824
    public function getParentId()
825
    {
826
        return $this->parentId;
827
    }
828
829
    /**
830
     * Set surveyType.
831
     *
832
     * @param int $surveyType
833
     *
834
     * @return CSurvey
835
     */
836
    public function setSurveyType($surveyType)
837
    {
838
        $this->surveyType = $surveyType;
839
840
        return $this;
841
    }
842
843
    /**
844
     * Get surveyType.
845
     *
846
     * @return int
847
     */
848
    public function getSurveyType()
849
    {
850
        return $this->surveyType;
851
    }
852
853
    /**
854
     * Set showFormProfile.
855
     *
856
     * @param int $showFormProfile
857
     *
858
     * @return CSurvey
859
     */
860
    public function setShowFormProfile($showFormProfile)
861
    {
862
        $this->showFormProfile = $showFormProfile;
863
864
        return $this;
865
    }
866
867
    /**
868
     * Get showFormProfile.
869
     *
870
     * @return int
871
     */
872
    public function getShowFormProfile()
873
    {
874
        return $this->showFormProfile;
875
    }
876
877
    /**
878
     * Set formFields.
879
     *
880
     * @param string $formFields
881
     *
882
     * @return CSurvey
883
     */
884
    public function setFormFields($formFields)
885
    {
886
        $this->formFields = $formFields;
887
888
        return $this;
889
    }
890
891
    /**
892
     * Get formFields.
893
     *
894
     * @return string
895
     */
896
    public function getFormFields()
897
    {
898
        return $this->formFields;
899
    }
900
901
    /**
902
     * Set sessionId.
903
     *
904
     * @param int $sessionId
905
     *
906
     * @return CSurvey
907
     */
908
    public function setSessionId($sessionId)
909
    {
910
        $this->sessionId = $sessionId;
911
912
        return $this;
913
    }
914
915
    /**
916
     * Get sessionId.
917
     *
918
     * @return int
919
     */
920
    public function getSessionId()
921
    {
922
        return $this->sessionId;
923
    }
924
925
    /**
926
     * Set visibleResults.
927
     *
928
     * @param int $visibleResults
929
     *
930
     * @return CSurvey
931
     */
932
    public function setVisibleResults($visibleResults)
933
    {
934
        $this->visibleResults = $visibleResults;
935
936
        return $this;
937
    }
938
939
    /**
940
     * Get visibleResults.
941
     *
942
     * @return int
943
     */
944
    public function getVisibleResults()
945
    {
946
        return $this->visibleResults;
947
    }
948
949
    /**
950
     * Set cId.
951
     *
952
     * @param int $cId
953
     *
954
     * @return CSurvey
955
     */
956
    public function setCId($cId)
957
    {
958
        $this->cId = $cId;
959
960
        return $this;
961
    }
962
963
    /**
964
     * Get cId.
965
     *
966
     * @return int
967
     */
968
    public function getCId()
969
    {
970
        return $this->cId;
971
    }
972
973
    /**
974
     * @param bool $isMandatory
975
     *
976
     * @return CSurvey
977
     */
978
    public function setIsMandatory($isMandatory)
979
    {
980
        $this->isMandatory = $isMandatory;
981
982
        return $this;
983
    }
984
985
    /**
986
     * @return bool
987
     */
988
    public function isMandatory()
989
    {
990
        return $this->isMandatory;
991
    }
992
993
    public function __toString(): string
994
    {
995
        return $this->getCode();
996
    }
997
998
    public function getResourceIdentifier(): int
999
    {
1000
        return $this->getIid();
1001
    }
1002
1003
    public function getResourceName(): string
1004
    {
1005
        return $this->getCode();
1006
    }
1007
1008
    public function setResourceName(string $name): self
1009
    {
1010
        return $this->setCode($name);
1011
    }
1012
}
1013