Passed
Push — master ( 2338dd...fbaf94 )
by Julito
09:45
created

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