Passed
Push — master ( b9a35c...ab20b0 )
by Julito
15:41
created

CSurvey::setResourceName()   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
nc 1
nop 1
dl 0
loc 3
rs 10
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 int
45
     *
46
     * @ORM\Column(name="survey_id", type="integer")
47
     */
48
    protected $surveyId;
49
50
    /**
51
     * @var string
52
     *
53
     * @ORM\Column(name="code", type="string", length=20, nullable=true)
54
     */
55
    protected $code;
56
57
    /**
58
     * @var string
59
     * @Assert\NotBlank()
60
     * @ORM\Column(name="title", type="text", nullable=true)
61
     */
62
    protected $title;
63
64
    /**
65
     * @var string
66
     *
67
     * @ORM\Column(name="subtitle", type="text", nullable=true)
68
     */
69
    protected $subtitle;
70
71
    /**
72
     * @var string
73
     *
74
     * @ORM\Column(name="author", type="string", length=20, nullable=true)
75
     */
76
    protected $author;
77
78
    /**
79
     * @var string
80
     *
81
     * @ORM\Column(name="lang", type="string", length=20, nullable=true)
82
     */
83
    protected $lang;
84
85
    /**
86
     * @var \DateTime
87
     *
88
     * @ORM\Column(name="avail_from", type="date", nullable=true)
89
     */
90
    protected $availFrom;
91
92
    /**
93
     * @var \DateTime
94
     *
95
     * @ORM\Column(name="avail_till", type="date", nullable=true)
96
     */
97
    protected $availTill;
98
99
    /**
100
     * @var string
101
     *
102
     * @ORM\Column(name="is_shared", type="string", length=1, nullable=true)
103
     */
104
    protected $isShared;
105
106
    /**
107
     * @var string
108
     *
109
     * @ORM\Column(name="template", type="string", length=20, nullable=true)
110
     */
111
    protected $template;
112
113
    /**
114
     * @var string
115
     *
116
     * @ORM\Column(name="intro", type="text", nullable=true)
117
     */
118
    protected $intro;
119
120
    /**
121
     * @var string
122
     *
123
     * @ORM\Column(name="surveythanks", type="text", nullable=true)
124
     */
125
    protected $surveyThanks;
126
127
    /**
128
     * @var \DateTime
129
     *
130
     * @ORM\Column(name="creation_date", type="datetime", nullable=false)
131
     */
132
    protected $creationDate;
133
134
    /**
135
     * @var int
136
     *
137
     * @ORM\Column(name="invited", type="integer", nullable=false)
138
     */
139
    protected $invited;
140
141
    /**
142
     * @var int
143
     *
144
     * @ORM\Column(name="answered", type="integer", nullable=false)
145
     */
146
    protected $answered;
147
148
    /**
149
     * @var string
150
     *
151
     * @ORM\Column(name="invite_mail", type="text", nullable=false)
152
     */
153
    protected $inviteMail;
154
155
    /**
156
     * @var string
157
     *
158
     * @ORM\Column(name="reminder_mail", type="text", nullable=false)
159
     */
160
    protected $reminderMail;
161
162
    /**
163
     * @var string
164
     *
165
     * @ORM\Column(name="mail_subject", type="string", length=255, nullable=false)
166
     */
167
    protected $mailSubject;
168
169
    /**
170
     * @var string
171
     *
172
     * @ORM\Column(name="anonymous", type="string", length=10, nullable=false)
173
     */
174
    protected $anonymous;
175
176
    /**
177
     * @var string
178
     *
179
     * @ORM\Column(name="access_condition", type="text", nullable=true)
180
     */
181
    protected $accessCondition;
182
183
    /**
184
     * @var bool
185
     *
186
     * @ORM\Column(name="shuffle", type="boolean", nullable=false)
187
     */
188
    protected $shuffle;
189
190
    /**
191
     * @var bool
192
     *
193
     * @ORM\Column(name="one_question_per_page", type="boolean", nullable=false)
194
     */
195
    protected $oneQuestionPerPage;
196
197
    /**
198
     * @var string
199
     *
200
     * @ORM\Column(name="survey_version", type="string", length=255, nullable=false)
201
     */
202
    protected $surveyVersion;
203
204
    /**
205
     * @var int
206
     *
207
     * @ORM\Column(name="parent_id", type="integer", nullable=false)
208
     */
209
    protected $parentId;
210
211
    /**
212
     * @var int
213
     *
214
     * @ORM\Column(name="survey_type", type="integer", nullable=false)
215
     */
216
    protected $surveyType;
217
218
    /**
219
     * @var int
220
     *
221
     * @ORM\Column(name="show_form_profile", type="integer", nullable=false)
222
     */
223
    protected $showFormProfile;
224
225
    /**
226
     * @var string
227
     *
228
     * @ORM\Column(name="form_fields", type="text", nullable=false)
229
     */
230
    protected $formFields;
231
232
    /**
233
     * @var int
234
     *
235
     * @ORM\Column(name="session_id", type="integer", nullable=false)
236
     */
237
    protected $sessionId;
238
239
    /**
240
     * @var int
241
     *
242
     * @ORM\Column(name="visible_results", type="integer", nullable=true)
243
     */
244
    protected $visibleResults;
245
246
    /**
247
     * @var bool
248
     *
249
     * @ORM\Column(name="is_mandatory", type="boolean", options={"default":false})
250
     */
251
    protected $isMandatory = false;
252
253
    /**
254
     * CSurvey constructor.
255
     */
256
    public function __construct()
257
    {
258
        $this->creationDate = new \DateTime();
259
        $this->invited = 0;
260
        $this->answered = 0;
261
        $this->surveyId = 0;
262
        $this->inviteMail = '';
263
        $this->reminderMail = '';
264
        $this->mailSubject = '';
265
        $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...
266
        $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...
267
        $this->surveyVersion = '';
268
        $this->parentId = 0;
269
        $this->surveyType = 0;
270
    }
271
272
    public function getIid(): int
273
    {
274
        return $this->iid;
275
    }
276
277
    public function setIid(int $iid): self
278
    {
279
        $this->iid = $iid;
280
281
        return $this;
282
    }
283
284
    /**
285
     * Set code.
286
     *
287
     * @param string $code
288
     *
289
     * @return CSurvey
290
     */
291
    public function setCode($code)
292
    {
293
        $this->code = $code;
294
295
        return $this;
296
    }
297
298
    /**
299
     * Get code.
300
     *
301
     * @return string
302
     */
303
    public function getCode()
304
    {
305
        return $this->code;
306
    }
307
308
    /**
309
     * Set title.
310
     *
311
     * @param string $title
312
     *
313
     * @return CSurvey
314
     */
315
    public function setTitle($title)
316
    {
317
        $this->title = $title;
318
319
        return $this;
320
    }
321
322
    /**
323
     * Get title.
324
     *
325
     * @return string
326
     */
327
    public function getTitle()
328
    {
329
        return $this->title;
330
    }
331
332
    /**
333
     * Set subtitle.
334
     *
335
     * @param string $subtitle
336
     *
337
     * @return CSurvey
338
     */
339
    public function setSubtitle($subtitle)
340
    {
341
        $this->subtitle = $subtitle;
342
343
        return $this;
344
    }
345
346
    /**
347
     * Get subtitle.
348
     *
349
     * @return string
350
     */
351
    public function getSubtitle()
352
    {
353
        return $this->subtitle;
354
    }
355
356
    /**
357
     * Set author.
358
     *
359
     * @param string $author
360
     *
361
     * @return CSurvey
362
     */
363
    public function setAuthor($author)
364
    {
365
        $this->author = $author;
366
367
        return $this;
368
    }
369
370
    /**
371
     * Get author.
372
     *
373
     * @return string
374
     */
375
    public function getAuthor()
376
    {
377
        return $this->author;
378
    }
379
380
    /**
381
     * Set lang.
382
     *
383
     * @param string $lang
384
     *
385
     * @return CSurvey
386
     */
387
    public function setLang($lang)
388
    {
389
        $this->lang = $lang;
390
391
        return $this;
392
    }
393
394
    /**
395
     * Get lang.
396
     *
397
     * @return string
398
     */
399
    public function getLang()
400
    {
401
        return $this->lang;
402
    }
403
404
    /**
405
     * Set availFrom.
406
     *
407
     * @param \DateTime $availFrom
408
     *
409
     * @return CSurvey
410
     */
411
    public function setAvailFrom($availFrom)
412
    {
413
        $this->availFrom = $availFrom;
414
415
        return $this;
416
    }
417
418
    /**
419
     * Get availFrom.
420
     *
421
     * @return \DateTime
422
     */
423
    public function getAvailFrom()
424
    {
425
        return $this->availFrom;
426
    }
427
428
    /**
429
     * Set availTill.
430
     *
431
     * @param \DateTime $availTill
432
     *
433
     * @return CSurvey
434
     */
435
    public function setAvailTill($availTill)
436
    {
437
        $this->availTill = $availTill;
438
439
        return $this;
440
    }
441
442
    /**
443
     * Get availTill.
444
     *
445
     * @return \DateTime
446
     */
447
    public function getAvailTill()
448
    {
449
        return $this->availTill;
450
    }
451
452
    /**
453
     * Set isShared.
454
     *
455
     * @param string $isShared
456
     *
457
     * @return CSurvey
458
     */
459
    public function setIsShared($isShared)
460
    {
461
        $this->isShared = $isShared;
462
463
        return $this;
464
    }
465
466
    /**
467
     * Get isShared.
468
     *
469
     * @return string
470
     */
471
    public function getIsShared()
472
    {
473
        return $this->isShared;
474
    }
475
476
    /**
477
     * Set template.
478
     *
479
     * @param string $template
480
     *
481
     * @return CSurvey
482
     */
483
    public function setTemplate($template)
484
    {
485
        $this->template = $template;
486
487
        return $this;
488
    }
489
490
    /**
491
     * Get template.
492
     *
493
     * @return string
494
     */
495
    public function getTemplate()
496
    {
497
        return $this->template;
498
    }
499
500
    /**
501
     * Set intro.
502
     *
503
     * @param string $intro
504
     *
505
     * @return CSurvey
506
     */
507
    public function setIntro($intro)
508
    {
509
        $this->intro = $intro;
510
511
        return $this;
512
    }
513
514
    /**
515
     * Get intro.
516
     *
517
     * @return string
518
     */
519
    public function getIntro()
520
    {
521
        return $this->intro;
522
    }
523
524
    /**
525
     * Set surveythanks.
526
     *
527
     * @param string $surveythanks
528
     *
529
     * @return CSurvey
530
     */
531
    public function setSurveythanks($surveythanks)
532
    {
533
        $this->surveyThanks = $surveythanks;
534
535
        return $this;
536
    }
537
538
    /**
539
     * Get surveythanks.
540
     *
541
     * @return string
542
     */
543
    public function getSurveythanks()
544
    {
545
        return $this->surveyThanks;
546
    }
547
548
    /**
549
     * Set creationDate.
550
     *
551
     * @param \DateTime $creationDate
552
     *
553
     * @return CSurvey
554
     */
555
    public function setCreationDate($creationDate)
556
    {
557
        $this->creationDate = $creationDate;
558
559
        return $this;
560
    }
561
562
    /**
563
     * Get creationDate.
564
     *
565
     * @return \DateTime
566
     */
567
    public function getCreationDate()
568
    {
569
        return $this->creationDate;
570
    }
571
572
    /**
573
     * Set invited.
574
     *
575
     * @param int $invited
576
     *
577
     * @return CSurvey
578
     */
579
    public function setInvited($invited)
580
    {
581
        $this->invited = $invited;
582
583
        return $this;
584
    }
585
586
    /**
587
     * Get invited.
588
     *
589
     * @return int
590
     */
591
    public function getInvited()
592
    {
593
        return $this->invited;
594
    }
595
596
    /**
597
     * Set answered.
598
     *
599
     * @param int $answered
600
     *
601
     * @return CSurvey
602
     */
603
    public function setAnswered($answered)
604
    {
605
        $this->answered = $answered;
606
607
        return $this;
608
    }
609
610
    /**
611
     * Get answered.
612
     *
613
     * @return int
614
     */
615
    public function getAnswered()
616
    {
617
        return $this->answered;
618
    }
619
620
    /**
621
     * Set inviteMail.
622
     *
623
     * @param string $inviteMail
624
     *
625
     * @return CSurvey
626
     */
627
    public function setInviteMail($inviteMail)
628
    {
629
        $this->inviteMail = $inviteMail;
630
631
        return $this;
632
    }
633
634
    /**
635
     * Get inviteMail.
636
     *
637
     * @return string
638
     */
639
    public function getInviteMail()
640
    {
641
        return $this->inviteMail;
642
    }
643
644
    /**
645
     * Set reminderMail.
646
     *
647
     * @param string $reminderMail
648
     *
649
     * @return CSurvey
650
     */
651
    public function setReminderMail($reminderMail)
652
    {
653
        $this->reminderMail = $reminderMail;
654
655
        return $this;
656
    }
657
658
    /**
659
     * Get reminderMail.
660
     *
661
     * @return string
662
     */
663
    public function getReminderMail()
664
    {
665
        return $this->reminderMail;
666
    }
667
668
    /**
669
     * Set mailSubject.
670
     *
671
     * @param string $mailSubject
672
     *
673
     * @return CSurvey
674
     */
675
    public function setMailSubject($mailSubject)
676
    {
677
        $this->mailSubject = $mailSubject;
678
679
        return $this;
680
    }
681
682
    /**
683
     * Get mailSubject.
684
     *
685
     * @return string
686
     */
687
    public function getMailSubject()
688
    {
689
        return $this->mailSubject;
690
    }
691
692
    /**
693
     * Set anonymous.
694
     *
695
     * @param string $anonymous
696
     *
697
     * @return CSurvey
698
     */
699
    public function setAnonymous($anonymous)
700
    {
701
        $this->anonymous = $anonymous;
702
703
        return $this;
704
    }
705
706
    /**
707
     * Get anonymous.
708
     *
709
     * @return string
710
     */
711
    public function getAnonymous()
712
    {
713
        return $this->anonymous;
714
    }
715
716
    /**
717
     * Set accessCondition.
718
     *
719
     * @param string $accessCondition
720
     *
721
     * @return CSurvey
722
     */
723
    public function setAccessCondition($accessCondition)
724
    {
725
        $this->accessCondition = $accessCondition;
726
727
        return $this;
728
    }
729
730
    /**
731
     * Get accessCondition.
732
     *
733
     * @return string
734
     */
735
    public function getAccessCondition()
736
    {
737
        return $this->accessCondition;
738
    }
739
740
    /**
741
     * Set shuffle.
742
     *
743
     * @param bool $shuffle
744
     *
745
     * @return CSurvey
746
     */
747
    public function setShuffle($shuffle)
748
    {
749
        $this->shuffle = $shuffle;
750
751
        return $this;
752
    }
753
754
    /**
755
     * Get shuffle.
756
     *
757
     * @return bool
758
     */
759
    public function getShuffle()
760
    {
761
        return $this->shuffle;
762
    }
763
764
    /**
765
     * Set oneQuestionPerPage.
766
     *
767
     * @param bool $oneQuestionPerPage
768
     *
769
     * @return CSurvey
770
     */
771
    public function setOneQuestionPerPage($oneQuestionPerPage)
772
    {
773
        $this->oneQuestionPerPage = $oneQuestionPerPage;
774
775
        return $this;
776
    }
777
778
    /**
779
     * Get oneQuestionPerPage.
780
     *
781
     * @return bool
782
     */
783
    public function getOneQuestionPerPage()
784
    {
785
        return $this->oneQuestionPerPage;
786
    }
787
788
    /**
789
     * Set surveyVersion.
790
     *
791
     * @param string $surveyVersion
792
     *
793
     * @return CSurvey
794
     */
795
    public function setSurveyVersion($surveyVersion)
796
    {
797
        $this->surveyVersion = $surveyVersion;
798
799
        return $this;
800
    }
801
802
    /**
803
     * Get surveyVersion.
804
     *
805
     * @return string
806
     */
807
    public function getSurveyVersion()
808
    {
809
        return $this->surveyVersion;
810
    }
811
812
    /**
813
     * Set parentId.
814
     *
815
     * @param int $parentId
816
     *
817
     * @return CSurvey
818
     */
819
    public function setParentId($parentId)
820
    {
821
        $this->parentId = $parentId;
822
823
        return $this;
824
    }
825
826
    /**
827
     * Get parentId.
828
     *
829
     * @return int
830
     */
831
    public function getParentId()
832
    {
833
        return $this->parentId;
834
    }
835
836
    /**
837
     * Set surveyType.
838
     *
839
     * @param int $surveyType
840
     *
841
     * @return CSurvey
842
     */
843
    public function setSurveyType($surveyType)
844
    {
845
        $this->surveyType = $surveyType;
846
847
        return $this;
848
    }
849
850
    /**
851
     * Get surveyType.
852
     *
853
     * @return int
854
     */
855
    public function getSurveyType()
856
    {
857
        return $this->surveyType;
858
    }
859
860
    /**
861
     * Set showFormProfile.
862
     *
863
     * @param int $showFormProfile
864
     *
865
     * @return CSurvey
866
     */
867
    public function setShowFormProfile($showFormProfile)
868
    {
869
        $this->showFormProfile = $showFormProfile;
870
871
        return $this;
872
    }
873
874
    /**
875
     * Get showFormProfile.
876
     *
877
     * @return int
878
     */
879
    public function getShowFormProfile()
880
    {
881
        return $this->showFormProfile;
882
    }
883
884
    /**
885
     * Set formFields.
886
     *
887
     * @param string $formFields
888
     *
889
     * @return CSurvey
890
     */
891
    public function setFormFields($formFields)
892
    {
893
        $this->formFields = $formFields;
894
895
        return $this;
896
    }
897
898
    /**
899
     * Get formFields.
900
     *
901
     * @return string
902
     */
903
    public function getFormFields()
904
    {
905
        return $this->formFields;
906
    }
907
908
    /**
909
     * Set sessionId.
910
     *
911
     * @param int $sessionId
912
     *
913
     * @return CSurvey
914
     */
915
    public function setSessionId($sessionId)
916
    {
917
        $this->sessionId = $sessionId;
918
919
        return $this;
920
    }
921
922
    /**
923
     * Get sessionId.
924
     *
925
     * @return int
926
     */
927
    public function getSessionId()
928
    {
929
        return $this->sessionId;
930
    }
931
932
    /**
933
     * Set visibleResults.
934
     *
935
     * @param int $visibleResults
936
     *
937
     * @return CSurvey
938
     */
939
    public function setVisibleResults($visibleResults)
940
    {
941
        $this->visibleResults = $visibleResults;
942
943
        return $this;
944
    }
945
946
    /**
947
     * Get visibleResults.
948
     *
949
     * @return int
950
     */
951
    public function getVisibleResults()
952
    {
953
        return $this->visibleResults;
954
    }
955
956
    /**
957
     * Set surveyId.
958
     *
959
     * @param int $surveyId
960
     *
961
     * @return CSurvey
962
     */
963
    public function setSurveyId($surveyId)
964
    {
965
        $this->surveyId = $surveyId;
966
967
        return $this;
968
    }
969
970
    /**
971
     * Get surveyId.
972
     *
973
     * @return int
974
     */
975
    public function getSurveyId()
976
    {
977
        return $this->surveyId;
978
    }
979
980
    /**
981
     * Set cId.
982
     *
983
     * @param int $cId
984
     *
985
     * @return CSurvey
986
     */
987
    public function setCId($cId)
988
    {
989
        $this->cId = $cId;
990
991
        return $this;
992
    }
993
994
    /**
995
     * Get cId.
996
     *
997
     * @return int
998
     */
999
    public function getCId()
1000
    {
1001
        return $this->cId;
1002
    }
1003
1004
    /**
1005
     * @param bool $isMandatory
1006
     *
1007
     * @return CSurvey
1008
     */
1009
    public function setIsMandatory($isMandatory)
1010
    {
1011
        $this->isMandatory = $isMandatory;
1012
1013
        return $this;
1014
    }
1015
1016
    /**
1017
     * @return bool
1018
     */
1019
    public function isMandatory()
1020
    {
1021
        return $this->isMandatory;
1022
    }
1023
1024
    public function __toString(): string
1025
    {
1026
        return $this->getTitle();
1027
    }
1028
1029
    public function getResourceIdentifier(): int
1030
    {
1031
        return $this->getIid();
1032
    }
1033
1034
    public function getResourceName(): string
1035
    {
1036
        return $this->getTitle();
1037
    }
1038
1039
    public function setResourceName(string $name): self
1040
    {
1041
        return $this->setTitle($name);
1042
    }
1043
}
1044