Completed
Push — master ( db9c88...be5baf )
by Julito
14:58
created

CStudentPublication::getUrl()   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 Chamilo\CoreBundle\Entity\Session;
10
use Doctrine\ORM\Mapping as ORM;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * CStudentPublication.
15
 *
16
 * @ORM\Table(
17
 *  name="c_student_publication",
18
 *  indexes={
19
 *      @ORM\Index(name="course", columns={"c_id"}),
20
 *      @ORM\Index(name="session_id", columns={"session_id"}),
21
 *      @ORM\Index(name="idx_csp_u", columns={"user_id"})
22
 *  }
23
 * )
24
 * @ORM\Entity()
25
 */
26
class CStudentPublication extends AbstractResource implements ResourceInterface
27
{
28
    /**
29
     * @var int
30
     *
31
     * @ORM\Column(name="iid", type="integer")
32
     * @ORM\Id
33
     * @ORM\GeneratedValue
34
     */
35
    protected $iid;
36
37
    /**
38
     * @var int
39
     *
40
     * @ORM\Column(name="c_id", type="integer")
41
     */
42
    protected $cId;
43
44
    /**
45
     * @var string
46
     *
47
     * @ORM\Column(name="url", type="string", length=500, nullable=true)
48
     */
49
    protected $url;
50
51
    /**
52
     * @var string
53
     *
54
     * @ORM\Column(name="url_correction", type="string", length=500, nullable=true)
55
     */
56
    protected $urlCorrection;
57
58
    /**
59
     * @var string
60
     * @Assert\NotBlank()
61
     * @ORM\Column(name="title", type="string", length=255, nullable=true)
62
     */
63
    protected $title;
64
65
    /**
66
     * @var string
67
     *
68
     * @ORM\Column(name="title_correction", type="string", length=255, nullable=true)
69
     */
70
    protected $titleCorrection;
71
72
    /**
73
     * @var string
74
     *
75
     * @ORM\Column(name="description", type="text", nullable=true)
76
     */
77
    protected $description;
78
79
    /**
80
     * @var string
81
     *
82
     * @ORM\Column(name="author", type="string", length=255, nullable=true)
83
     */
84
    protected $author;
85
86
    /**
87
     * @var bool
88
     *
89
     * @ORM\Column(name="active", type="integer", nullable=true)
90
     */
91
    protected $active;
92
93
    /**
94
     * @var bool
95
     *
96
     * @ORM\Column(name="accepted", type="boolean", nullable=true)
97
     */
98
    protected $accepted;
99
100
    /**
101
     * @var int
102
     *
103
     * @ORM\Column(name="post_group_id", type="integer", nullable=false)
104
     */
105
    protected $postGroupId;
106
107
    /**
108
     * @var \DateTime
109
     *
110
     * @ORM\Column(name="sent_date", type="datetime", nullable=true)
111
     */
112
    protected $sentDate;
113
114
    /**
115
     * @var string
116
     *
117
     * @ORM\Column(name="filetype", type="string", length=10, nullable=false)
118
     */
119
    protected $filetype;
120
121
    /**
122
     * @var int
123
     *
124
     * @ORM\Column(name="has_properties", type="integer", nullable=false)
125
     */
126
    protected $hasProperties;
127
128
    /**
129
     * @var bool
130
     *
131
     * @ORM\Column(name="view_properties", type="boolean", nullable=true)
132
     */
133
    protected $viewProperties;
134
135
    /**
136
     * @var float
137
     *
138
     * @ORM\Column(name="qualification", type="float", precision=6, scale=2, nullable=false)
139
     */
140
    protected $qualification;
141
142
    /**
143
     * @var \DateTime
144
     *
145
     * @ORM\Column(name="date_of_qualification", type="datetime", nullable=true)
146
     */
147
    protected $dateOfQualification;
148
149
    /**
150
     * @var int
151
     *
152
     * @ORM\Column(name="parent_id", type="integer", nullable=false)
153
     */
154
    protected $parentId;
155
156
    /**
157
     * @var int
158
     *
159
     * @ORM\Column(name="qualificator_id", type="integer", nullable=false)
160
     */
161
    protected $qualificatorId;
162
163
    /**
164
     * @var float
165
     *
166
     * @ORM\Column(name="weight", type="float", precision=6, scale=2, nullable=false)
167
     */
168
    protected $weight;
169
170
    /**
171
     * @var Session
172
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session", inversedBy="studentPublications")
173
     * @ORM\JoinColumn(name="session_id", referencedColumnName="id")
174
     */
175
    protected $session;
176
177
    /**
178
     * @var int
179
     *
180
     * @ORM\Column(name="user_id", type="integer", nullable=false)
181
     */
182
    protected $userId;
183
184
    /**
185
     * @var int
186
     *
187
     * @ORM\Column(name="allow_text_assignment", type="integer", nullable=false)
188
     */
189
    protected $allowTextAssignment;
190
191
    /**
192
     * @var int
193
     *
194
     * @ORM\Column(name="contains_file", type="integer", nullable=false)
195
     */
196
    protected $containsFile;
197
198
    /**
199
     * @var int
200
     *
201
     * @ORM\Column(name="document_id", type="integer", nullable=false)
202
     */
203
    protected $documentId;
204
205
    /**
206
     * @var int
207
     *
208
     * @ORM\Column(name="filesize", type="integer", nullable=true)
209
     */
210
    protected $fileSize;
211
212
    public function __construct()
213
    {
214
        $this->documentId = 0;
215
        $this->hasProperties = 0;
216
        $this->containsFile = 0;
217
        $this->parentId = 0;
218
        $this->qualificatorId = 0;
219
        $this->qualification = 0;
220
        $this->sentDate = new \DateTime();
221
    }
222
223
    public function __toString(): string
224
    {
225
        return (string) $this->getTitle();
226
    }
227
228
    /**
229
     * Set url.
230
     *
231
     * @param string $url
232
     *
233
     * @return CStudentPublication
234
     */
235
    public function setUrl($url)
236
    {
237
        $this->url = $url;
238
239
        return $this;
240
    }
241
242
    /**
243
     * Get url.
244
     *
245
     * @return string
246
     */
247
    public function getUrl()
248
    {
249
        return $this->url;
250
    }
251
252
    /**
253
     * Set title.
254
     *
255
     * @param string $title
256
     *
257
     * @return CStudentPublication
258
     */
259
    public function setTitle($title)
260
    {
261
        $this->title = $title;
262
263
        return $this;
264
    }
265
266
    /**
267
     * Get title.
268
     *
269
     * @return string
270
     */
271
    public function getTitle()
272
    {
273
        return $this->title;
274
    }
275
276
    /**
277
     * Set description.
278
     *
279
     * @param string $description
280
     *
281
     * @return CStudentPublication
282
     */
283
    public function setDescription($description)
284
    {
285
        $this->description = $description;
286
287
        return $this;
288
    }
289
290
    /**
291
     * Get description.
292
     *
293
     * @return string
294
     */
295
    public function getDescription()
296
    {
297
        return $this->description;
298
    }
299
300
    /**
301
     * Set author.
302
     *
303
     * @param string $author
304
     *
305
     * @return CStudentPublication
306
     */
307
    public function setAuthor($author)
308
    {
309
        $this->author = $author;
310
311
        return $this;
312
    }
313
314
    /**
315
     * Get author.
316
     *
317
     * @return string
318
     */
319
    public function getAuthor()
320
    {
321
        return $this->author;
322
    }
323
324
    /**
325
     * Set active.
326
     *
327
     * @param int $active
328
     *
329
     * @return CStudentPublication
330
     */
331
    public function setActive($active)
332
    {
333
        $this->active = (int) $active;
0 ignored issues
show
Documentation Bug introduced by
The property $active was declared of type boolean, but (int)$active 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...
334
335
        return $this;
336
    }
337
338
    /**
339
     * Get active.
340
     *
341
     * @return bool
342
     */
343
    public function getActive()
344
    {
345
        return $this->active;
346
    }
347
348
    /**
349
     * Set accepted.
350
     *
351
     * @param bool $accepted
352
     *
353
     * @return CStudentPublication
354
     */
355
    public function setAccepted($accepted)
356
    {
357
        $this->accepted = $accepted;
358
359
        return $this;
360
    }
361
362
    /**
363
     * Get accepted.
364
     *
365
     * @return bool
366
     */
367
    public function getAccepted()
368
    {
369
        return $this->accepted;
370
    }
371
372
    /**
373
     * Set postGroupId.
374
     *
375
     * @param int $postGroupId
376
     *
377
     * @return CStudentPublication
378
     */
379
    public function setPostGroupId($postGroupId)
380
    {
381
        $this->postGroupId = $postGroupId;
382
383
        return $this;
384
    }
385
386
    /**
387
     * Get postGroupId.
388
     *
389
     * @return int
390
     */
391
    public function getPostGroupId()
392
    {
393
        return $this->postGroupId;
394
    }
395
396
    /**
397
     * Set sentDate.
398
     *
399
     * @param \DateTime $sentDate
400
     *
401
     * @return CStudentPublication
402
     */
403
    public function setSentDate($sentDate)
404
    {
405
        $this->sentDate = $sentDate;
406
407
        return $this;
408
    }
409
410
    /**
411
     * Get sentDate.
412
     *
413
     * @return \DateTime
414
     */
415
    public function getSentDate()
416
    {
417
        return $this->sentDate;
418
    }
419
420
    /**
421
     * Set filetype.
422
     *
423
     * @param string $filetype
424
     *
425
     * @return CStudentPublication
426
     */
427
    public function setFiletype($filetype)
428
    {
429
        $this->filetype = $filetype;
430
431
        return $this;
432
    }
433
434
    /**
435
     * Get filetype.
436
     *
437
     * @return string
438
     */
439
    public function getFiletype()
440
    {
441
        return $this->filetype;
442
    }
443
444
    /**
445
     * Set hasProperties.
446
     *
447
     * @param int $hasProperties
448
     *
449
     * @return CStudentPublication
450
     */
451
    public function setHasProperties($hasProperties)
452
    {
453
        $this->hasProperties = $hasProperties;
454
455
        return $this;
456
    }
457
458
    /**
459
     * Get hasProperties.
460
     *
461
     * @return int
462
     */
463
    public function getHasProperties()
464
    {
465
        return $this->hasProperties;
466
    }
467
468
    /**
469
     * Set viewProperties.
470
     *
471
     * @param bool $viewProperties
472
     *
473
     * @return CStudentPublication
474
     */
475
    public function setViewProperties($viewProperties)
476
    {
477
        $this->viewProperties = $viewProperties;
478
479
        return $this;
480
    }
481
482
    /**
483
     * Get viewProperties.
484
     *
485
     * @return bool
486
     */
487
    public function getViewProperties()
488
    {
489
        return $this->viewProperties;
490
    }
491
492
    /**
493
     * Set qualification.
494
     *
495
     * @param float $qualification
496
     *
497
     * @return CStudentPublication
498
     */
499
    public function setQualification($qualification)
500
    {
501
        $this->qualification = $qualification;
502
503
        return $this;
504
    }
505
506
    /**
507
     * Get qualification.
508
     *
509
     * @return float
510
     */
511
    public function getQualification()
512
    {
513
        return $this->qualification;
514
    }
515
516
    /**
517
     * Set dateOfQualification.
518
     *
519
     * @param \DateTime $dateOfQualification
520
     *
521
     * @return CStudentPublication
522
     */
523
    public function setDateOfQualification($dateOfQualification)
524
    {
525
        $this->dateOfQualification = $dateOfQualification;
526
527
        return $this;
528
    }
529
530
    /**
531
     * Get dateOfQualification.
532
     *
533
     * @return \DateTime
534
     */
535
    public function getDateOfQualification()
536
    {
537
        return $this->dateOfQualification;
538
    }
539
540
    /**
541
     * Set parentId.
542
     *
543
     * @param int $parentId
544
     *
545
     * @return CStudentPublication
546
     */
547
    public function setParentId($parentId)
548
    {
549
        $this->parentId = $parentId;
550
551
        return $this;
552
    }
553
554
    /**
555
     * Get parentId.
556
     *
557
     * @return int
558
     */
559
    public function getParentId()
560
    {
561
        return $this->parentId;
562
    }
563
564
    /**
565
     * Set qualificatorId.
566
     *
567
     * @param int $qualificatorId
568
     *
569
     * @return CStudentPublication
570
     */
571
    public function setQualificatorId($qualificatorId)
572
    {
573
        $this->qualificatorId = $qualificatorId;
574
575
        return $this;
576
    }
577
578
    /**
579
     * Get qualificatorId.
580
     */
581
    public function getQualificatorId(): int
582
    {
583
        return (int) $this->qualificatorId;
584
    }
585
586
    /**
587
     * Set weight.
588
     *
589
     * @param float $weight
590
     *
591
     * @return CStudentPublication
592
     */
593
    public function setWeight($weight)
594
    {
595
        $this->weight = $weight;
596
597
        return $this;
598
    }
599
600
    /**
601
     * Get weight.
602
     *
603
     * @return float
604
     */
605
    public function getWeight()
606
    {
607
        return $this->weight;
608
    }
609
610
    /**
611
     * Set session.
612
     *
613
     * @param Session $session
614
     *
615
     * @return CStudentPublication
616
     */
617
    public function setSession(Session $session = null)
618
    {
619
        $this->session = $session;
620
621
        return $this;
622
    }
623
624
    /**
625
     * Get session.
626
     *
627
     * @return Session
628
     */
629
    public function getSession()
630
    {
631
        return $this->session;
632
    }
633
634
    /**
635
     * Set userId.
636
     *
637
     * @param int $userId
638
     *
639
     * @return CStudentPublication
640
     */
641
    public function setUserId($userId)
642
    {
643
        $this->userId = $userId;
644
645
        return $this;
646
    }
647
648
    /**
649
     * Get userId.
650
     *
651
     * @return int
652
     */
653
    public function getUserId()
654
    {
655
        return $this->userId;
656
    }
657
658
    /**
659
     * Set allowTextAssignment.
660
     *
661
     * @param int $allowTextAssignment
662
     *
663
     * @return CStudentPublication
664
     */
665
    public function setAllowTextAssignment($allowTextAssignment)
666
    {
667
        $this->allowTextAssignment = $allowTextAssignment;
668
669
        return $this;
670
    }
671
672
    /**
673
     * Get allowTextAssignment.
674
     *
675
     * @return int
676
     */
677
    public function getAllowTextAssignment()
678
    {
679
        return $this->allowTextAssignment;
680
    }
681
682
    /**
683
     * Set containsFile.
684
     *
685
     * @param int $containsFile
686
     *
687
     * @return CStudentPublication
688
     */
689
    public function setContainsFile($containsFile)
690
    {
691
        $this->containsFile = $containsFile;
692
693
        return $this;
694
    }
695
696
    /**
697
     * Get containsFile.
698
     *
699
     * @return int
700
     */
701
    public function getContainsFile()
702
    {
703
        return $this->containsFile;
704
    }
705
706
    public function setCId(int $cId)
707
    {
708
        $this->cId = $cId;
709
710
        return $this;
711
    }
712
713
    /**
714
     * Get cId.
715
     *
716
     * @return int
717
     */
718
    public function getCId()
719
    {
720
        return $this->cId;
721
    }
722
723
    /**
724
     * @return string
725
     */
726
    public function getUrlCorrection()
727
    {
728
        return $this->urlCorrection;
729
    }
730
731
    /**
732
     * @param string $urlCorrection
733
     */
734
    public function setUrlCorrection($urlCorrection)
735
    {
736
        $this->urlCorrection = $urlCorrection;
737
738
        return $this;
739
    }
740
741
    /**
742
     * @return string
743
     */
744
    public function getTitleCorrection()
745
    {
746
        return $this->titleCorrection;
747
    }
748
749
    /**
750
     * @param string $titleCorrection
751
     */
752
    public function setTitleCorrection($titleCorrection)
753
    {
754
        $this->titleCorrection = $titleCorrection;
755
756
        return $this;
757
    }
758
759
    /**
760
     * @return int
761
     */
762
    public function getDocumentId()
763
    {
764
        return $this->documentId;
765
    }
766
767
    /**
768
     * @param int $documentId
769
     */
770
    public function setDocumentId($documentId)
771
    {
772
        $this->documentId = $documentId;
773
774
        return $this;
775
    }
776
777
    /**
778
     * Get iid.
779
     *
780
     * @return int
781
     */
782
    public function getIid()
783
    {
784
        return $this->iid;
785
    }
786
787
    public function getFileSize(): int
788
    {
789
        return $this->fileSize;
790
    }
791
792
    public function setFileSize(int $fileSize): self
793
    {
794
        $this->fileSize = $fileSize;
795
796
        return $this;
797
    }
798
799
    /**
800
     * Resource identifier.
801
     */
802
    public function getResourceIdentifier(): int
803
    {
804
        return $this->getIid();
805
    }
806
807
    public function getResourceName(): string
808
    {
809
        return $this->getTitle();
810
    }
811
812
    public function setResourceName(string $name): self
813
    {
814
        return $this->setTitle($name);
815
    }
816
}
817