Completed
Push — master ( c65fe1...e7429e )
by Julito
11:34
created

CForumForum::getResourceIdentifier()   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\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
use Gedmo\Mapping\Annotation as Gedmo;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
/**
15
 * CForumForum.
16
 *
17
 * @ORM\Table(
18
 *  name="c_forum_forum",
19
 *  indexes={
20
 *      @ORM\Index(name="course", columns={"c_id"})
21
 *  }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CForumForum 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
     * @Assert\NotBlank
46
     *
47
     * @ORM\Column(name="forum_title", type="string", length=255, nullable=false)
48
     */
49
    protected $forumTitle;
50
51
    /**
52
     * @var string
53
     *
54
     * @ORM\Column(name="forum_comment", type="text", nullable=true)
55
     */
56
    protected $forumComment;
57
58
    /**
59
     * @var int
60
     *
61
     * @ORM\Column(name="forum_threads", type="integer", nullable=true)
62
     */
63
    protected $forumThreads;
64
65
    /**
66
     * @var int
67
     *
68
     * @ORM\Column(name="forum_posts", type="integer", nullable=true)
69
     */
70
    protected $forumPosts;
71
72
    /**
73
     * @var int
74
     *
75
     * @ORM\Column(name="forum_last_post", type="integer", nullable=true)
76
     */
77
    protected $forumLastPost;
78
79
    /**
80
     * @Gedmo\SortableGroup
81
     *
82
     * @var CForumCategory|null
83
     *
84
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumCategory", inversedBy="forums")
85
     * @ORM\JoinColumn(name="forum_category", referencedColumnName="iid", nullable=true, onDelete="SET NULL")
86
     */
87
    protected $forumCategory;
88
89
    /**
90
     * @var int
91
     *
92
     * @ORM\Column(name="allow_anonymous", type="integer", nullable=true)
93
     */
94
    protected $allowAnonymous;
95
96
    /**
97
     * @var int
98
     *
99
     * @ORM\Column(name="allow_edit", type="integer", nullable=true)
100
     */
101
    protected $allowEdit;
102
103
    /**
104
     * @var string
105
     *
106
     * @ORM\Column(name="approval_direct_post", type="string", length=20, nullable=true)
107
     */
108
    protected $approvalDirectPost;
109
110
    /**
111
     * @var int
112
     *
113
     * @ORM\Column(name="allow_attachments", type="integer", nullable=true)
114
     */
115
    protected $allowAttachments;
116
117
    /**
118
     * @var int
119
     *
120
     * @ORM\Column(name="allow_new_threads", type="integer", nullable=true)
121
     */
122
    protected $allowNewThreads;
123
124
    /**
125
     * @var string
126
     *
127
     * @ORM\Column(name="default_view", type="string", length=20, nullable=true)
128
     */
129
    protected $defaultView;
130
131
    /**
132
     * @var string
133
     *
134
     * @ORM\Column(name="forum_of_group", type="string", length=20, nullable=true)
135
     */
136
    protected $forumOfGroup;
137
138
    /**
139
     * @var string
140
     *
141
     * @ORM\Column(name="forum_group_public_private", type="string", length=20, nullable=true)
142
     */
143
    protected $forumGroupPublicPrivate;
144
145
    /**
146
     * @var int
147
     * @Gedmo\SortablePosition
148
     *
149
     * @ORM\Column(name="forum_order", type="integer", nullable=true)
150
     */
151
    protected $forumOrder;
152
153
    /**
154
     * @var int
155
     *
156
     * @ORM\Column(name="locked", type="integer", nullable=false)
157
     */
158
    protected $locked;
159
160
    /**
161
     * @var int
162
     *
163
     * @ORM\Column(name="session_id", type="integer", nullable=false)
164
     */
165
    protected $sessionId;
166
167
    /**
168
     * @var string
169
     *
170
     * @ORM\Column(name="forum_image", type="string", length=255, nullable=false)
171
     */
172
    protected $forumImage;
173
174
    /**
175
     * @var \DateTime
176
     *
177
     * @ORM\Column(name="start_time", type="datetime", nullable=true)
178
     */
179
    protected $startTime;
180
181
    /**
182
     * @var \DateTime
183
     *
184
     * @ORM\Column(name="end_time", type="datetime", nullable=true)
185
     */
186
    protected $endTime;
187
188
    /**
189
     * @var int
190
     *
191
     * @ORM\Column(name="lp_id", type="integer", options={"unsigned":true})
192
     */
193
    protected $lpId;
194
195
    /**
196
     * @var bool
197
     *
198
     * @ORM\Column(name="moderated", type="boolean", nullable=true)
199
     */
200
    protected $moderated;
201
202
    /**
203
     * @var ArrayCollection
204
     *
205
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumThread", mappedBy="forum")
206
     */
207
    protected $threads;
208
209
    /**
210
     * @var CForumPost[]
211
     *
212
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", mappedBy="forum")
213
     */
214
    protected $posts;
215
216
    /**
217
     * CForumForum constructor.
218
     */
219
    public function __construct()
220
    {
221
        $this->locked = 0;
222
        $this->forumImage = '';
223
        $this->forumOfGroup = 0;
224
        $this->forumPosts = 0;
225
        $this->forumGroupPublicPrivate = '';
226
    }
227
228
    public function __toString(): string
229
    {
230
        return $this->getForumTitle();
231
    }
232
233
    /**
234
     * Set forumTitle.
235
     *
236
     * @param string $forumTitle
237
     *
238
     * @return CForumForum
239
     */
240
    public function setForumTitle($forumTitle)
241
    {
242
        $this->forumTitle = $forumTitle;
243
244
        return $this;
245
    }
246
247
    /**
248
     * Get forumTitle.
249
     *
250
     * @return string
251
     */
252
    public function getForumTitle()
253
    {
254
        return $this->forumTitle;
255
    }
256
257
    /**
258
     * Set forumComment.
259
     *
260
     * @param string $forumComment
261
     *
262
     * @return CForumForum
263
     */
264
    public function setForumComment($forumComment)
265
    {
266
        $this->forumComment = $forumComment;
267
268
        return $this;
269
    }
270
271
    /**
272
     * Get forumComment.
273
     *
274
     * @return string
275
     */
276
    public function getForumComment()
277
    {
278
        return $this->forumComment;
279
    }
280
281
    /**
282
     * Set forumThreads.
283
     *
284
     * @param int $forumThreads
285
     *
286
     * @return CForumForum
287
     */
288
    public function setForumThreads($forumThreads)
289
    {
290
        $this->forumThreads = $forumThreads;
291
292
        return $this;
293
    }
294
295
    /**
296
     * Get forumThreads.
297
     *
298
     * @return int
299
     */
300
    public function getForumThreads()
301
    {
302
        return $this->forumThreads;
303
    }
304
305
    /**
306
     * Set forumPosts.
307
     *
308
     * @param int $forumPosts
309
     *
310
     * @return CForumForum
311
     */
312
    public function setForumPosts($forumPosts)
313
    {
314
        $this->forumPosts = $forumPosts;
315
316
        return $this;
317
    }
318
319
    /**
320
     * Get forumPosts.
321
     *
322
     * @return int
323
     */
324
    public function getForumPosts()
325
    {
326
        return $this->forumPosts;
327
    }
328
329
    /**
330
     * Set forumLastPost.
331
     *
332
     * @param int $forumLastPost
333
     *
334
     * @return CForumForum
335
     */
336
    public function setForumLastPost($forumLastPost)
337
    {
338
        $this->forumLastPost = $forumLastPost;
339
340
        return $this;
341
    }
342
343
    /**
344
     * Get forumLastPost.
345
     *
346
     * @return int
347
     */
348
    public function getForumLastPost()
349
    {
350
        return $this->forumLastPost;
351
    }
352
353
    /**
354
     * Set forumCategory.
355
     *
356
     * @return CForumForum
357
     */
358
    public function setForumCategory(CForumCategory $forumCategory = null)
359
    {
360
        $this->forumCategory = $forumCategory;
361
362
        return $this;
363
    }
364
365
    /**
366
     * Get forumCategory.
367
     *
368
     * @return CForumCategory|null
369
     */
370
    public function getForumCategory()
371
    {
372
        return $this->forumCategory;
373
    }
374
375
    /**
376
     * Set allowAnonymous.
377
     *
378
     * @param int $allowAnonymous
379
     *
380
     * @return CForumForum
381
     */
382
    public function setAllowAnonymous($allowAnonymous)
383
    {
384
        $this->allowAnonymous = $allowAnonymous;
385
386
        return $this;
387
    }
388
389
    /**
390
     * Get allowAnonymous.
391
     *
392
     * @return int
393
     */
394
    public function getAllowAnonymous()
395
    {
396
        return $this->allowAnonymous;
397
    }
398
399
    /**
400
     * Set allowEdit.
401
     *
402
     * @param int $allowEdit
403
     *
404
     * @return CForumForum
405
     */
406
    public function setAllowEdit($allowEdit)
407
    {
408
        $this->allowEdit = $allowEdit;
409
410
        return $this;
411
    }
412
413
    /**
414
     * Get allowEdit.
415
     *
416
     * @return int
417
     */
418
    public function getAllowEdit()
419
    {
420
        return $this->allowEdit;
421
    }
422
423
    /**
424
     * Set approvalDirectPost.
425
     *
426
     * @param string $approvalDirectPost
427
     *
428
     * @return CForumForum
429
     */
430
    public function setApprovalDirectPost($approvalDirectPost)
431
    {
432
        $this->approvalDirectPost = $approvalDirectPost;
433
434
        return $this;
435
    }
436
437
    /**
438
     * Get approvalDirectPost.
439
     *
440
     * @return string
441
     */
442
    public function getApprovalDirectPost()
443
    {
444
        return $this->approvalDirectPost;
445
    }
446
447
    /**
448
     * Set allowAttachments.
449
     *
450
     * @param int $allowAttachments
451
     *
452
     * @return CForumForum
453
     */
454
    public function setAllowAttachments($allowAttachments)
455
    {
456
        $this->allowAttachments = $allowAttachments;
457
458
        return $this;
459
    }
460
461
    /**
462
     * Get allowAttachments.
463
     *
464
     * @return int
465
     */
466
    public function getAllowAttachments()
467
    {
468
        return $this->allowAttachments;
469
    }
470
471
    /**
472
     * Set allowNewThreads.
473
     *
474
     * @param int $allowNewThreads
475
     *
476
     * @return CForumForum
477
     */
478
    public function setAllowNewThreads($allowNewThreads)
479
    {
480
        $this->allowNewThreads = $allowNewThreads;
481
482
        return $this;
483
    }
484
485
    /**
486
     * Get allowNewThreads.
487
     *
488
     * @return int
489
     */
490
    public function getAllowNewThreads()
491
    {
492
        return $this->allowNewThreads;
493
    }
494
495
    /**
496
     * Set defaultView.
497
     *
498
     * @param string $defaultView
499
     *
500
     * @return CForumForum
501
     */
502
    public function setDefaultView($defaultView)
503
    {
504
        $this->defaultView = $defaultView;
505
506
        return $this;
507
    }
508
509
    /**
510
     * Get defaultView.
511
     *
512
     * @return string
513
     */
514
    public function getDefaultView()
515
    {
516
        return $this->defaultView;
517
    }
518
519
    /**
520
     * Set forumOfGroup.
521
     *
522
     * @param string $forumOfGroup
523
     *
524
     * @return CForumForum
525
     */
526
    public function setForumOfGroup($forumOfGroup)
527
    {
528
        $this->forumOfGroup = $forumOfGroup;
529
530
        return $this;
531
    }
532
533
    /**
534
     * Get forumOfGroup.
535
     *
536
     * @return string
537
     */
538
    public function getForumOfGroup()
539
    {
540
        return $this->forumOfGroup;
541
    }
542
543
    public function getForumGroupPublicPrivate(): string
544
    {
545
        return $this->forumGroupPublicPrivate;
546
    }
547
548
    /**
549
     * @return $this
550
     */
551
    public function setForumGroupPublicPrivate(string $forumGroupPublicPrivate)
552
    {
553
        $this->forumGroupPublicPrivate = $forumGroupPublicPrivate;
554
555
        return $this;
556
    }
557
558
    /**
559
     * Set forumOrder.
560
     *
561
     * @param int $forumOrder
562
     *
563
     * @return CForumForum
564
     */
565
    public function setForumOrder($forumOrder)
566
    {
567
        $this->forumOrder = $forumOrder;
568
569
        return $this;
570
    }
571
572
    /**
573
     * Get forumOrder.
574
     *
575
     * @return int
576
     */
577
    public function getForumOrder()
578
    {
579
        return $this->forumOrder;
580
    }
581
582
    /**
583
     * Set locked.
584
     *
585
     * @param int $locked
586
     *
587
     * @return CForumForum
588
     */
589
    public function setLocked($locked)
590
    {
591
        $this->locked = $locked;
592
593
        return $this;
594
    }
595
596
    /**
597
     * Get locked.
598
     *
599
     * @return int
600
     */
601
    public function getLocked()
602
    {
603
        return $this->locked;
604
    }
605
606
    /**
607
     * Set sessionId.
608
     *
609
     * @param int $sessionId
610
     *
611
     * @return CForumForum
612
     */
613
    public function setSessionId($sessionId)
614
    {
615
        $this->sessionId = $sessionId;
616
617
        return $this;
618
    }
619
620
    /**
621
     * Get sessionId.
622
     *
623
     * @return int
624
     */
625
    public function getSessionId()
626
    {
627
        return $this->sessionId;
628
    }
629
630
    /**
631
     * Set forumImage.
632
     *
633
     * @param string $forumImage
634
     *
635
     * @return CForumForum
636
     */
637
    public function setForumImage($forumImage)
638
    {
639
        $this->forumImage = $forumImage;
640
641
        return $this;
642
    }
643
644
    /**
645
     * Get forumImage.
646
     *
647
     * @return string
648
     */
649
    public function getForumImage()
650
    {
651
        return $this->forumImage;
652
    }
653
654
    /**
655
     * Set startTime.
656
     *
657
     * @param \DateTime $startTime
658
     *
659
     * @return CForumForum
660
     */
661
    public function setStartTime($startTime)
662
    {
663
        $this->startTime = $startTime;
664
665
        return $this;
666
    }
667
668
    /**
669
     * Get startTime.
670
     *
671
     * @return \DateTime
672
     */
673
    public function getStartTime()
674
    {
675
        return $this->startTime;
676
    }
677
678
    /**
679
     * Set endTime.
680
     *
681
     * @param \DateTime $endTime
682
     *
683
     * @return CForumForum
684
     */
685
    public function setEndTime($endTime)
686
    {
687
        $this->endTime = $endTime;
688
689
        return $this;
690
    }
691
692
    /**
693
     * Get endTime.
694
     *
695
     * @return \DateTime
696
     */
697
    public function getEndTime()
698
    {
699
        return $this->endTime;
700
    }
701
702
    /**
703
     * Set cId.
704
     *
705
     * @param int $cId
706
     *
707
     * @return CForumForum
708
     */
709
    public function setCId($cId)
710
    {
711
        $this->cId = $cId;
712
713
        return $this;
714
    }
715
716
    /**
717
     * Get cId.
718
     *
719
     * @return int
720
     */
721
    public function getCId()
722
    {
723
        return $this->cId;
724
    }
725
726
    /**
727
     * Set lpId.
728
     *
729
     * @param int $lpId
730
     *
731
     * @return CForumForum
732
     */
733
    public function setLpId($lpId)
734
    {
735
        $this->lpId = $lpId;
736
737
        return $this;
738
    }
739
740
    /**
741
     * Get lpId.
742
     *
743
     * @return int
744
     */
745
    public function getLpId()
746
    {
747
        return $this->lpId;
748
    }
749
750
    /**
751
     * @return bool
752
     */
753
    public function isModerated()
754
    {
755
        return $this->moderated;
756
    }
757
758
    /**
759
     * @param $moderated
760
     *
761
     * @return $this
762
     */
763
    public function setModerated($moderated)
764
    {
765
        $this->moderated = $moderated;
766
767
        return $this;
768
    }
769
770
    /**
771
     * Get iid.
772
     *
773
     * @return int
774
     */
775
    public function getIid()
776
    {
777
        return $this->iid;
778
    }
779
780
    /**
781
     * Get threads.
782
     *
783
     * @return ArrayCollection|CForumThread[]
784
     */
785
    public function getThreads()
786
    {
787
        return $this->threads;
788
    }
789
790
    /**
791
     * Resource identifier.
792
     */
793
    public function getResourceIdentifier(): int
794
    {
795
        return $this->getIid();
796
    }
797
798
    public function getResourceName(): string
799
    {
800
        return $this->getForumTitle();
801
    }
802
}
803