Passed
Push — master ( f737dc...ea0e05 )
by Julito
11:04
created

CLp::setPreventReinit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
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\Asset;
11
use Chamilo\CoreBundle\Entity\ResourceInterface;
12
use DateTime;
13
use Doctrine\Common\Collections\ArrayCollection;
14
use Doctrine\Common\Collections\Collection;
15
use Doctrine\ORM\Mapping as ORM;
16
use Gedmo\Mapping\Annotation as Gedmo;
17
use Symfony\Component\Validator\Constraints as Assert;
18
19
/**
20
 * @ORM\Table(
21
 *     name="c_lp"
22
 * )
23
 * @ORM\Entity
24
 */
25
class CLp extends AbstractResource implements ResourceInterface
26
{
27
    public const LP_TYPE = 1;
28
    public const SCORM_TYPE = 2;
29
    public const AICC_TYPE = 3;
30
31
    /**
32
     * @ORM\Column(name="iid", type="integer")
33
     * @ORM\Id
34
     * @ORM\GeneratedValue
35
     */
36
    protected int $iid;
37
38
    /**
39
     * @ORM\Column(name="c_id", type="integer")
40
     */
41
    protected int $cId;
42
43
    /**
44
     * @Assert\NotBlank()
45
     * @ORM\Column(name="lp_type", type="integer", nullable=false)
46
     */
47
    protected int $lpType;
48
49
    /**
50
     * @Assert\NotBlank()
51
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
52
     */
53
    protected string $name;
54
55
    /**
56
     * @ORM\Column(name="ref", type="text", nullable=true)
57
     */
58
    protected ?string $ref = null;
59
60
    /**
61
     * @ORM\Column(name="description", type="text", nullable=true)
62
     */
63
    protected ?string $description;
64
65
    /**
66
     * @ORM\Column(name="path", type="text", nullable=false)
67
     */
68
    protected string $path;
69
70
    /**
71
     * @ORM\Column(name="force_commit", type="boolean", nullable=false)
72
     */
73
    protected bool $forceCommit;
74
75
    /**
76
     * @ORM\Column(name="default_view_mod", type="string", length=32, nullable=false, options={"default":"embedded"})
77
     */
78
    protected string $defaultViewMod;
79
80
    /**
81
     * @ORM\Column(name="default_encoding", type="string", length=32, nullable=false, options={"default":"UTF-8"})
82
     */
83
    protected string $defaultEncoding;
84
85
    /**
86
     * @ORM\Column(name="display_order", type="integer", nullable=false, options={"default":"0"})
87
     */
88
    protected int $displayOrder;
89
90
    /**
91
     * @ORM\Column(name="content_maker", type="text", nullable=false)
92
     */
93
    protected string $contentMaker;
94
95
    /**
96
     * @ORM\Column(name="content_local", type="string", length=32, nullable=false, options={"default":"local"})
97
     */
98
    protected string $contentLocal;
99
100
    /**
101
     * @ORM\Column(name="content_license", type="text", nullable=false)
102
     */
103
    protected string $contentLicense;
104
105
    /**
106
     * @ORM\Column(name="prevent_reinit", type="boolean", nullable=false, options={"default":"1"})
107
     */
108
    protected bool $preventReinit;
109
110
    /**
111
     * @ORM\Column(name="js_lib", type="text", nullable=false)
112
     */
113
    protected string $jsLib;
114
115
    /**
116
     * @ORM\Column(name="debug", type="boolean", nullable=false)
117
     */
118
    protected bool $debug;
119
120
    /**
121
     * @ORM\Column(name="theme", type="string", length=255, nullable=false)
122
     */
123
    protected string $theme;
124
125
    /**
126
     * @ORM\Column(name="author", type="text", nullable=false)
127
     */
128
    protected string $author;
129
130
    /**
131
     * @ORM\Column(name="session_id", type="integer", nullable=false)
132
     */
133
    protected int $sessionId;
134
135
    /**
136
     * @ORM\Column(name="prerequisite", type="integer", nullable=false)
137
     */
138
    protected int $prerequisite;
139
140
    /**
141
     * @ORM\Column(name="hide_toc_frame", type="boolean", nullable=false)
142
     */
143
    protected bool $hideTocFrame;
144
145
    /**
146
     * @ORM\Column(name="seriousgame_mode", type="boolean", nullable=false)
147
     */
148
    protected bool $seriousgameMode;
149
150
    /**
151
     * @ORM\Column(name="use_max_score", type="integer", nullable=false, options={"default":"1"})
152
     */
153
    protected int $useMaxScore;
154
155
    /**
156
     * @ORM\Column(name="autolaunch", type="integer", nullable=false)
157
     */
158
    protected int $autolaunch;
159
160
    /**
161
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CLpCategory", inversedBy="lps")
162
     * @ORM\JoinColumn(name="category_id", referencedColumnName="iid")
163
     */
164
    protected ?CLpCategory $category = null;
165
166
    /**
167
     * @ORM\Column(name="max_attempts", type="integer", nullable=false)
168
     */
169
    protected int $maxAttempts;
170
171
    /**
172
     * @ORM\Column(name="subscribe_users", type="integer", nullable=false)
173
     */
174
    protected int $subscribeUsers;
175
176
    /**
177
     * @Gedmo\Timestampable(on="create")
178
     *
179
     * @ORM\Column(name="created_on", type="datetime", nullable=false)
180
     */
181
    protected DateTime $createdOn;
182
183
    /**
184
     * @Gedmo\Timestampable(on="update")
185
     *
186
     * @ORM\Column(name="modified_on", type="datetime", nullable=false)
187
     */
188
    protected DateTime $modifiedOn;
189
190
    /**
191
     * @ORM\Column(name="publicated_on", type="datetime", nullable=true)
192
     */
193
    protected ?DateTime $publicatedOn;
194
195
    /**
196
     * @ORM\Column(name="expired_on", type="datetime", nullable=true)
197
     */
198
    protected ?DateTime $expiredOn = null;
199
200
    /**
201
     * @ORM\Column(name="accumulate_scorm_time", type="integer", nullable=false, options={"default":1})
202
     */
203
    protected int $accumulateScormTime;
204
205
    /**
206
     * @ORM\Column(name="accumulate_work_time", type="integer", nullable=false, options={"default":0})
207
     */
208
    protected int $accumulateWorkTime;
209
210
    /**
211
     * @var Collection|CLpItem[]
212
     *
213
     * @ORM\OneToMany(targetEntity="CLpItem", mappedBy="lp", cascade={"persist", "remove"}, orphanRemoval=true)
214
     */
215
    protected Collection $items;
216
217
    /**
218
     * @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", mappedBy="lp")
219
     */
220
    protected ?CForumForum $forum = null;
221
222
    /**
223
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"persist", "remove"})
224
     * @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
225
     */
226
    protected ?Asset $asset = null;
227
228
    public function __construct()
229
    {
230
        $now = new DateTime();
231
        $this->createdOn = $now;
232
        $this->modifiedOn = $now;
233
        $this->publicatedOn = $now;
234
        $this->accumulateScormTime = 1;
235
        $this->accumulateWorkTime = 0;
236
        $this->author = '';
237
        $this->autolaunch = 0;
238
        $this->contentLocal = 'local';
239
        $this->contentMaker = 'chamilo';
240
        $this->contentLicense = '';
241
        $this->defaultEncoding = 'UTF-8';
242
        $this->defaultViewMod = 'embedded';
243
        $this->description = '';
244
        $this->displayOrder = 0;
245
        $this->debug = false;
246
        $this->forceCommit = false;
247
        $this->hideTocFrame = false;
248
        $this->jsLib = '';
249
        $this->maxAttempts = 0;
250
        $this->preventReinit = true;
251
        $this->path = '';
252
        $this->prerequisite = 0;
253
        $this->seriousgameMode = false;
254
        $this->subscribeUsers = 0;
255
        $this->useMaxScore = 1;
256
        $this->theme = '';
257
        $this->items = new ArrayCollection();
258
    }
259
260
    public function __toString(): string
261
    {
262
        return $this->getName();
263
    }
264
265
    /**
266
     * Set lpType.
267
     *
268
     * @return CLp
269
     */
270
    public function setLpType(int $lpType)
271
    {
272
        $this->lpType = $lpType;
273
274
        return $this;
275
    }
276
277
    /**
278
     * Get lpType.
279
     *
280
     * @return int
281
     */
282
    public function getLpType()
283
    {
284
        return $this->lpType;
285
    }
286
287
    /**
288
     * Set name.
289
     *
290
     * @return CLp
291
     */
292
    public function setName(string $name)
293
    {
294
        $this->name = $name;
295
296
        return $this;
297
    }
298
299
    public function getName(): string
300
    {
301
        return $this->name;
302
    }
303
304
    /**
305
     * Set ref.
306
     *
307
     * @return CLp
308
     */
309
    public function setRef(string $ref)
310
    {
311
        $this->ref = $ref;
312
313
        return $this;
314
    }
315
316
    /**
317
     * Get ref.
318
     *
319
     * @return string
320
     */
321
    public function getRef()
322
    {
323
        return $this->ref;
324
    }
325
326
    public function setDescription(string $description): self
327
    {
328
        $this->description = $description;
329
330
        return $this;
331
    }
332
333
    public function getDescription(): ?string
334
    {
335
        return $this->description;
336
    }
337
338
    /**
339
     * Set path.
340
     *
341
     * @return CLp
342
     */
343
    public function setPath(string $path)
344
    {
345
        $this->path = $path;
346
347
        return $this;
348
    }
349
350
    /**
351
     * Get path.
352
     *
353
     * @return string
354
     */
355
    public function getPath()
356
    {
357
        return $this->path;
358
    }
359
360
    /**
361
     * Set forceCommit.
362
     *
363
     * @return CLp
364
     */
365
    public function setForceCommit(bool $forceCommit)
366
    {
367
        $this->forceCommit = $forceCommit;
368
369
        return $this;
370
    }
371
372
    /**
373
     * Get forceCommit.
374
     *
375
     * @return bool
376
     */
377
    public function getForceCommit()
378
    {
379
        return $this->forceCommit;
380
    }
381
382
    /**
383
     * Set defaultViewMod.
384
     *
385
     * @return CLp
386
     */
387
    public function setDefaultViewMod(string $defaultViewMod)
388
    {
389
        $this->defaultViewMod = $defaultViewMod;
390
391
        return $this;
392
    }
393
394
    /**
395
     * Get defaultViewMod.
396
     *
397
     * @return string
398
     */
399
    public function getDefaultViewMod()
400
    {
401
        return $this->defaultViewMod;
402
    }
403
404
    /**
405
     * Set defaultEncoding.
406
     *
407
     * @return CLp
408
     */
409
    public function setDefaultEncoding(string $defaultEncoding)
410
    {
411
        $this->defaultEncoding = $defaultEncoding;
412
413
        return $this;
414
    }
415
416
    /**
417
     * Get defaultEncoding.
418
     *
419
     * @return string
420
     */
421
    public function getDefaultEncoding()
422
    {
423
        return $this->defaultEncoding;
424
    }
425
426
    /**
427
     * Set displayOrder.
428
     *
429
     * @return CLp
430
     */
431
    public function setDisplayOrder(int $displayOrder)
432
    {
433
        $this->displayOrder = $displayOrder;
434
435
        return $this;
436
    }
437
438
    /**
439
     * Get displayOrder.
440
     *
441
     * @return int
442
     */
443
    public function getDisplayOrder()
444
    {
445
        return $this->displayOrder;
446
    }
447
448
    /**
449
     * Set contentMaker.
450
     *
451
     * @return CLp
452
     */
453
    public function setContentMaker(string $contentMaker)
454
    {
455
        $this->contentMaker = $contentMaker;
456
457
        return $this;
458
    }
459
460
    /**
461
     * Get contentMaker.
462
     *
463
     * @return string
464
     */
465
    public function getContentMaker()
466
    {
467
        return $this->contentMaker;
468
    }
469
470
    /**
471
     * Set contentLocal.
472
     *
473
     * @return CLp
474
     */
475
    public function setContentLocal(string $contentLocal)
476
    {
477
        $this->contentLocal = $contentLocal;
478
479
        return $this;
480
    }
481
482
    /**
483
     * Get contentLocal.
484
     *
485
     * @return string
486
     */
487
    public function getContentLocal()
488
    {
489
        return $this->contentLocal;
490
    }
491
492
    /**
493
     * Set contentLicense.
494
     *
495
     * @return CLp
496
     */
497
    public function setContentLicense(string $contentLicense)
498
    {
499
        $this->contentLicense = $contentLicense;
500
501
        return $this;
502
    }
503
504
    /**
505
     * Get contentLicense.
506
     *
507
     * @return string
508
     */
509
    public function getContentLicense()
510
    {
511
        return $this->contentLicense;
512
    }
513
514
    /**
515
     * Set preventReinit.
516
     *
517
     * @return CLp
518
     */
519
    public function setPreventReinit(bool $preventReinit)
520
    {
521
        $this->preventReinit = $preventReinit;
522
523
        return $this;
524
    }
525
526
    /**
527
     * Get preventReinit.
528
     *
529
     * @return bool
530
     */
531
    public function getPreventReinit()
532
    {
533
        return $this->preventReinit;
534
    }
535
536
    /**
537
     * Set jsLib.
538
     *
539
     * @return CLp
540
     */
541
    public function setJsLib(string $jsLib)
542
    {
543
        $this->jsLib = $jsLib;
544
545
        return $this;
546
    }
547
548
    /**
549
     * Get jsLib.
550
     *
551
     * @return string
552
     */
553
    public function getJsLib()
554
    {
555
        return $this->jsLib;
556
    }
557
558
    /**
559
     * Set debug.
560
     *
561
     * @return CLp
562
     */
563
    public function setDebug(bool $debug)
564
    {
565
        $this->debug = $debug;
566
567
        return $this;
568
    }
569
570
    /**
571
     * Get debug.
572
     *
573
     * @return bool
574
     */
575
    public function getDebug()
576
    {
577
        return $this->debug;
578
    }
579
580
    /**
581
     * Set theme.
582
     *
583
     * @return CLp
584
     */
585
    public function setTheme(string $theme)
586
    {
587
        $this->theme = $theme;
588
589
        return $this;
590
    }
591
592
    /**
593
     * Get theme.
594
     *
595
     * @return string
596
     */
597
    public function getTheme()
598
    {
599
        return $this->theme;
600
    }
601
602
    /**
603
     * Set author.
604
     *
605
     * @return CLp
606
     */
607
    public function setAuthor(string $author)
608
    {
609
        $this->author = $author;
610
611
        return $this;
612
    }
613
614
    /**
615
     * Get author.
616
     *
617
     * @return string
618
     */
619
    public function getAuthor()
620
    {
621
        return $this->author;
622
    }
623
624
    /**
625
     * Set sessionId.
626
     *
627
     * @return CLp
628
     */
629
    public function setSessionId(int $sessionId)
630
    {
631
        $this->sessionId = $sessionId;
632
633
        return $this;
634
    }
635
636
    /**
637
     * Get sessionId.
638
     *
639
     * @return int
640
     */
641
    public function getSessionId()
642
    {
643
        return $this->sessionId;
644
    }
645
646
    /**
647
     * Set prerequisite.
648
     *
649
     * @return CLp
650
     */
651
    public function setPrerequisite(int $prerequisite)
652
    {
653
        $this->prerequisite = $prerequisite;
654
655
        return $this;
656
    }
657
658
    /**
659
     * Get prerequisite.
660
     *
661
     * @return int
662
     */
663
    public function getPrerequisite()
664
    {
665
        return $this->prerequisite;
666
    }
667
668
    /**
669
     * Set hideTocFrame.
670
     *
671
     * @return CLp
672
     */
673
    public function setHideTocFrame(bool $hideTocFrame)
674
    {
675
        $this->hideTocFrame = $hideTocFrame;
676
677
        return $this;
678
    }
679
680
    /**
681
     * Get hideTocFrame.
682
     *
683
     * @return bool
684
     */
685
    public function getHideTocFrame()
686
    {
687
        return $this->hideTocFrame;
688
    }
689
690
    /**
691
     * Set seriousgameMode.
692
     *
693
     * @return CLp
694
     */
695
    public function setSeriousgameMode(bool $seriousgameMode)
696
    {
697
        $this->seriousgameMode = $seriousgameMode;
698
699
        return $this;
700
    }
701
702
    /**
703
     * Get seriousgameMode.
704
     *
705
     * @return bool
706
     */
707
    public function getSeriousgameMode()
708
    {
709
        return $this->seriousgameMode;
710
    }
711
712
    /**
713
     * Set useMaxScore.
714
     *
715
     * @return CLp
716
     */
717
    public function setUseMaxScore(int $useMaxScore)
718
    {
719
        $this->useMaxScore = $useMaxScore;
720
721
        return $this;
722
    }
723
724
    /**
725
     * Get useMaxScore.
726
     *
727
     * @return int
728
     */
729
    public function getUseMaxScore()
730
    {
731
        return $this->useMaxScore;
732
    }
733
734
    /**
735
     * Set autolaunch.
736
     *
737
     * @return CLp
738
     */
739
    public function setAutolaunch(int $autolaunch)
740
    {
741
        $this->autolaunch = $autolaunch;
742
743
        return $this;
744
    }
745
746
    /**
747
     * Get autolaunch.
748
     *
749
     * @return int
750
     */
751
    public function getAutolaunch()
752
    {
753
        return $this->autolaunch;
754
    }
755
756
    /**
757
     * Set createdOn.
758
     *
759
     * @return CLp
760
     */
761
    public function setCreatedOn(DateTime $createdOn)
762
    {
763
        $this->createdOn = $createdOn;
764
765
        return $this;
766
    }
767
768
    /**
769
     * Get createdOn.
770
     *
771
     * @return DateTime
772
     */
773
    public function getCreatedOn()
774
    {
775
        return $this->createdOn;
776
    }
777
778
    /**
779
     * Set modifiedOn.
780
     *
781
     * @return CLp
782
     */
783
    public function setModifiedOn(DateTime $modifiedOn)
784
    {
785
        $this->modifiedOn = $modifiedOn;
786
787
        return $this;
788
    }
789
790
    /**
791
     * Get modifiedOn.
792
     *
793
     * @return DateTime
794
     */
795
    public function getModifiedOn()
796
    {
797
        return $this->modifiedOn;
798
    }
799
800
    /**
801
     * Set publicatedOn.
802
     *
803
     * @return CLp
804
     */
805
    public function setPublicatedOn(DateTime $publicatedOn)
806
    {
807
        $this->publicatedOn = $publicatedOn;
808
809
        return $this;
810
    }
811
812
    /**
813
     * Get publicatedOn.
814
     *
815
     * @return DateTime
816
     */
817
    public function getPublicatedOn()
818
    {
819
        return $this->publicatedOn;
820
    }
821
822
    public function setExpiredOn(?DateTime $expiredOn): self
823
    {
824
        $this->expiredOn = $expiredOn;
825
826
        return $this;
827
    }
828
829
    /**
830
     * Get expiredOn.
831
     *
832
     * @return DateTime
833
     */
834
    public function getExpiredOn()
835
    {
836
        return $this->expiredOn;
837
    }
838
839
    /**
840
     * Set cId.
841
     *
842
     * @return CLp
843
     */
844
    public function setCId(int $cId)
845
    {
846
        $this->cId = $cId;
847
848
        return $this;
849
    }
850
851
    /**
852
     * Get cId.
853
     *
854
     * @return int
855
     */
856
    public function getCId()
857
    {
858
        return $this->cId;
859
    }
860
861
    public function getCategory(): ?CLpCategory
862
    {
863
        return $this->category;
864
    }
865
866
    public function hasCategory(): bool
867
    {
868
        return null !== $this->category;
869
    }
870
871
    public function setCategory(CLpCategory $category = null): self
872
    {
873
        $this->category = $category;
874
875
        return $this;
876
    }
877
878
    /**
879
     * @return int
880
     */
881
    public function getAccumulateScormTime()
882
    {
883
        return $this->accumulateScormTime;
884
    }
885
886
    /**
887
     * @return CLp
888
     */
889
    public function setAccumulateScormTime(int $accumulateScormTime)
890
    {
891
        $this->accumulateScormTime = $accumulateScormTime;
892
893
        return $this;
894
    }
895
896
    public function getAccumulateWorkTime(): int
897
    {
898
        return $this->accumulateWorkTime;
899
    }
900
901
    public function setAccumulateWorkTime(int $accumulateWorkTime): self
902
    {
903
        $this->accumulateWorkTime = $accumulateWorkTime;
904
905
        return $this;
906
    }
907
908
    public function getMaxAttempts(): int
909
    {
910
        return $this->maxAttempts;
911
    }
912
913
    /**
914
     * @return CLpItem[]|Collection
915
     */
916
    public function getItems()
917
    {
918
        return $this->items;
919
    }
920
921
    /**
922
     * Get iid.
923
     *
924
     * @return int
925
     */
926
    public function getIid()
927
    {
928
        return $this->iid;
929
    }
930
931
    /**
932
     * Get subscribeUsers.
933
     *
934
     * @return int
935
     */
936
    public function getSubscribeUsers()
937
    {
938
        return $this->subscribeUsers;
939
    }
940
941
    public function setSubscribeUsers(int $value): self
942
    {
943
        $this->subscribeUsers = $value;
944
945
        return $this;
946
    }
947
948
    public function getForum(): ?CForumForum
949
    {
950
        return $this->forum;
951
    }
952
953
    public function hasForum(): bool
954
    {
955
        return null !== $this->forum;
956
    }
957
958
    public function setForum(CForumForum $forum): self
959
    {
960
        $this->forum = $forum;
961
962
        return $this;
963
    }
964
965
    public function getAsset(): ?Asset
966
    {
967
        return $this->asset;
968
    }
969
970
    public function hasAsset(): bool
971
    {
972
        return null !== $this->asset;
973
    }
974
975
    public function setAsset(?Asset $asset): self
976
    {
977
        $this->asset = $asset;
978
979
        return $this;
980
    }
981
982
    public function getResourceIdentifier(): int
983
    {
984
        return $this->getIid();
985
    }
986
987
    public function getResourceName(): string
988
    {
989
        return $this->getName();
990
    }
991
992
    public function setResourceName(string $name): self
993
    {
994
        return $this->setName($name);
995
    }
996
}
997