Completed
Pull Request — master (#3464)
by Julito
14:18 queued 01:15
created

User::getPassword()   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 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Entity;
6
7
use ApiPlatform\Core\Annotation\ApiFilter;
8
use ApiPlatform\Core\Annotation\ApiProperty;
9
use ApiPlatform\Core\Annotation\ApiResource;
10
use ApiPlatform\Core\Annotation\ApiSubresource;
11
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
12
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
13
use Doctrine\Common\Collections\ArrayCollection;
14
use Doctrine\Common\Collections\Collection;
15
use Doctrine\Common\Collections\Criteria;
16
use Doctrine\ORM\Event\LifecycleEventArgs;
17
use Doctrine\ORM\Mapping as ORM;
18
use Ramsey\Uuid\Uuid;
19
use Ramsey\Uuid\UuidInterface;
20
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
21
use Symfony\Component\Security\Core\User\EquatableInterface;
22
use Symfony\Component\Security\Core\User\UserInterface;
23
use Symfony\Component\Serializer\Annotation\Groups;
24
use Symfony\Component\Validator\Constraints as Assert;
25
use Symfony\Component\Validator\Mapping\ClassMetadata;
26
27
/**
28
 * @ApiResource(
29
 *      attributes={"security"="is_granted('ROLE_ADMIN')"},
30
 *      iri="http://schema.org/Person",
31
 *      normalizationContext={"groups"={"user:read"}},
32
 *      denormalizationContext={"groups"={"user:write"}},
33
 *      collectionOperations={"get"},
34
 *      itemOperations={
35
 *          "get"={},
36
 *          "put"={},
37
 *          "delete"={},
38
 *     }
39
 * )
40
 *
41
 * @ApiFilter(SearchFilter::class, properties={"username": "partial", "firstname" : "partial"})
42
 * @ApiFilter(BooleanFilter::class, properties={"isActive"})
43
 *
44
 * @ORM\HasLifecycleCallbacks
45
 * @ORM\Table(
46
 *  name="user",
47
 *  indexes={
48
 *      @ORM\Index(name="status", columns={"status"})
49
 *  }
50
 * )
51
 * @UniqueEntity("username")
52
 * @ORM\Entity
53
 */
54
class User implements UserInterface, EquatableInterface
55
{
56
    public const ROLE_DEFAULT = 'ROLE_USER';
57
    public const ROLE_SUPER_ADMIN = 'ROLE_SUPER_ADMIN';
58
59
    public const COURSE_MANAGER = 1;
60
    public const TEACHER = 1;
61
    public const SESSION_ADMIN = 3;
62
    public const DRH = 4;
63
    public const STUDENT = 5;
64
    public const ANONYMOUS = 6;
65
66
    /**
67
     * @var int
68
     * @Groups({"user:read", "resource_node:read"})
69
     * @ORM\Column(name="id", type="integer")
70
     * @ORM\Id
71
     * @ORM\GeneratedValue(strategy="AUTO")
72
     */
73
    protected $id;
74
75
    /**
76
     * @var UuidInterface|null
77
     *
78
     * @ORM\Column(type="uuid", unique=true)
79
     */
80
    protected $uuid;
81
82
    /**
83
     * @ORM\Column(type="string", unique=true, nullable=true)
84
     */
85
    protected $apiToken;
86
87
    /**
88
     * @var string
89
     * @Assert\NotBlank()
90
     * @ApiProperty(iri="http://schema.org/name")
91
     * @Groups({"user:read", "user:write", "resource_node:read"})
92
     * @ORM\Column(name="firstname", type="string", length=64, nullable=true, unique=false)
93
     */
94
    protected $firstname;
95
96
    /**
97
     * @var string
98
     * @Groups({"user:read", "user:write", "resource_node:read"})
99
     * @ORM\Column(name="lastname", type="string", length=64, nullable=true, unique=false)
100
     */
101
    protected $lastnamt
102
103
    /**
104
     * @var string
105
     * @Groups({"user:read", "user:write"})
106
     * @ORM\Column(name="website", type="string", length=64, nullable=true)
107
     */
108
    protected $website;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_PROTECTED, expecting ',' or ';' on line 108 at column 4
Loading history...
109
110
    /**
111
     * @var string
112
     * @Groups({"user:read", "user:write"})
113
     * @ORM\Column(name="biography", type="text", nullable=true)
114
     */
115
    protected $biography;
116
117
    /**
118
     * @var string
119
     * @Groups({"user:read", "user:write"})
120
     * @ORM\Column(name="locale", type="string", length=8, nullable=true, unique=false)
121
     */
122
    protected $locale;
123
124
    /**
125
     * @var string
126
     * @Groups({"user:read", "user:write", "course:read", "resource_node:read"})
127
     * @Assert\NotBlank()
128
     * @ORM\Column(name="username", type="string", length=100, nullable=false, unique=true)
129
     */
130
    protected $username;
131
132
    /**
133
     * @var string|null
134
     */
135
    protected $plainPassword;
136
137
    /**
138
     * @var string
139
     * @ORM\Column(name="password", type="string", length=255, nullable=false, unique=false)
140
     */
141
    protected $password;
142
143
    /**
144
     * @var string
145
     *
146
     * @ORM\Column(name="username_canonical", type="string", length=180, nullable=false)
147
     */
148
    protected $usernameCanonical;
149
150
    /**
151
     * @var string
152
     * @Groups({"user:read", "user:write"})
153
     * @ORM\Column(name="timezone", type="string", length=64)
154
     */
155
    protected $timezone;
156
157
    /**
158
     * @var string
159
     * @ORM\Column(name="email_canonical", type="string", length=100, nullable=false, unique=false)
160
     */
161
    protected $emailCanonical;
162
163
    /**
164
     * @var string
165
     * @var string
166
     * @Groups({"user:read", "user:write"})
167
     * @Assert\NotBlank()
168
     * @Assert\Email()
169
     *
170
     * @ORM\Column(name="email", type="string", length=100, nullable=false, unique=false)
171
     */
172
    protected $email;
173
174
    /**
175
     * @var bool
176
     *
177
     * @ORM\Column(name="locked", type="boolean")
178
     */
179
    protected $locked;
180
181
    /**
182
     * @var bool
183
     * @Assert\NotBlank()
184
     * @Groups({"user:read", "user:write"})
185
     * @ORM\Column(name="enabled", type="boolean")
186
     */
187
    protected $enabled;
188
189
    /**
190
     * @var bool
191
     * @Groups({"user:read", "user:write"})
192
     * @ORM\Column(name="expired", type="boolean")
193
     */
194
    protected $expired;
195
196
    /**
197
     * @var bool
198
     *
199
     * @ORM\Column(name="credentials_expired", type="boolean")
200
     */
201
    protected $credentialsExpired;
202
203
    /**
204
     * @var \DateTime
205
     *
206
     * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false)
207
     */
208
    protected $credentialsExpireAt;
209
210
    /**
211
     * @var \DateTime
212
     *
213
     * @ORM\Column(name="date_of_birth", type="datetime", nullable=true)
214
     */
215
    protected $dateOfBirth;
216
217
    /**
218
     * @var \DateTime
219
     * @Groups({"user:read", "user:write"})
220
     * @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false)
221
     */
222
    protected $expiresAt;
223
224
    /**
225
     * @var string
226
     * @Groups({"user:read", "user:write"})
227
     * @ORM\Column(name="phone", type="string", length=64, nullable=true, unique=false)
228
     */
229
    protected $phone;
230
231
    /**
232
     * @var string
233
     * @Groups({"user:read", "user:write"})
234
     * @ORM\Column(name="address", type="string", length=250, nullable=true, unique=false)
235
     */
236
    protected $address;
237
238
    /**
239
     * @var AccessUrl
240
     */
241
    protected $currentUrl;
242
243
    /**
244
     * @ORM\Column(type="string", length=255)
245
     */
246
    protected $salt;
247
248
    /**
249
     * @var \DateTime
250
     * @Groups({"user:read", "user:write"})
251
     * @ORM\Column(name="last_login", type="datetime", nullable=true, unique=false)
252
     */
253
    protected $lastLogin;
254
255
    /**
256
     * Random string sent to the user email address in order to verify it.
257
     *
258
     * @var string
259
     * @ORM\Column(name="confirmation_token", type="string", length=255, nullable=true)
260
     */
261
    protected $confirmationToken;
262
263
    /**
264
     * @var \DateTime
265
     *
266
     * @ORM\Column(name="password_requested_at", type="datetime", nullable=true, unique=false)
267
     */
268
    protected $passwordRequestedAt;
269
270
    /**
271
     * @ApiSubresource()
272
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="user", orphanRemoval=true)
273
     */
274
    protected $courses;
275
276
    /**
277
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelUser", mappedBy="user")
278
     */
279
    protected $classes;
280
281
    /**
282
     * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxPost", mappedBy="user").
283
     */
284
    protected $dropBoxReceivedFiles;
285
286
    /**
287
     * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxFile", mappedBy="userSent").
288
     */
289
    protected $dropBoxSentFiles;
290
291
    /**
292
     * @Groups({"user:read", "user:write"})
293
     * @ORM\Column(type="array")
294
     */
295
    protected $roles;
296
297
    /**
298
     * @var bool
299
     *
300
     * @ORM\Column(name="profile_completed", type="boolean", nullable=true)
301
     */
302
    protected $profileCompleted;
303
304
    /**
305
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\JuryMembers", mappedBy="user")
306
     */
307
    //protected $jurySubscriptions;
308
309
    /**
310
     * @var Group[]
311
     * @ORM\ManyToMany(targetEntity="Chamilo\CoreBundle\Entity\Group", inversedBy="users")
312
     * @ORM\JoinTable(
313
     *      name="fos_user_user_group",
314
     *      joinColumns={
315
     *          @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="cascade")
316
     *      },
317
     *      inverseJoinColumns={
318
     *          @ORM\JoinColumn(name="group_id", referencedColumnName="id")
319
     *      }
320
     * )
321
     */
322
    protected $groups;
323
324
    /**
325
     * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CurriculumItemRelUser", mappedBy="user").
326
     */
327
    protected $curriculumItems;
328
329
    /**
330
     * @ORM\OneToMany(
331
     *     targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUser",
332
     *     mappedBy="user",
333
     *     cascade={"persist", "remove"},
334
     *     orphanRemoval=true
335
     * )
336
     */
337
    protected $portals;
338
339
    /**
340
     * @var Admin
341
     * @ORM\OneToOne(
342
     *     targetEntity="Chamilo\CoreBundle\Entity\Admin",
343
     *     mappedBy="user",
344
     *     cascade={"persist", "remove"},
345
     *     orphanRemoval=true
346
     * )
347
     */
348
    protected $admin;
349
350
    /**
351
     * @var ArrayCollection
352
     * @ORM\OneToMany(
353
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookCertificate",
354
     *     mappedBy="user",
355
     *     cascade={"persist", "remove"},
356
     *     orphanRemoval=true
357
     * )
358
     */
359
    protected $gradebookCertificates;
360
361
    /**
362
     * @var ArrayCollection
363
     * @ORM\OneToMany(
364
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookEvaluation",
365
     *     mappedBy="user",
366
     *     cascade={"persist", "remove"},
367
     *     orphanRemoval=true
368
     * )
369
     */
370
    protected $gradebookEvaluations;
371
372
    /**
373
     * @var ArrayCollection
374
     * @ORM\OneToMany(
375
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookLink",
376
     *     mappedBy="user",
377
     *     cascade={"persist", "remove"},
378
     *     orphanRemoval=true
379
     * )
380
     */
381
    protected $gradebookLinks;
382
383
    /**
384
     * @var ArrayCollection
385
     * @ORM\OneToMany(
386
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookResult",
387
     *     mappedBy="user",
388
     *     cascade={"persist", "remove"},
389
     *     orphanRemoval=true
390
     * )
391
     */
392
    protected $gradebookResults;
393
394
    /**
395
     * @var ArrayCollection
396
     * @ORM\OneToMany(
397
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookResultLog",
398
     *     mappedBy="user",
399
     *     cascade={"persist", "remove"},
400
     *     orphanRemoval=true
401
     * )
402
     */
403
    protected $gradebookResultLogs;
404
405
    /**
406
     * @var ArrayCollection
407
     * @ORM\OneToMany(
408
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookScoreLog",
409
     *     mappedBy="user",
410
     *     cascade={"persist", "remove"},
411
     *     orphanRemoval=true
412
     * )
413
     */
414
    protected $gradebookScoreLogs;
415
416
    /**
417
     * @var ArrayCollection
418
     * @ORM\OneToMany(
419
     *     targetEntity="Chamilo\CoreBundle\Entity\SequenceValue",
420
     *     mappedBy="user",
421
     *     cascade={"persist", "remove"},
422
     *     orphanRemoval=true
423
     * )
424
     */
425
    protected $sequenceValues;
426
427
    /**
428
     * @var ArrayCollection
429
     * @ORM\OneToMany(
430
     *     targetEntity="Chamilo\CoreBundle\Entity\TrackEExerciseConfirmation",
431
     *     mappedBy="user",
432
     *     cascade={"persist", "remove"},
433
     *     orphanRemoval=true
434
     * )
435
     */
436
    protected $trackEExerciseConfirmations;
437
438
    /**
439
     * @var ArrayCollection
440
     * @ORM\OneToMany(
441
     *     targetEntity="Chamilo\CoreBundle\Entity\Templates",
442
     *     mappedBy="user",
443
     *     cascade={"persist", "remove"},
444
     *     orphanRemoval=true
445
     * )
446
     */
447
    protected $templates;
448
449
    /**
450
     * @var ArrayCollection
451
     * @ORM\OneToMany(
452
     *     targetEntity="Chamilo\CoreBundle\Entity\TrackEAttempt",
453
     *     mappedBy="user",
454
     *     cascade={"persist", "remove"},
455
     *     orphanRemoval=true
456
     * )
457
     */
458
    protected $trackEAttempts;
459
460
    /**
461
     * @var ArrayCollection
462
     * @ORM\OneToMany(
463
     *     targetEntity="Chamilo\CoreBundle\Entity\TrackECourseAccess",
464
     *     mappedBy="user",
465
     *     cascade={"persist", "remove"},
466
     *     orphanRemoval=true
467
     * )
468
     */
469
    protected $trackECourseAccess;
470
471
    /**
472
     * @var ArrayCollection
473
     * @ORM\OneToMany(
474
     *     targetEntity="Chamilo\CoreBundle\Entity\UserCourseCategory",
475
     *     mappedBy="user",
476
     *     cascade={"persist", "remove"},
477
     *     orphanRemoval=true
478
     * )
479
     */
480
    protected $userCourseCategorys;
481
482
    /**
483
     * @var ArrayCollection
484
     * @ORM\OneToMany(
485
     *     targetEntity="Chamilo\CoreBundle\Entity\UserRelCourseVote",
486
     *     mappedBy="user",
487
     *     cascade={"persist", "remove"},
488
     *     orphanRemoval=true
489
     * )
490
     */
491
    protected $userRelCourseVotes;
492
493
    /**
494
     * @var ArrayCollection
495
     * @ORM\OneToMany(
496
     *     targetEntity="Chamilo\CoreBundle\Entity\UserRelTag",
497
     *     mappedBy="user",
498
     *     cascade={"persist", "remove"},
499
     *     orphanRemoval=true
500
     * )
501
     */
502
    protected $userRelTags;
503
504
    /**
505
     * @var ArrayCollection
506
     * @ORM\OneToMany(
507
     *     targetEntity="Chamilo\CoreBundle\Entity\GradebookLinkevalLog",
508
     *     mappedBy="user",
509
     *     cascade={"persist", "remove"},
510
     *     orphanRemoval=true
511
     * )
512
     */
513
    protected $gradebookLinkevalLogs;
514
515
    /**
516
     * @var ArrayCollection
517
     * @ORM\OneToMany(
518
     *     targetEntity="Chamilo\CoreBundle\Entity\UserRelUser",
519
     *     mappedBy="user",
520
     *     cascade={"persist", "remove"},
521
     *     orphanRemoval=true
522
     * )
523
     */
524
    protected $userRelationships;
525
526
    /**
527
     * @var ArrayCollection
528
     * @ORM\OneToMany(
529
     *     targetEntity="Chamilo\CourseBundle\Entity\CAttendanceResult",
530
     *     mappedBy="user",
531
     *     cascade={"persist", "remove"},
532
     *     orphanRemoval=true
533
     * )
534
     */
535
    protected $cAttendanceResults;
536
537
    /**
538
     * @var ArrayCollection
539
     * @ORM\OneToMany(
540
     *     targetEntity="Chamilo\CourseBundle\Entity\CAttendanceSheet",
541
     *     mappedBy="user",
542
     *     cascade={"persist", "remove"},
543
     *     orphanRemoval=true
544
     * )
545
     */
546
    protected $cAttendanceSheets;
547
548
    /**
549
     * @var ArrayCollection
550
     * @ORM\OneToMany(
551
     *     targetEntity="Chamilo\CourseBundle\Entity\CBlogRating",
552
     *     mappedBy="user",
553
     *     cascade={"persist", "remove"},
554
     *     orphanRemoval=true
555
     * )
556
     */
557
    protected $cBlogRatings;
558
559
    /**
560
     * @var ArrayCollection
561
     * @ORM\OneToMany(
562
     *     targetEntity="Chamilo\CourseBundle\Entity\CBlogRelUser",
563
     *     mappedBy="user",
564
     *     cascade={"persist", "remove"},
565
     *     orphanRemoval=true
566
     * )
567
     */
568
    protected $cBlogRelUsers;
569
570
    /**
571
     * @var ArrayCollection
572
     * @ORM\OneToMany(
573
     *     targetEntity="Chamilo\CourseBundle\Entity\CBlogTaskRelUser",
574
     *     mappedBy="user",
575
     *     cascade={"persist", "remove"},
576
     *     orphanRemoval=true
577
     * )
578
     */
579
    protected $cBlogTaskRelUsers;
580
581
    /**
582
     * @var ArrayCollection
583
     * @ORM\OneToMany(
584
     *     targetEntity="Chamilo\CourseBundle\Entity\CChatConnected",
585
     *     mappedBy="user",
586
     *     cascade={"persist", "remove"},
587
     *     orphanRemoval=true
588
     * )
589
     */
590
    protected $cChatConnected;
591
592
    /**
593
     * @var ArrayCollection
594
     * @ORM\OneToMany(
595
     *     targetEntity="Chamilo\CourseBundle\Entity\CDropboxCategory",
596
     *     mappedBy="user",
597
     *     cascade={"persist", "remove"},
598
     *     orphanRemoval=true
599
     * )
600
     */
601
    protected $cDropboxCategorys;
602
    /**
603
     * @var ArrayCollection
604
     * @ORM\OneToMany(
605
     *     targetEntity="Chamilo\CourseBundle\Entity\CDropboxPerson",
606
     *     mappedBy="user",
607
     *     cascade={"persist", "remove"},
608
     *     orphanRemoval=true
609
     * )
610
     */
611
    protected $cDropboxPersons;
612
613
    /**
614
     * @var ArrayCollection
615
     * @ORM\OneToMany(
616
     *     targetEntity="Chamilo\CourseBundle\Entity\CForumMailcue",
617
     *     mappedBy="user",
618
     *     cascade={"persist", "remove"},
619
     *     orphanRemoval=true
620
     * )
621
     */
622
    protected $cForumMailcues;
623
    /**
624
     * @var ArrayCollection
625
     * @ORM\OneToMany(
626
     *     targetEntity="Chamilo\CourseBundle\Entity\CForumNotification",
627
     *     mappedBy="user",
628
     *     cascade={"persist", "remove"},
629
     *     orphanRemoval=true
630
     * )
631
     */
632
    protected $cForumNotifications;
633
    /**
634
     * @var ArrayCollection
635
     * @ORM\OneToMany(
636
     *     targetEntity="Chamilo\CourseBundle\Entity\CForumThreadQualify",
637
     *     mappedBy="user",
638
     *     cascade={"persist", "remove"},
639
     *     orphanRemoval=true
640
     * )
641
     */
642
    protected $cForumThreadQualifys;
643
    /**
644
     * @var ArrayCollection
645
     * @ORM\OneToMany(
646
     *     targetEntity="Chamilo\CourseBundle\Entity\CForumThreadQualifyLog",
647
     *     mappedBy="user",
648
     *     cascade={"persist", "remove"},
649
     *     orphanRemoval=true
650
     * )
651
     */
652
    protected $cForumThreadQualifyLogs;
653
    /**
654
     * @var ArrayCollection
655
     * @ORM\OneToMany(
656
     *     targetEntity="Chamilo\CourseBundle\Entity\CLpView",
657
     *     mappedBy="user",
658
     *     cascade={"persist", "remove"},
659
     *     orphanRemoval=true
660
     * )
661
     */
662
    protected $cLpViews;
663
    /**
664
     * @var ArrayCollection
665
     * @ORM\OneToMany(
666
     *     targetEntity="Chamilo\CourseBundle\Entity\CNotebook",
667
     *     mappedBy="user",
668
     *     cascade={"persist", "remove"},
669
     *     orphanRemoval=true
670
     * )
671
     */
672
    protected $cNotebooks;
673
    /**
674
     * @var ArrayCollection
675
     * @ORM\OneToMany(
676
     *     targetEntity="Chamilo\CourseBundle\Entity\COnlineConnected",
677
     *     mappedBy="user",
678
     *     cascade={"persist", "remove"},
679
     *     orphanRemoval=true
680
     * )
681
     */
682
    protected $cOnlineConnected;
683
    /**
684
     * @var ArrayCollection
685
     * @ORM\OneToMany(
686
     *     targetEntity="Chamilo\CourseBundle\Entity\CRoleUser",
687
     *     mappedBy="user",
688
     *     cascade={"persist", "remove"},
689
     *     orphanRemoval=true
690
     * )
691
     */
692
    protected $cRoleUsers;
693
    /**
694
     * @var ArrayCollection
695
     * @ORM\OneToMany(
696
     *     targetEntity="Chamilo\CourseBundle\Entity\CStudentPublication",
697
     *     mappedBy="user",
698
     *     cascade={"persist", "remove"},
699
     *     orphanRemoval=true
700
     * )
701
     */
702
    protected $cStudentPublications;
703
    /**
704
     * @var ArrayCollection
705
     * @ORM\OneToMany(
706
     *     targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationComment",
707
     *     mappedBy="user",
708
     *     cascade={"persist", "remove"},
709
     *     orphanRemoval=true
710
     * )
711
     */
712
    protected $cStudentPublicationComments;
713
    /**
714
     * @var ArrayCollection
715
     * @ORM\OneToMany(
716
     *     targetEntity="Chamilo\CourseBundle\Entity\CStudentPublicationRelUser",
717
     *     mappedBy="user",
718
     *     cascade={"persist", "remove"},
719
     *     orphanRemoval=true
720
     * )
721
     */
722
    protected $CStudentPublicationRelUser;
723
    /**
724
     * @var ArrayCollection
725
     * @ORM\OneToMany(
726
     *     targetEntity="Chamilo\CourseBundle\Entity\CWiki",
727
     *     mappedBy="user",
728
     *     cascade={"persist", "remove"},
729
     *     orphanRemoval=true
730
     * )
731
     */
732
    protected $cWiki;
733
    /**
734
     * @var ArrayCollection
735
     * @ORM\OneToMany(
736
     *     targetEntity="Chamilo\CourseBundle\Entity\CWikiMailcue",
737
     *     mappedBy="user",
738
     *     cascade={"persist", "remove"},
739
     *     orphanRemoval=true
740
     * )
741
     */
742
    protected $cWikiMailcues;
743
744
    /**
745
     * @var TrackEAccessComplete
746
     * @ORM\OneToOne (
747
     *     targetEntity="Chamilo\CoreBundle\Entity\TrackEAccessComplete",
748
     *     mappedBy="user",
749
     *     cascade={"persist", "remove"},
750
     *     orphanRemoval=true
751
     * )
752
     */
753
    protected $trackEAccessComplete;
754
755
    /**
756
     * @var ArrayCollection
757
     *
758
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="generalCoach")
759
     */
760
    protected $sessionAsGeneralCoach;
761
762
    /**
763
     * @ORM\OneToOne(
764
     *     targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", cascade={"remove"}, orphanRemoval=true
765
     * )
766
     * @ORM\JoinColumn(name="resource_node_id", referencedColumnName="id", onDelete="CASCADE")
767
     */
768
    protected $resourceNode;
769
770
    /**
771
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\ResourceNode", mappedBy="creator")
772
     */
773
    protected $resourceNodes;
774
775
    /**
776
     * @ApiSubresource()
777
     * @ORM\OneToMany(
778
     *     targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser",
779
     *     mappedBy="user",
780
     *     cascade={"persist"},
781
     *     orphanRemoval=true
782
     * )
783
     */
784
    protected $sessionCourseSubscriptions;
785
786
    /**
787
     * @ORM\OneToMany(
788
     *     targetEntity="Chamilo\CoreBundle\Entity\SkillRelUser",
789
     *     mappedBy="user",
790
     *     cascade={"persist", "remove"},
791
     *     orphanRemoval=true
792
     * )
793
     */
794
    protected $achievedSkills;
795
796
    /**
797
     * @ORM\OneToMany(
798
     *     targetEntity="Chamilo\CoreBundle\Entity\SkillRelUserComment",
799
     *     mappedBy="feedbackGiver",
800
     *     cascade={"persist", "remove"},
801
     *     orphanRemoval=true
802
     * )
803
     */
804
    protected $commentedUserSkills;
805
806
    /**
807
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory", mappedBy="user")
808
     */
809
    protected $gradeBookCategories;
810
811
    /**
812
     * @ORM\OneToMany(
813
     *     targetEntity="Chamilo\CoreBundle\Entity\SessionRelUser",
814
     *     mappedBy="user",
815
     *     cascade={"persist", "remove"},
816
     *     orphanRemoval=true
817
     * )
818
     */
819
    protected $sessions;
820
821
    /**
822
     * @var Collection
823
     *
824
     * @ORM\OneToMany(
825
     *     targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser",
826
     *     mappedBy="user",
827
     *     cascade={"persist", "remove"},
828
     *     orphanRemoval=true
829
     * )
830
     */
831
    protected $courseGroupsAsMember;
832
833
    /**
834
     * @var Collection
835
     *
836
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user", orphanRemoval=true)
837
     */
838
    protected $courseGroupsAsTutor;
839
840
    /**
841
     * @var string
842
     *
843
     * @ORM\Column(name="auth_source", type="string", length=50, nullable=true, unique=false)
844
     */
845
    protected $authSource;
846
847
    /**
848
     * @var int
849
     *
850
     * @ORM\Column(name="status", type="integer", nullable=false)
851
     */
852
    protected $status;
853
854
    /**
855
     * @var string
856
     *
857
     * @ORM\Column(name="official_code", type="string", length=40, nullable=true, unique=false)
858
     */
859
    protected $officialCode;
860
861
    /**
862
     * @var string
863
     *
864
     * @ORM\Column(name="picture_uri", type="string", length=250, nullable=true, unique=false)
865
     */
866
    protected $pictureUri;
867
868
    /**
869
     * @var int
870
     *
871
     * @ORM\Column(name="creator_id", type="integer", nullable=true, unique=false)
872
     */
873
    protected $creatorId;
874
875
    /**
876
     * @var string
877
     *
878
     * @ORM\Column(name="competences", type="text", nullable=true, unique=false)
879
     */
880
    protected $competences;
881
882
    /**
883
     * @var string
884
     *
885
     * @ORM\Column(name="diplomas", type="text", nullable=true, unique=false)
886
     */
887
    protected $diplomas;
888
889
    /**
890
     * @var string
891
     *
892
     * @ORM\Column(name="openarea", type="text", nullable=true, unique=false)
893
     */
894
    protected $openarea;
895
896
    /**
897
     * @var string
898
     *
899
     * @ORM\Column(name="teach", type="text", nullable=true, unique=false)
900
     */
901
    protected $teach;
902
903
    /**
904
     * @var string
905
     *
906
     * @ORM\Column(name="productions", type="string", length=250, nullable=true, unique=false)
907
     */
908
    protected $productions;
909
910
    /**
911
     * @var string
912
     *
913
     * @ORM\Column(name="language", type="string", length=40, nullable=true, unique=false)
914
     */
915
    protected $language;
916
917
    /**
918
     * @var \DateTime
919
     *
920
     * @ORM\Column(name="registration_date", type="datetime", nullable=false, unique=false)
921
     */
922
    protected $registrationDate;
923
924
    /**
925
     * @var \DateTime
926
     *
927
     * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false)
928
     */
929
    protected $expirationDate;
930
931
    /**
932
     * @var bool
933
     *
934
     * @ORM\Column(name="active", type="boolean", nullable=false, unique=false)
935
     */
936
    protected $active;
937
938
    /**
939
     * @var string
940
     *
941
     * @ORM\Column(name="openid", type="string", length=255, nullable=true, unique=false)
942
     */
943
    protected $openid;
944
945
    /**
946
     * @var string
947
     *
948
     * @ORM\Column(name="theme", type="string", length=255, nullable=true, unique=false)
949
     */
950
    protected $theme;
951
952
    /**
953
     * @var int
954
     *
955
     * @ORM\Column(name="hr_dept_id", type="smallint", nullable=true, unique=false)
956
     */
957
    protected $hrDeptId;
958
959
    /**
960
     * @var ArrayCollection
961
     *
962
     * @ORM\OneToMany(
963
     *     targetEntity="Chamilo\CoreBundle\Entity\Message",
964
     *     mappedBy="userSender",
965
     *     cascade={"persist", "remove"},
966
     *     orphanRemoval=true
967
     * )
968
     */
969
    protected $sentMessages;
970
971
    /**
972
     * @var ArrayCollection
973
     *
974
     * @ORM\OneToMany(
975
     *     targetEntity="Chamilo\CoreBundle\Entity\Message",
976
     *     mappedBy="userReceiver",
977
     *     cascade={"persist", "remove"},
978
     *     orphanRemoval=true
979
     * )
980
     */
981
    protected $receivedMessages;
982
983
    /**
984
     * @var \DateTime
985
     * @ORM\Column(name="created_at", type="datetime", nullable=true, unique=false)
986
     */
987
    protected $createdAt;
988
989
    /**
990
     * @var \DateTime
991
     * @ORM\Column(name="updated_at", type="datetime", nullable=true, unique=false)
992
     */
993
    protected $updatedAt;
994
995
    /**
996
     * Constructor.
997
     */
998
    public function __construct()
999
    {
1000
        $this->uuid = Uuid::uuid4()->toString();
1001
        $this->status = self::STUDENT;
1002
        $this->salt = sha1(uniqid(null, true));
1003
        $this->active = true;
1004
        $this->registrationDate = new \DateTime();
1005
        $this->authSource = 'platform';
1006
        $this->courses = new ArrayCollection();
1007
        //$this->items = new ArrayCollection();
1008
        $this->classes = new ArrayCollection();
1009
        $this->curriculumItems = new ArrayCollection();
1010
        $this->portals = new ArrayCollection();
1011
        $this->dropBoxSentFiles = new ArrayCollection();
1012
        $this->dropBoxReceivedFiles = new ArrayCollection();
1013
        $this->groups = new ArrayCollection();
1014
        //$this->extraFields = new ArrayCollection();
1015
        $this->createdAt = new \DateTime();
1016
        $this->updatedAt = new \DateTime();
1017
1018
        $this->enabled = false;
1019
        $this->locked = false;
1020
        $this->expired = false;
1021
        $this->roles = [];
1022
        $this->credentialsExpired = false;
1023
1024
        $this->courseGroupsAsMember = new ArrayCollection();
1025
        $this->courseGroupsAsTutor = new ArrayCollection();
1026
    }
1027
  
1028
    public function __toString()
1029
    {
1030
        return $this->username;
1031
    }
1032
1033
    /**
1034
     * @return int
1035
     */
1036
    public function getId()
1037
    {
1038
        return $this->id;
1039
    }
1040
1041
    /**
1042
     * @param int $userId
1043
     */
1044
    public function setId($userId)
1045
    {
1046
        $this->id = $userId;
1047
    }
1048
1049
    public function getUuid(): UuidInterface
1050
    {
1051
        return $this->uuid;
1052
    }
1053
1054
    /**
1055
     * @return string
1056
     */
1057
    public function __toString()
1058
    {
1059
        return $this->username;
1060
    }
1061
1062
    public function setResourceNode(ResourceNode $resourceNode): self
1063
    {
1064
        $this->resourceNode = $resourceNode;
1065
1066
        return $this;
1067
    }
1068
1069
    public function getResourceNode(): ResourceNode
1070
    {
1071
        return $this->resourceNode;
1072
    }
1073
1074
    /**
1075
     * @return ArrayCollection|ResourceNode[]
1076
     */
1077
    public function getResourceNodes()
1078
    {
1079
        return $this->resourceNodes;
1080
    }
1081
1082
    /**
1083
     * @return User
1084
     */
1085
    public function setResourceNodes($resourceNodes)
1086
    {
1087
        $this->resourceNodes = $resourceNodes;
1088
1089
        return $this;
1090
    }
1091
1092
    /**
1093
     * @ORM\PostPersist()
1094
     */
1095
    public function postPersist(LifecycleEventArgs $args)
1096
    {
1097
        /*$user = $args->getEntity();
1098
        */
1099
    }
1100
1101
    /**
1102
     * @return ArrayCollection
1103
     */
1104
    public function getDropBoxSentFiles()
1105
    {
1106
        return $this->dropBoxSentFiles;
1107
    }
1108
1109
    /**
1110
     * @return ArrayCollection
1111
     */
1112
    public function getDropBoxReceivedFiles()
1113
    {
1114
        return $this->dropBoxReceivedFiles;
1115
    }
1116
1117
    /**
1118
     * @param ArrayCollection $value
1119
     */
1120
    public function setDropBoxSentFiles($value)
1121
    {
1122
        $this->dropBoxSentFiles = $value;
1123
    }
1124
1125
    /**
1126
     * @param ArrayCollection $value
1127
     */
1128
    public function setDropBoxReceivedFiles($value)
1129
    {
1130
        $this->dropBoxReceivedFiles = $value;
1131
    }
1132
1133
    /**
1134
     * @param ArrayCollection $courses
1135
     */
1136
    public function setCourses($courses)
1137
    {
1138
        $this->courses = $courses;
1139
    }
1140
1141
    public function getCourses(): Collection
1142
    {
1143
        return $this->courses;
1144
    }
1145
1146
    /**
1147
     * @return array
1148
     */
1149
    public static function getPasswordConstraints()
1150
    {
1151
        return
1152
            [
1153
                new Assert\Length(['min' => 5]),
1154
                // Alpha numeric + "_" or "-"
1155
                new Assert\Regex(
1156
                    [
1157
                        'pattern' => '/^[a-z\-_0-9]+$/i',
1158
                        'htmlPattern' => '/^[a-z\-_0-9]+$/i', ]
1159
                ),
1160
                // Min 3 letters - not needed
1161
                /*new Assert\Regex(array(
1162
                    'pattern' => '/[a-z]{3}/i',
1163
                    'htmlPattern' => '/[a-z]{3}/i')
1164
                ),*/
1165
                // Min 2 numbers
1166
                new Assert\Regex(
1167
                    [
1168
                        'pattern' => '/[0-9]{2}/',
1169
                        'htmlPattern' => '/[0-9]{2}/', ]
1170
                ),
1171
            ]
1172
            ;
1173
    }
1174
1175
    public static function loadValidatorMetadata(ClassMetadata $metadata)
1176
    {
1177
        //$metadata->addPropertyConstraint('firstname', new Assert\NotBlank());
1178
        //$metadata->addPropertyConstraint('lastname', new Assert\NotBlank());
1179
        //$metadata->addPropertyConstraint('email', new Assert\Email());
1180
        /*
1181
        $metadata->addPropertyConstraint('password',
1182
            new Assert\Collection(self::getPasswordConstraints())
1183
        );*/
1184
1185
        /*$metadata->addConstraint(new UniqueEntity(array(
1186
            'fields'  => 'username',
1187
            'message' => 'This value is already used.',
1188
        )));*/
1189
1190
        /*$metadata->addPropertyConstraint(
1191
            'username',
1192
            new Assert\Length(array(
1193
                'min'        => 2,
1194
                'max'        => 50,
1195
                'minMessage' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.',
1196
                'maxMessage' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.',
1197
            ))
1198
        );*/
1199
    }
1200
1201
    /**
1202
     * @return ArrayCollection
1203
     */
1204
    public function getPortals()
1205
    {
1206
        return $this->portals;
1207
    }
1208
1209
    /**
1210
     * @param $portal
1211
     */
1212
    public function setPortal($portal)
1213
    {
1214
        $this->portals->add($portal);
1215
    }
1216
1217
    /**
1218
     * @param $value
1219
     * @param (mixed|string|string[])[] $value
1220
     */
1221
    public function setPortals(array $value)
1222
    {
1223
        $this->portals = $value;
1224
    }
1225
1226
    /**
1227
     * @return ArrayCollection
1228
     */
1229
    public function getCurriculumItems()
1230
    {
1231
        return $this->curriculumItems;
1232
    }
1233
1234
    /**
1235
     * @param $items
1236
     *
1237
     * @return $this
1238
     */
1239
    public function setCurriculumItems(array $items)
1240
    {
1241
        $this->curriculumItems = $items;
1242
1243
        return $this;
1244
    }
1245
1246
    /**
1247
     * @return bool
1248
     */
1249
    public function getIsActive()
1250
    {
1251
        return 1 == $this->active;
1252
    }
1253
1254
    /**
1255
     * @return bool
1256
     */
1257
    public function isActive()
1258
    {
1259
        return $this->getIsActive();
1260
    }
1261
1262
    public function isEnabled()
1263
    {
1264
        return 1 == $this->getActive();
1265
    }
1266
1267
    /**
1268
     * Set salt.
1269
     *
1270
     * @param string $salt
1271
     *
1272
     * @return User
1273
     */
1274
    public function setSalt($salt)
1275
    {
1276
        $this->salt = $salt;
1277
1278
        return $this;
1279
    }
1280
1281
    /**
1282
     * Get salt.
1283
     *
1284
     * @return string
1285
     */
1286
    public function getSalt()
1287
    {
1288
        return $this->salt;
1289
    }
1290
1291
    /**
1292
     * @param ArrayCollection $classes
1293
     *
1294
     * @return $this
1295
     */
1296
    public function setClasses($classes)
1297
    {
1298
        $this->classes = $classes;
1299
1300
        return $this;
1301
    }
1302
1303
    /**
1304
     * @return ArrayCollection
1305
     */
1306
    public function getClasses()
1307
    {
1308
        return $this->classes;
1309
    }
1310
1311
    public function getLps()
1312
    {
1313
        //return $this->lps;
1314
        /*$criteria = Criteria::create()
1315
            ->where(Criteria::expr()->eq("id", "666"))
1316
            //->orderBy(array("username" => "ASC"))
1317
            //->setFirstResult(0)
1318
            //->setMaxResults(20)
1319
        ;
1320
        $lps = $this->lps->matching($criteria);*/
1321
        /*return $this->lps->filter(
1322
            function($entry) use ($idsToFilter) {
1323
                return $entry->getId() == 1;
1324
        });*/
1325
    }
1326
1327
    /**
1328
     * Returns the list of classes for the user.
1329
     *
1330
     * @return string
1331
     */
1332
    public function getCompleteNameWithClasses()
1333
    {
1334
        $classSubscription = $this->getClasses();
1335
        $classList = [];
1336
        /** @var UsergroupRelUser $subscription */
1337
        foreach ($classSubscription as $subscription) {
1338
            $class = $subscription->getUsergroup();
1339
            $classList[] = $class->getName();
1340
        }
1341
        $classString = !empty($classList) ? ' ['.implode(', ', $classList).']' : null;
1342
1343
        return \UserManager::formatUserFullName($this).$classString;
1344
    }
1345
1346
    /**
1347
     * Set lastname.
1348
     *
1349
     * @return User
1350
     */
1351
    public function setLastname(string $lastname): self
1352
    {
1353
        $this->lastname = $lastname;
1354
1355
        return $this;
1356
    }
1357
1358
    /**
1359
     * Set firstname.
1360
     *
1361
     * @return User
1362
     */
1363
    public function setFirstname(string $firstname): self
1364
    {
1365
        $this->firstname = $firstname;
1366
1367
        return $this;
1368
    }
1369
1370
    public function getPassword()
1371
    {
1372
        return $this->password;
1373
    }
1374
1375
    public function setPassword(string $password): self
1376
    {
1377
        $this->password = $password;
1378
1379
        return $this;
1380
    }
1381
1382
    /**
1383
     * Set authSource.
1384
     *
1385
     * @param string $authSource
1386
     *
1387
     * @return User
1388
     */
1389
    public function setAuthSource($authSource)
1390
    {
1391
        $this->authSource = $authSource;
1392
1393
        return $this;
1394
    }
1395
1396
    /**
1397
     * Get authSource.
1398
     *
1399
     * @return string
1400
     */
1401
    public function getAuthSource()
1402
    {
1403
        return $this->authSource;
1404
    }
1405
1406
    /**
1407
     * Set email.
1408
     *
1409
     * @param string $email
1410
     *
1411
     * @return User
1412
     */
1413
    public function setEmail($email)
1414
    {
1415
        $this->email = $email;
1416
1417
        return $this;
1418
    }
1419
1420
    /**
1421
     * Get email.
1422
     *
1423
     * @return string
1424
     */
1425
    public function getEmail()
1426
    {
1427
        return $this->email;
1428
    }
1429
1430
    /**
1431
     * Set status.
1432
     *
1433
     * @return User
1434
     */
1435
    public function setStatus(int $status)
1436
    {
1437
        $this->status = $status;
1438
1439
        return $this;
1440
    }
1441
1442
    /**
1443
     * Get status.
1444
     *
1445
     * @return int
1446
     */
1447
    public function getStatus()
1448
    {
1449
        return (int) $this->status;
1450
    }
1451
1452
    /**
1453
     * Set officialCode.
1454
     *
1455
     * @param string $officialCode
1456
     *
1457
     * @return User
1458
     */
1459
    public function setOfficialCode($officialCode)
1460
    {
1461
        $this->officialCode = $officialCode;
1462
1463
        return $this;
1464
    }
1465
1466
    /**
1467
     * Get officialCode.
1468
     *
1469
     * @return string
1470
     */
1471
    public function getOfficialCode()
1472
    {
1473
        return $this->officialCode;
1474
    }
1475
1476
    /**
1477
     * Set phone.
1478
     *
1479
     * @param string $phone
1480
     *
1481
     * @return User
1482
     */
1483
    public function setPhone($phone)
1484
    {
1485
        $this->phone = $phone;
1486
1487
        return $this;
1488
    }
1489
1490
    /**
1491
     * Get phone.
1492
     *
1493
     * @return string
1494
     */
1495
    public function getPhone()
1496
    {
1497
        return $this->phone;
1498
    }
1499
1500
    /**
1501
     * Set address.
1502
     *
1503
     * @param string $address
1504
     *
1505
     * @return User
1506
     */
1507
    public function setAddress($address)
1508
    {
1509
        $this->address = $address;
1510
1511
        return $this;
1512
    }
1513
1514
    /**
1515
     * Get address.
1516
     *
1517
     * @return string
1518
     */
1519
    public function getAddress()
1520
    {
1521
        return $this->address;
1522
    }
1523
1524
    /**
1525
     * Set creatorId.
1526
     *
1527
     * @param int $creatorId
1528
     *
1529
     * @return User
1530
     */
1531
    public function setCreatorId($creatorId)
1532
    {
1533
        $this->creatorId = $creatorId;
1534
1535
        return $this;
1536
    }
1537
1538
    /**
1539
     * Get creatorId.
1540
     *
1541
     * @return int
1542
     */
1543
    public function getCreatorId()
1544
    {
1545
        return $this->creatorId;
1546
    }
1547
1548
    /**
1549
     * Set competences.
1550
     *
1551
     * @param string $competences
1552
     *
1553
     * @return User
1554
     */
1555
    public function setCompetences($competences)
1556
    {
1557
        $this->competences = $competences;
1558
1559
        return $this;
1560
    }
1561
1562
    /**
1563
     * Get competences.
1564
     *
1565
     * @return string
1566
     */
1567
    public function getCompetences()
1568
    {
1569
        return $this->competences;
1570
    }
1571
1572
    /**
1573
     * Set diplomas.
1574
     *
1575
     * @param string $diplomas
1576
     *
1577
     * @return User
1578
     */
1579
    public function setDiplomas($diplomas)
1580
    {
1581
        $this->diplomas = $diplomas;
1582
1583
        return $this;
1584
    }
1585
1586
    /**
1587
     * Get diplomas.
1588
     *
1589
     * @return string
1590
     */
1591
    public function getDiplomas()
1592
    {
1593
        return $this->diplomas;
1594
    }
1595
1596
    /**
1597
     * Set openarea.
1598
     *
1599
     * @param string $openarea
1600
     *
1601
     * @return User
1602
     */
1603
    public function setOpenarea($openarea)
1604
    {
1605
        $this->openarea = $openarea;
1606
1607
        return $this;
1608
    }
1609
1610
    /**
1611
     * Get openarea.
1612
     *
1613
     * @return string
1614
     */
1615
    public function getOpenarea()
1616
    {
1617
        return $this->openarea;
1618
    }
1619
1620
    /**
1621
     * Set teach.
1622
     *
1623
     * @param string $teach
1624
     *
1625
     * @return User
1626
     */
1627
    public function setTeach($teach)
1628
    {
1629
        $this->teach = $teach;
1630
1631
        return $this;
1632
    }
1633
1634
    /**
1635
     * Get teach.
1636
     *
1637
     * @return string
1638
     */
1639
    public function getTeach()
1640
    {
1641
        return $this->teach;
1642
    }
1643
1644
    /**
1645
     * Set productions.
1646
     *
1647
     * @param string $productions
1648
     *
1649
     * @return User
1650
     */
1651
    public function setProductions($productions)
1652
    {
1653
        $this->productions = $productions;
1654
1655
        return $this;
1656
    }
1657
1658
    /**
1659
     * Get productions.
1660
     *
1661
     * @return string
1662
     */
1663
    public function getProductions()
1664
    {
1665
        return $this->productions;
1666
    }
1667
1668
    /**
1669
     * Set language.
1670
     *
1671
     * @param string $language
1672
     *
1673
     * @return User
1674
     */
1675
    public function setLanguage($language)
1676
    {
1677
        $this->language = $language;
1678
1679
        return $this;
1680
    }
1681
1682
    /**
1683
     * Get language.
1684
     *
1685
     * @return string
1686
     */
1687
    public function getLanguage()
1688
    {
1689
        return $this->language;
1690
    }
1691
1692
    /**
1693
     * Set registrationDate.
1694
     *
1695
     * @param \DateTime $registrationDate
1696
     *
1697
     * @return User
1698
     */
1699
    public function setRegistrationDate($registrationDate)
1700
    {
1701
        $this->registrationDate = $registrationDate;
1702
1703
        return $this;
1704
    }
1705
1706
    /**
1707
     * Get registrationDate.
1708
     *
1709
     * @return \DateTime
1710
     */
1711
    public function getRegistrationDate()
1712
    {
1713
        return $this->registrationDate;
1714
    }
1715
1716
    /**
1717
     * Set expirationDate.
1718
     *
1719
     * @param \DateTime $expirationDate
1720
     *
1721
     * @return User
1722
     */
1723
    public function setExpirationDate($expirationDate)
1724
    {
1725
        $this->expirationDate = $expirationDate;
1726
1727
        return $this;
1728
    }
1729
1730
    /**
1731
     * Get expirationDate.
1732
     *
1733
     * @return \DateTime
1734
     */
1735
    public function getExpirationDate()
1736
    {
1737
        return $this->expirationDate;
1738
    }
1739
1740
    /**
1741
     * Set active.
1742
     *
1743
     * @param bool $active
1744
     *
1745
     * @return User
1746
     */
1747
    public function setActive($active)
1748
    {
1749
        $this->active = $active;
1750
1751
        return $this;
1752
    }
1753
1754
    /**
1755
     * Get active.
1756
     *
1757
     * @return bool
1758
     */
1759
    public function getActive()
1760
    {
1761
        return $this->active;
1762
    }
1763
1764
    public function setOpenid($openid)
1765
    {
1766
        $this->openid = $openid;
1767
1768
        return $this;
1769
    }
1770
1771
    /**
1772
     * Get openid.
1773
     *
1774
     * @return string
1775
     */
1776
    public function getOpenid()
1777
    {
1778
        return $this->openid;
1779
    }
1780
1781
    /**
1782
     * Set theme.
1783
     *
1784
     * @param string $theme
1785
     *
1786
     * @return User
1787
     */
1788
    public function setTheme($theme)
1789
    {
1790
        $this->theme = $theme;
1791
1792
        return $this;
1793
    }
1794
1795
    /**
1796
     * Get theme.
1797
     *
1798
     * @return string
1799
     */
1800
    public function getTheme()
1801
    {
1802
        return $this->theme;
1803
    } 
1804
  
1805
    /**
1806
     * Set hrDeptId.
1807
     *
1808
     * @param int $hrDeptId
1809
     *
1810
     * @return User
1811
     */
1812
    public function setHrDeptId($hrDeptId)
1813
    {
1814
        $this->hrDeptId = $hrDeptId;
1815
1816
        return $this;
1817
    }
1818
1819
    /**
1820
     * Get hrDeptId.
1821
     *
1822
     * @return int
1823
     */
1824
    public function getHrDeptId()
1825
    {
1826
        return $this->hrDeptId;
1827
    }
1828
1829
    /**
1830
     * @return \DateTime
1831
     */
1832
    public function getMemberSince()
1833
    {
1834
        return $this->registrationDate;
1835
    }
1836
1837
    /**
1838
     * @return bool
1839
     */
1840
    public function isOnline()
1841
    {
1842
        return false;
1843
    }
1844
1845
    /**
1846
     * @return int
1847
     */
1848
    public function getIdentifier()
1849
    {
1850
        return $this->getId();
1851
    }
1852
1853
    /**
1854
     * @return string
1855
     */
1856
    public function getSlug()
1857
    {
1858
        return $this->getUsername();
1859
    }
1860
1861
    /**
1862
     * @param string $slug
1863
     *
1864
     * @return User
1865
     */
1866
    public function setSlug($slug)
1867
    {
1868
        return $this->setUsername($slug);
1869
    }
1870
1871
    public function setUsername($username)
1872
    {
1873
        $this->username = $username;
1874
1875
        return $this;
1876
    }
1877
1878
    public function setUsernameCanonical($usernameCanonical)
1879
    {
1880
        $this->usernameCanonical = $usernameCanonical;
1881
1882
        return $this;
1883
    }
1884
1885
    public function setEmailCanonical($emailCanonical)
1886
    {
1887
        $this->emailCanonical = $emailCanonical;
1888
1889
        return $this;
1890
    }
1891
1892
    /**
1893
     * Set lastLogin.
1894
     *
1895
     * @param \DateTime $lastLogin
1896
     *
1897
     * @return User
1898
     */
1899
    public function setLastLogin(\DateTime $lastLogin = null)
1900
    {
1901
        $this->lastLogin = $lastLogin;
1902
1903
        return $this;
1904
    }
1905
1906
    /**
1907
     * Get lastLogin.
1908
     *
1909
     * @return \DateTime
1910
     */
1911
    public function getLastLogin()
1912
    {
1913
        return $this->lastLogin;
1914
    }
1915
1916
    /**
1917
     * Get sessionCourseSubscription.
1918
     *
1919
     * @return ArrayCollection
1920
     */
1921
    public function getSessionCourseSubscriptions()
1922
    {
1923
        return $this->sessionCourseSubscriptions;
1924
    }
1925
1926
    /**
1927
     * @param $value
1928
     * @param string[][] $value
1929
     *
1930
     * @return $this
1931
     */
1932
    public function setSessionCourseSubscriptions(array $value)
1933
    {
1934
        $this->sessionCourseSubscriptions = $value;
1935
1936
        return $this;
1937
    }
1938
1939
    /**
1940
     * @return string
1941
     */
1942
    public function getConfirmationToken()
1943
    {
1944
        return $this->confirmationToken;
1945
    }
1946
1947
    /**
1948
     * @param string $confirmationToken
1949
     *
1950
     * @return User
1951
     */
1952
    public function setConfirmationToken($confirmationToken)
1953
    {
1954
        $this->confirmationToken = $confirmationToken;
1955
1956
        return $this;
1957
    }
1958
1959
    /**
1960
     * @return \DateTime
1961
     */
1962
    public function getPasswordRequestedAt()
1963
    {
1964
        return $this->passwordRequestedAt;
1965
    }
1966
1967
    /*public function isPasswordRequestNonExpired($ttl)
1968
    {
1969
        return $this->getPasswordRequestedAt() instanceof \DateTime &&
1970
            $this->getPasswordRequestedAt()->getTimestamp() + $ttl > time();
1971
    }*/
1972
1973
    public function getUsername(): string
1974
    {
1975
        return (string) $this->username;
1976
    }
1977
1978
    public function getPlainPassword(): ?string
1979
    {
1980
        return $this->plainPassword;
1981
    }
1982
1983
    public function setPlainPassword(string $password)
1984
    {
1985
        $this->plainPassword = $password;
1986
1987
        // forces the object to look "dirty" to Doctrine. Avoids
1988
        // Doctrine *not* saving this entity, if only plainPassword changes
1989
        $this->password = null;
1990
1991
        return $this;
1992
    }
1993
1994
    /**
1995
     * Returns the expiration date.
1996
     *
1997
     * @return \DateTime|null
1998
     */
1999
    public function getExpiresAt()
2000
    {
2001
        return $this->expiresAt;
2002
    }
2003
2004
    /**
2005
     * Returns the credentials expiration date.
2006
     *
2007
     * @return \DateTime
2008
     */
2009
    public function getCredentialsExpireAt()
2010
    {
2011
        return $this->credentialsExpireAt;
2012
    }
2013
2014
    /**
2015
     * Sets the credentials expiration date.
2016
     *
2017
     * @return User
2018
     */
2019
    public function setCredentialsExpireAt(\DateTime $date = null)
2020
    {
2021
        $this->credentialsExpireAt = $date;
2022
2023
        return $this;
2024
    }
2025
2026
    public function addGroup($group)
2027
    {
2028
        if (!$this->getGroups()->contains($group)) {
2029
            $this->getGroups()->add($group);
2030
        }
2031
2032
        return $this;
2033
    }
2034
2035
    /**
2036
     * Sets the user groups.
2037
     *
2038
     * @param array $groups
2039
     *
2040
     * @return User
2041
     */
2042
    public function setGroups($groups)
2043
    {
2044
        foreach ($groups as $group) {
2045
            $this->addGroup($group);
2046
        }
2047
2048
        return $this;
2049
    }
2050
2051
    /**
2052
     * @return string
2053
     */
2054
    public function getFullname()
2055
    {
2056
        return sprintf('%s %s', $this->getFirstname(), $this->getLastname());
2057
    }
2058
2059
    public function getGroups()
2060
    {
2061
        return $this->groups;
2062
    }
2063
2064
    /**
2065
     * @return array
2066
     */
2067
    public function getGroupNames()
2068
    {
2069
        $names = [];
2070
        foreach ($this->getGroups() as $group) {
2071
            $names[] = $group->getName();
2072
        }
2073
2074
        return $names;
2075
    }
2076
2077
    /**
2078
     * @param string $name
2079
     *
2080
     * @return bool
2081
     */
2082
    public function hasGroup($name)
2083
    {
2084
        return in_array($name, $this->getGroupNames());
2085
    }
2086
2087
    public function removeGroup($group)
2088
    {
2089
        if ($this->getGroups()->contains($group)) {
2090
            $this->getGroups()->removeElement($group);
2091
        }
2092
2093
        return $this;
2094
    }
2095
2096
    /**
2097
     * @param string $role
2098
     *
2099
     * @return $this
2100
     */
2101
    public function addRole($role)
2102
    {
2103
        $role = strtoupper($role);
2104
        if ($role === static::ROLE_DEFAULT) {
2105
            return $this;
2106
        }
2107
2108
        if (!in_array($role, $this->roles, true)) {
2109
            $this->roles[] = $role;
2110
        }
2111
2112
        return $this;
2113
    }
2114
2115
    /**
2116
     * Returns the user roles.
2117
     *
2118
     * @return array The roles
2119
     */
2120
    public function getRoles()
2121
    {
2122
        $roles = $this->roles;
2123
2124
        foreach ($this->getGroups() as $group) {
2125
            $roles = array_merge($roles, $group->getRoles());
2126
        }
2127
2128
        // we need to make sure to have at least one role
2129
        $roles[] = 'ROLE_USER';
2130
2131
        return array_unique($roles);
2132
    }
2133
2134
    public function isAccountNonExpired()
2135
    {
2136
        /*if (true === $this->expired) {
2137
            return false;
2138
        }
2139
2140
        if (null !== $this->expiresAt && $this->expiresAt->getTimestamp() < time()) {
2141
            return false;
2142
        }*/
2143
2144
        return true;
2145
    }
2146
2147
    public function isAccountNonLocked()
2148
    {
2149
        return true;
2150
        //return !$this->locked;
2151
    }
2152
2153
    public function isCredentialsNonExpired()
2154
    {
2155
        /*if (true === $this->credentialsExpired) {
2156
            return false;
2157
        }
2158
2159
        if (null !== $this->credentialsExpireAt && $this->credentialsExpireAt->getTimestamp() < time()) {
2160
            return false;
2161
        }*/
2162
2163
        return true;
2164
    }
2165
2166
    /**
2167
     * @return bool
2168
     */
2169
    public function getCredentialsExpired()
2170
    {
2171
        return $this->credentialsExpired;
2172
    }
2173
2174
    /**
2175
     * @param bool $boolean
2176
     *
2177
     * @return User
2178
     */
2179
    public function setCredentialsExpired($boolean)
2180
    {
2181
        $this->credentialsExpired = $boolean;
2182
2183
        return $this;
2184
    }
2185
2186
    /**
2187
     * @param $boolean
2188
     *
2189
     * @return $this
2190
     */
2191
    public function setEnabled($boolean)
2192
    {
2193
        $this->enabled = (bool) $boolean;
2194
2195
        return $this;
2196
    }
2197
2198
    /**
2199
     * @return bool
2200
     */
2201
    public function getExpired()
2202
    {
2203
        return $this->expired;
2204
    }
2205
2206
    /**
2207
     * Sets this user to expired.
2208
     *
2209
     * @param bool $boolean
2210
     *
2211
     * @return User
2212
     */
2213
    public function setExpired($boolean)
2214
    {
2215
        $this->expired = (bool) $boolean;
2216
2217
        return $this;
2218
    }
2219
2220
    /**
2221
     * @return User
2222
     */
2223
    public function setExpiresAt(\DateTime $date)
2224
    {
2225
        $this->expiresAt = $date;
2226
2227
        return $this;
2228
    }
2229
2230
    public function getLocked(): bool
2231
    {
2232
        return $this->locked;
2233
    }
2234
2235
    /**
2236
     * @param $boolean
2237
     *
2238
     * @return $this
2239
     */
2240
    public function setLocked($boolean)
2241
    {
2242
        $this->locked = $boolean;
2243
2244
        return $this;
2245
    }
2246
2247
    /**
2248
     * @return $this
2249
     */
2250
    public function setRoles(array $roles)
2251
    {
2252
        $this->roles = [];
2253
2254
        foreach ($roles as $role) {
2255
            $this->addRole($role);
2256
        }
2257
2258
        return $this;
2259
    }
2260
2261
    /**
2262
     * Get achievedSkills.
2263
     *
2264
     * @return ArrayCollection
2265
     */
2266
    public function getAchievedSkills()
2267
    {
2268
        return $this->achievedSkills;
2269
    }
2270
2271
    /**
2272
     * @param $value
2273
     * @param string[] $value
2274
     *
2275
     * @return $this
2276
     */
2277
    public function setAchievedSkills(array $value)
2278
    {
2279
        $this->achievedSkills = $value;
2280
2281
        return $this;
2282
    }
2283
2284
    /**
2285
     * Check if the user has the skill.
2286
     *
2287
     * @param Skill $skill The skill
2288
     *
2289
     * @return bool
2290
     */
2291
    public function hasSkill(Skill $skill)
2292
    {
2293
        $achievedSkills = $this->getAchievedSkills();
2294
2295
        foreach ($achievedSkills as $userSkill) {
2296
            if ($userSkill->getSkill()->getId() !== $skill->getId()) {
2297
                continue;
2298
            }
2299
2300
            return true;
2301
        }
2302
    }
2303
2304
    /**
2305
     * @return bool
2306
     */
2307
    public function isProfileCompleted()
2308
    {
2309
        return $this->profileCompleted;
2310
    }
2311
2312
    /**
2313
     * @return User
2314
     */
2315
    public function setProfileCompleted($profileCompleted)
2316
    {
2317
        $this->profileCompleted = $profileCompleted;
2318
2319
        return $this;
2320
    }
2321
2322
    /**
2323
     * Sets the AccessUrl for the current user in memory.
2324
     *
2325
     * @return $this
2326
     */
2327
    public function setCurrentUrl(AccessUrl $url)
2328
    {
2329
        $urlList = $this->getPortals();
2330
        /** @var AccessUrlRelUser $item */
2331
        foreach ($urlList as $item) {
2332
            if ($item->getUrl()->getId() === $url->getId()) {
2333
                $this->currentUrl = $url;
2334
2335
                break;
2336
            }
2337
        }
2338
2339
        return $this;
2340
    }
2341
2342
    /**
2343
     * @return AccessUrl
2344
     */
2345
    public function getCurrentUrl()
2346
    {
2347
        return $this->currentUrl;
2348
    }
2349
2350
    /**
2351
     * Get sessionAsGeneralCoach.
2352
     *
2353
     * @return ArrayCollection
2354
     */
2355
    public function getSessionAsGeneralCoach()
2356
    {
2357
        return $this->sessionAsGeneralCoach;
2358
    }
2359
2360
    /**
2361
     * Get sessionAsGeneralCoach.
2362
     *
2363
     * @param ArrayCollection $value
2364
     *
2365
     * @return $this
2366
     */
2367
    public function setSessionAsGeneralCoach($value)
2368
    {
2369
        $this->sessionAsGeneralCoach = $value;
2370
2371
        return $this;
2372
    }
2373
2374
    public function getCommentedUserSkills()
2375
    {
2376
        return $this->commentedUserSkills;
2377
    }
2378
2379
    /**
2380
     * @return User
2381
     */
2382
    public function setCommentedUserSkills(array $commentedUserSkills)
2383
    {
2384
        $this->commentedUserSkills = $commentedUserSkills;
2385
2386
        return $this;
2387
    }
2388
2389
    /**
2390
     * @return bool
2391
     */
2392
    public function isEqualTo(UserInterface $user)
2393
    {
2394
        if ($this->password !== $user->getPassword()) {
2395
            return false;
2396
        }
2397
2398
        if ($this->salt !== $user->getSalt()) {
2399
            return false;
2400
        }
2401
2402
        if ($this->username !== $user->getUsername()) {
2403
            return false;
2404
        }
2405
2406
        return true;
2407
    }
2408
2409
    /**
2410
     * Get sentMessages.
2411
     *
2412
     * @return ArrayCollection
2413
     */
2414
    public function getSentMessages()
2415
    {
2416
        return $this->sentMessages;
2417
    }
2418
2419
    /**
2420
     * Get receivedMessages.
2421
     *
2422
     * @return ArrayCollection
2423
     */
2424
    public function getReceivedMessages()
2425
    {
2426
        return $this->receivedMessages;
2427
    }
2428
2429
    /**
2430
     * @param int $lastId Optional. The ID of the last received message
2431
     */
2432
    public function getUnreadReceivedMessages($lastId = 0): ArrayCollection
2433
    {
2434
        $criteria = Criteria::create();
2435
        $criteria->where(
2436
            Criteria::expr()->eq('msgStatus', MESSAGE_STATUS_UNREAD)
2437
        );
2438
2439
        if ($lastId > 0) {
2440
            $criteria->andWhere(
2441
                Criteria::expr()->gt('id', (int) $lastId)
2442
            );
2443
        }
2444
2445
        $criteria->orderBy(['sendDate' => Criteria::DESC]);
2446
2447
        return $this->receivedMessages->matching($criteria);
2448
    }
2449
2450
    public function getCourseGroupsAsMember(): Collection
2451
    {
2452
        return $this->courseGroupsAsMember;
2453
    }
2454
2455
    public function getCourseGroupsAsTutor(): Collection
2456
    {
2457
        return $this->courseGroupsAsTutor;
2458
    }
2459
2460
    public function getCourseGroupsAsMemberFromCourse(Course $course): ArrayCollection
2461
    {
2462
        $criteria = Criteria::create();
2463
        $criteria->where(
2464
            Criteria::expr()->eq('cId', $course)
2465
        );
2466
2467
        return $this->courseGroupsAsMember->matching($criteria);
2468
    }
2469
2470
    public function getFirstname()
2471
    {
2472
        return $this->firstname;
2473
    }
2474
2475
    public function getLastname()
2476
    {
2477
        return $this->lastname;
2478
    }
2479
2480
    public function eraseCredentials()
2481
    {
2482
        $this->plainPassword = null;
2483
    }
2484
2485
    public function hasRole($role)
2486
    {
2487
        return in_array(strtoupper($role), $this->getRoles(), true);
2488
    }
2489
2490
    public function isSuperAdmin()
2491
    {
2492
        return $this->hasRole('ROLE_SUPER_ADMIN');
2493
    }
2494
2495
    public function isUser(UserInterface $user = null)
2496
    {
2497
        return null !== $user && $this->getId() === $user->getId();
2498
    }
2499
2500
    public function removeRole($role)
2501
    {
2502
        if (false !== $key = array_search(strtoupper($role), $this->roles, true)) {
2503
            unset($this->roles[$key]);
2504
            $this->roles = array_values($this->roles);
2505
        }
2506
2507
        return $this;
2508
    }
2509
2510
    public function getUsernameCanonical()
2511
    {
2512
        return $this->usernameCanonical;
2513
    }
2514
2515
    public function getEmailCanonical()
2516
    {
2517
        return $this->emailCanonical;
2518
    }
2519
2520
    /**
2521
     * @param string $timezone
2522
     *
2523
     * @return User
2524
     */
2525
    public function setTimezone($timezone)
2526
    {
2527
        $this->timezone = $timezone;
2528
2529
        return $this;
2530
    }
2531
2532
    /**
2533
     * @return string
2534
     */
2535
    public function getTimezone()
2536
    {
2537
        return $this->timezone;
2538
    }
2539
2540
    /**
2541
     * @param string $locale
2542
     *
2543
     * @return User
2544
     */
2545
    public function setLocale($locale)
2546
    {
2547
        $this->locale = $locale;
2548
2549
        return $this;
2550
    }
2551
2552
    /**
2553
     * @return string
2554
     */
2555
    public function getLocale()
2556
    {
2557
        return $this->locale;
2558
    }
2559
2560
    /**
2561
     * @return string
2562
     */
2563
    public function getApiToken()
2564
    {
2565
        return $this->apiToken;
2566
    }
2567
2568
    /**
2569
     * @param string $apiToken
2570
     *
2571
     * @return User
2572
     */
2573
    public function setApiToken($apiToken)
2574
    {
2575
        $this->apiToken = $apiToken;
2576
2577
        return $this;
2578
    }
2579
2580
    public function getWebsite(): ?string
2581
    {
2582
        return $this->website;
2583
    }
2584
2585
    public function setWebsite(string $website): self
2586
    {
2587
        $this->website = $website;
2588
2589
        return $this;
2590
    }
2591
2592
    public function getBiography(): ?string
2593
    {
2594
        return $this->biography;
2595
    }
2596
2597
    public function setBiography(string $biography): self
2598
    {
2599
        $this->biography = $biography;
2600
2601
        return $this;
2602
    }
2603
2604
    /**
2605
     * @param \DateTime $dateOfBirth
2606
     *
2607
     * @return User
2608
     */
2609
    public function setDateOfBirth($dateOfBirth)
2610
    {
2611
        $this->dateOfBirth = $dateOfBirth;
2612
2613
        return $this;
2614
    }
2615
2616
    /**
2617
     * @return \DateTime
2618
     */
2619
    public function getDateOfBirth()
2620
    {
2621
        return $this->dateOfBirth;
2622
    }
2623
2624
    public function getCourseGroupsAsTutorFromCourse(Course $course): ArrayCollection
2625
    {
2626
        $criteria = Criteria::create();
2627
        $criteria->where(
2628
            Criteria::expr()->eq('cId', $course->getId())
2629
        );
2630
2631
        return $this->courseGroupsAsTutor->matching($criteria);
2632
    }
2633
2634
    /**
2635
     * Retreives this user's related sessions.
2636
     *
2637
     * @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key
2638
     *
2639
     * @return Session[]
2640
     */
2641
    public function getSessions($relationType)
2642
    {
2643
        $sessions = [];
2644
        foreach ($this->sessions as $sessionRelUser) {
2645
            if ($sessionRelUser->getRelationType() == $relationType) {
2646
                $sessions[] = $sessionRelUser->getSession();
2647
            }
2648
        }
2649
2650
        return $sessions;
2651
    }
2652
2653
    /**
2654
     * Retreives this user's related student sessions.
2655
     *
2656
     * @return Session[]
2657
     */
2658
    public function getStudentSessions()
2659
    {
2660
        return $this->getSessions(0);
2661
    }
2662
2663
    /**
2664
     * Retreives this user's related DRH sessions.
2665
     *
2666
     * @return Session[]
2667
     */
2668
    public function getDRHSessions()
2669
    {
2670
        return $this->getSessions(1);
2671
    }
2672
2673
    /**
2674
     * Get this user's related accessible sessions of a type, student by default.
2675
     *
2676
     * @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key
2677
     *
2678
     * @return Session[]
2679
     */
2680
    public function getCurrentlyAccessibleSessions($relationType = 0)
2681
    {
2682
        $sessions = [];
2683
        foreach ($this->getSessions($relationType) as $session) {
2684
            if ($session->isCurrentlyAccessible()) {
2685
                $sessions[] = $session;
2686
            }
2687
        }
2688
2689
        return $sessions;
2690
    }
2691
2692
    /**
2693
     * Get the Admin for the current user.
2694
     *
2695
     */
2696
    public function getAdmin(): Admin
2697
    {
2698
        return $this->admin;
2699
    }
2700
2701
    /**
2702
     * Sets the Admin for the current user.
2703
     *
2704
     */
2705
    public function setAdmin(Admin $admin): User
2706
    {
2707
        $this->admin = $admin;
2708
2709
        return $this;
2710
    }
2711
2712
    /**
2713
     * Sets the Gradebook Certificate's for the current user.
2714
     *
2715
     */
2716
    public function getGradebookCertificates(): ArrayCollection
2717
    {
2718
        return $this->gradebookCertificates;
2719
    }
2720
2721
    /**
2722
     * Sets the Gradebook Certificate's for the current user.
2723
     *
2724
     */
2725
    public function setGradebookCertificates(ArrayCollection $gradebookCertificates): User
2726
    {
2727
        $this->gradebookCertificates = $gradebookCertificates;
2728
2729
        return $this;
2730
    }
2731
2732
    /**
2733
     * Get the Gradebook Certificate's for the current user.
2734
     *
2735
     */
2736
    public function getGradebookEvaluations(): ArrayCollection
2737
    {
2738
        return $this->gradebookEvaluations;
2739
    }
2740
2741
    /**
2742
     * Sets the Gradebook Evaluation's for the current user.
2743
     *
2744
     */
2745
    public function setGradebookEvaluations(ArrayCollection $gradebookEvaluations): User
2746
    {
2747
        $this->gradebookEvaluations = $gradebookEvaluations;
2748
2749
        return $this;
2750
    }
2751
2752
    /**
2753
     * Get the Gradebook Evaluation's for the current user.
2754
     *
2755
     */
2756
    public function getGradebookLinks(): ArrayCollection
2757
    {
2758
        return $this->gradebookLinks;
2759
    }
2760
2761
    /**
2762
     * Sets the Gradebook Link's for the current user.
2763
     *
2764
     */
2765
    public function setGradebookLinks(ArrayCollection $gradebookLinks): User
2766
    {
2767
        $this->gradebookLinks = $gradebookLinks;
2768
2769
        return $this;
2770
    }
2771
2772
    /**
2773
     * Get the Gradebook Result's for the current user.
2774
     *
2775
     */
2776
    public function getGradebookResults(): ArrayCollection
2777
    {
2778
        return $this->gradebookResults;
2779
    }
2780
2781
    /**
2782
     * Sets the Gradebook Result's for the current user.
2783
     *
2784
     */
2785
    public function setGradebookResults(ArrayCollection $gradebookResults): User
2786
    {
2787
        $this->gradebookResults = $gradebookResults;
2788
2789
        return $this;
2790
    }
2791
2792
    /**
2793
     * Get the Gradebook Result Log's for the current user.
2794
     *
2795
     */
2796
    public function getGradebookResultLogs(): ArrayCollection
2797
    {
2798
        return $this->gradebookResultLogs;
2799
    }
2800
2801
    /**
2802
     * Sets the Gradebook Result Log's for the current user.
2803
     *
2804
     */
2805
    public function setGradebookResultLogs(ArrayCollection $gradebookResultLogs): User
2806
    {
2807
        $this->gradebookResultLogs = $gradebookResultLogs;
2808
2809
        return $this;
2810
    }
2811
2812
    /**
2813
     * Get the Gradebook Score Log's for the current user.
2814
     *
2815
     */
2816
    public function getGradebookScoreLogs(): ArrayCollection
2817
    {
2818
        return $this->gradebookScoreLogs;
2819
    }
2820
2821
    /**
2822
     * Sets the Gradebook Score Log's for the current user.
2823
     *
2824
     */
2825
    public function setGradebookScoreLogs(ArrayCollection $gradebookScoreLogs): User
2826
    {
2827
        $this->gradebookScoreLogs = $gradebookScoreLogs;
2828
2829
        return $this;
2830
    }
2831
2832
    /**
2833
     * Get the Sequence Value's for the current user.
2834
     *
2835
     */
2836
    public function getSequenceValues(): ArrayCollection
2837
    {
2838
        return $this->sequenceValues;
2839
    }
2840
2841
    /**
2842
     * Sets the Sequence Value's for the current user.
2843
     *
2844
     */
2845
    public function setSequenceValues(ArrayCollection $sequenceValues): User
2846
    {
2847
        $this->sequenceValues = $sequenceValues;
2848
2849
        return $this;
2850
    }
2851
2852
    /**
2853
     * Get the Templates's for the current user.
2854
     *
2855
     */
2856
    public function getTemplates(): ArrayCollection
2857
    {
2858
        return $this->templates;
2859
    }
2860
2861
    /**
2862
     * Sets the Templates's for the current user.
2863
     *
2864
     */
2865
    public function setTemplates(ArrayCollection $templates): User
2866
    {
2867
        $this->templates = $templates;
2868
2869
        return $this;
2870
    }
2871
2872
    /**
2873
     * Get the Track E Attemp's for the current user.
2874
     *
2875
     */
2876
    public function getTrackEAttempts(): ArrayCollection
2877
    {
2878
        return $this->trackEAttempts;
2879
    }
2880
2881
    /**
2882
     * Sets the Track E Attemp's for the current user.
2883
     *
2884
     */
2885
    public function setTrackEAttempts(ArrayCollection $trackEAttempts): User
2886
    {
2887
        $this->trackEAttempts = $trackEAttempts;
2888
        return $this;
2889
    }
2890
2891
    /**
2892
     * Get the Track E CourseA ccess 's for the current user.
2893
     *
2894
     */
2895
    public function getTrackECourseAccess(): ArrayCollection
2896
    {
2897
        return $this->trackECourseAccess;
2898
    }
2899
2900
    /**
2901
     * Sets the Track E CourseA ccess 's for the current user.
2902
     *
2903
     */
2904
    public function setTrackECourseAccess(ArrayCollection $trackECourseAccess): User
2905
    {
2906
        $this->trackECourseAccess = $trackECourseAccess;
2907
2908
        return $this;
2909
    }
2910
2911
    /**
2912
     * Get the User Course Category's for the current user.
2913
     *
2914
     */
2915
    public function getUserCourseCategorys(): ArrayCollection
2916
    {
2917
        return $this->userCourseCategorys;
2918
    }
2919
2920
    /**
2921
     * Sets the User Course Category's for the current user.
2922
     *
2923
     */
2924
    public function setUserCourseCategorys(ArrayCollection $userCourseCategorys): User
2925
    {
2926
        $this->userCourseCategorys = $userCourseCategorys;
2927
2928
        return $this;
2929
    }
2930
2931
    /**
2932
     * Get the User Rel Course Vote's for the current user.
2933
     *
2934
     */
2935
    public function getUserRelCourseVotes(): ArrayCollection
2936
    {
2937
        return $this->userRelCourseVotes;
2938
    }
2939
2940
    /**
2941
     * Sets the User Rel Course Vote's for the current user.
2942
     *
2943
     */
2944
    public function setUserRelCourseVotes(ArrayCollection $userRelCourseVotes): User
2945
    {
2946
        $this->userRelCourseVotes = $userRelCourseVotes;
2947
2948
        return $this;
2949
    }
2950
2951
    /**
2952
     * Get the User Rel Tag's for the current user.
2953
     *
2954
     */
2955
    public function getUserRelTags(): ArrayCollection
2956
    {
2957
        return $this->userRelTags;
2958
    }
2959
2960
    /**
2961
     * Sets the User Rel Tag's for the current user.
2962
     *
2963
     */
2964
    public function setUserRelTags(ArrayCollection $userRelTags): User
2965
    {
2966
        $this->userRelTags = $userRelTags;
2967
2968
        return $this;
2969
    }
2970
2971
    /**
2972
     * Get the User Rel User's for the current user.
2973
     *
2974
     */
2975
    public function getUserRelationships(): ArrayCollection
2976
    {
2977
        return $this->userRelationships;
2978
    }
2979
2980
    /**
2981
     * Sets the User Rel User's for the current user.
2982
     *
2983
     */
2984
    public function setUserRelationships(ArrayCollection $userRelationships): User
2985
    {
2986
        $this->userRelationships = $userRelationships;
2987
2988
        return $this;
2989
    }
2990
2991
    /**
2992
     * Get the Track E Exercise Confirmation's for the current user.
2993
     *
2994
     */
2995
    public function getTrackEExerciseConfirmations(): ArrayCollection
2996
    {
2997
        return $this->trackEExerciseConfirmations;
2998
    }
2999
3000
    /**
3001
     * Sets the Track E Exercise Confirmation's for the current user.
3002
     *
3003
     */
3004
    public function setTrackEExerciseConfirmations(ArrayCollection $trackEExerciseConfirmations): User
3005
    {
3006
        $this->trackEExerciseConfirmations = $trackEExerciseConfirmations;
3007
3008
        return $this;
3009
    }
3010
3011
    /**
3012
     * Get the Gradebook Linkeval Log's for the current user.
3013
     *
3014
     */
3015
    public function getGradebookLinkevalLogs(): ArrayCollection
3016
    {
3017
        return $this->gradebookLinkevalLogs;
3018
    }
3019
3020
    /**
3021
     * Sets the Gradebook Linkeval Log's for the current user.
3022
     *
3023
     */
3024
    public function setGradebookLinkevalLogs(ArrayCollection $gradebookLinkevalLogs): User
3025
    {
3026
        $this->gradebookLinkevalLogs = $gradebookLinkevalLogs;
3027
        return $this;
3028
    }
3029
3030
    /**
3031
     * Get the Course Attendance Result's for the current user.
3032
     *
3033
     */
3034
    public function getCAttendanceResults(): ArrayCollection
3035
    {
3036
        return $this->cAttendanceResults;
3037
    }
3038
3039
    /**
3040
     * Sets the Course Attendance Result's for the current user.
3041
     *
3042
     */
3043
    public function setCAttendanceResults(ArrayCollection $cAttendanceResults): User
3044
    {
3045
        $this->cAttendanceResults = $cAttendanceResults;
3046
        return $this;
3047
    }
3048
3049
    /**
3050
     *  Gets the Course Attendance Sheet's for the current user.
3051
     *
3052
     */
3053
    public function getCAttendanceSheets(): ArrayCollection
3054
    {
3055
        return $this->cAttendanceSheets;
3056
    }
3057
3058
    /**
3059
     * Sets the Course Attendance Sheet's for the current user.
3060
     *
3061
     */
3062
    public function setCAttendanceSheets(ArrayCollection $cAttendanceSheets): User
3063
    {
3064
        $this->cAttendanceSheets = $cAttendanceSheets;
3065
        return $this;
3066
    }
3067
3068
    /**
3069
     *  Gets the Course Blog Ratings's for the current user.
3070
     *
3071
     */
3072
    public function getCBlogRatings(): ArrayCollection
3073
    {
3074
        return $this->cBlogRatings;
3075
    }
3076
3077
    /**
3078
     * Sets the Course Blog Ratings's for the current user.
3079
     *
3080
     */
3081
    public function setCBlogRatings(ArrayCollection $cBlogRatings): User
3082
    {
3083
        $this->cBlogRatings = $cBlogRatings;
3084
        return $this;
3085
    }
3086
3087
    /**
3088
     *  Gets the Course Blog Relation with the current user.
3089
     *
3090
     */
3091
    public function getCBlogRelUsers(): ArrayCollection
3092
    {
3093
        return $this->cBlogRelUsers;
3094
    }
3095
3096
    /**
3097
     * Sets the Course Blog Relation with the current user.
3098
     *
3099
     */
3100
    public function setCBlogRelUsers(ArrayCollection $cBlogRelUsers): User
3101
    {
3102
        $this->cBlogRelUsers = $cBlogRelUsers;
3103
        return $this;
3104
    }
3105
3106
    /**
3107
     *  Gets the Course Blog Tak Relation with the current user.
3108
     *
3109
     */
3110
    public function getCBlogTaskRelUsers(): ArrayCollection
3111
    {
3112
        return $this->cBlogTaskRelUsers;
3113
    }
3114
3115
    /**
3116
     * Sets the Course Blog Tak Relation with the current user.
3117
     *
3118
     */
3119
    public function setCBlogTaskRelUsers(ArrayCollection $cBlogTaskRelUsers): User
3120
    {
3121
        $this->cBlogTaskRelUsers = $cBlogTaskRelUsers;
3122
        return $this;
3123
    }
3124
3125
    /**
3126
     *  Gets the Course Chat Connected for the current user.
3127
     *
3128
     */
3129
    public function getCChatConnected(): ArrayCollection
3130
    {
3131
        return $this->cChatConnected;
3132
    }
3133
3134
    /**
3135
     * Sets the Course Chat Connected for the current user.
3136
     *
3137
     */
3138
    public function setCChatConnected(ArrayCollection $cChatConnected): User
3139
    {
3140
        $this->cChatConnected = $cChatConnected;
3141
        return $this;
3142
    }
3143
3144
    /**
3145
     *  Gets the Course Dropbox Category's for the current user.
3146
     *
3147
     */
3148
    public function getCDropboxCategorys(): ArrayCollection
3149
    {
3150
        return $this->cDropboxCategorys;
3151
    }
3152
3153
    /**
3154
     * Sets the Course Dropbox Category's for the current user.
3155
     *
3156
     */
3157
    public function setCDropboxCategorys(ArrayCollection $cDropboxCategorys): User
3158
    {
3159
        $this->cDropboxCategorys = $cDropboxCategorys;
3160
        return $this;
3161
    }
3162
3163
    /**
3164
     *  Gets the Course Dropbox Person's for the current user.
3165
     *
3166
     */
3167
    public function getCDropboxPersons(): ArrayCollection
3168
    {
3169
        return $this->cDropboxPersons;
3170
    }
3171
3172
    /**
3173
     * Sets the Course Dropbox Person's for the current user.
3174
     *
3175
     */
3176
    public function setCDropboxPersons(ArrayCollection $cDropboxPersons): User
3177
    {
3178
        $this->cDropboxPersons = $cDropboxPersons;
3179
        return $this;
3180
    }
3181
3182
    /**
3183
     *  Gets the Course Forum Mailcue's for the current user.
3184
     *
3185
     */
3186
    public function getCForumMailcues(): ArrayCollection
3187
    {
3188
        return $this->cForumMailcues;
3189
    }
3190
3191
    /**
3192
     * Sets the Course Forum Mailcue's for the current user.
3193
     *
3194
     */
3195
    public function setCForumMailcues(ArrayCollection $cForumMailcues): User
3196
    {
3197
        $this->cForumMailcues = $cForumMailcues;
3198
        return $this;
3199
    }
3200
3201
    /**
3202
     *  Gets the Course Forum Notification's for the current user.
3203
     *
3204
     */
3205
    public function getCForumNotifications(): ArrayCollection
3206
    {
3207
        return $this->cForumNotifications;
3208
    }
3209
3210
    /**
3211
     * Sets the Course Forum Notification's for the current user.
3212
     *
3213
     */
3214
    public function setCForumNotifications(ArrayCollection $cForumNotifications): User
3215
    {
3216
        $this->cForumNotifications = $cForumNotifications;
3217
        return $this;
3218
    }
3219
3220
    /**
3221
     *  Gets the Course Forum Thread Qualify's for the current user.
3222
     *
3223
     */
3224
    public function getCForumThreadQualifys(): ArrayCollection
3225
    {
3226
        return $this->cForumThreadQualifys;
3227
    }
3228
3229
    /**
3230
     * Sets the Course Forum Thread Qualify's for the current user.
3231
     *
3232
     */
3233
    public function setCForumThreadQualifys(ArrayCollection $cForumThreadQualifys): User
3234
    {
3235
        $this->cForumThreadQualifys = $cForumThreadQualifys;
3236
        return $this;
3237
    }
3238
3239
    /**
3240
     *  Gets the Course Forum Thread Qualify Log's for the current user.
3241
     *
3242
     */
3243
    public function getCForumThreadQualifyLogs(): ArrayCollection
3244
    {
3245
        return $this->cForumThreadQualifyLogs;
3246
    }
3247
3248
    /**
3249
     * Sets the Course Forum Thread Qualify Log's for the current user.
3250
     *
3251
     */
3252
    public function setCForumThreadQualifyLogs(ArrayCollection $cForumThreadQualifyLogs): User
3253
    {
3254
        $this->cForumThreadQualifyLogs = $cForumThreadQualifyLogs;
3255
        return $this;
3256
    }
3257
3258
    /**
3259
     *  Gets the Course Lp View's for the current user.
3260
     *
3261
     */
3262
    public function getCLpViews(): ArrayCollection
3263
    {
3264
        return $this->cLpViews;
3265
    }
3266
3267
    /**
3268
     * Sets the Course Lp View's for the current user.
3269
     *
3270
     */
3271
    public function setCLpViews(ArrayCollection $cLpViews): User
3272
    {
3273
        $this->cLpViews = $cLpViews;
3274
        return $this;
3275
    }
3276
3277
    /**
3278
     *  Gets the Course Notebook's for the current user.
3279
     *
3280
     */
3281
    public function getCNotebooks(): ArrayCollection
3282
    {
3283
        return $this->cNotebooks;
3284
    }
3285
3286
    /**
3287
     * Sets the Course Notebook's for the current user.
3288
     *
3289
     */
3290
    public function setCNotebooks(ArrayCollection $cNotebooks): User
3291
    {
3292
        $this->cNotebooks = $cNotebooks;
3293
        return $this;
3294
    }
3295
3296
    /**
3297
     *  Gets the Course Online Connected for the current user.
3298
     *
3299
     */
3300
    public function getCOnlineConnected(): ArrayCollection
3301
    {
3302
        return $this->cOnlineConnected;
3303
    }
3304
3305
    /**
3306
     * Sets the Course Online Connected for the current user.
3307
     *
3308
     */
3309
    public function setCOnlineConnected(ArrayCollection $cOnlineConnected): User
3310
    {
3311
        $this->cOnlineConnected = $cOnlineConnected;
3312
        return $this;
3313
    }
3314
3315
    /**
3316
     *  Gets the Course Role User's for the current user.
3317
     *
3318
     */
3319
    public function getCRoleUsers(): ArrayCollection
3320
    {
3321
        return $this->cRoleUsers;
3322
    }
3323
3324
    /**
3325
     * Sets the Course Role User's for the current user.
3326
     *
3327
     */
3328
    public function setCRoleUsers(ArrayCollection $cRoleUsers): User
3329
    {
3330
        $this->cRoleUsers = $cRoleUsers;
3331
        return $this;
3332
    }
3333
3334
    /**
3335
     *  Gets the Course Student Publication's for the current user.
3336
     *
3337
     */
3338
    public function getCStudentPublications(): ArrayCollection
3339
    {
3340
        return $this->cStudentPublications;
3341
    }
3342
3343
    /**
3344
     * Sets the Course Student Publication's for the current user.
3345
     *
3346
     */
3347
    public function setCStudentPublications(ArrayCollection $cStudentPublications): User
3348
    {
3349
        $this->cStudentPublications = $cStudentPublications;
3350
        return $this;
3351
    }
3352
3353
    /**
3354
     *  Gets the Course Student Publication Comment's for the current user.
3355
     *
3356
     */
3357
    public function getCStudentPublicationComments(): ArrayCollection
3358
    {
3359
        return $this->cStudentPublicationComments;
3360
    }
3361
3362
    /**
3363
     * Sets the Course Student Publication Comment's for the current user.
3364
     *
3365
     */
3366
    public function setCStudentPublicationComments(ArrayCollection $cStudentPublicationComments): User
3367
    {
3368
        $this->cStudentPublicationComments = $cStudentPublicationComments;
3369
        return $this;
3370
    }
3371
3372
    /**
3373
     *  Gets the Course Student Publication Rel User's for the current user.
3374
     *
3375
     */
3376
    public function getCStudentPublicationRelUser(): ArrayCollection
3377
    {
3378
        return $this->CStudentPublicationRelUser;
3379
    }
3380
3381
    /**
3382
     * Sets the Course Student Publication Rel User's for the current user.
3383
     *
3384
     */
3385
    public function setCStudentPublicationRelUser(ArrayCollection $CStudentPublicationRelUser): User
3386
    {
3387
        $this->CStudentPublicationRelUser = $CStudentPublicationRelUser;
3388
        return $this;
3389
    }
3390
3391
    /**
3392
     *  Gets the Wiki's for the current user.
3393
     *
3394
     */
3395
    public function getCWiki(): ArrayCollection
3396
    {
3397
        return $this->cWiki;
3398
    }
3399
3400
    /**
3401
     * Sets the Wiki's for the current user.
3402
     *
3403
     */
3404
    public function setCWiki(ArrayCollection $cWiki): User
3405
    {
3406
        $this->cWiki = $cWiki;
3407
        return $this;
3408
    }
3409
3410
    /**
3411
     *  Gets the Wiki Mailcue's for the current user.
3412
     *
3413
     */
3414
    public function getCWikiMailcues(): ArrayCollection
3415
    {
3416
        return $this->cWikiMailcues;
3417
    }
3418
3419
    /**
3420
     * Sets the Course Wiki Mailcue's for the current user.
3421
     *
3422
     */
3423
    public function setCWikiMailcues(ArrayCollection $cWikiMailcues): User
3424
    {
3425
        $this->cWikiMailcues = $cWikiMailcues;
3426
        return $this;
3427
    }
3428
3429
    /**
3430
     * Sets the Track E Access Complete for the current user.
3431
     *
3432
     */
3433
    public function getTrackEAccessComplete(): TrackEAccessComplete
3434
    {
3435
        return $this->trackEAccessComplete;
3436
    }
3437
3438
    /**
3439
     * Get the Track E Access Complete for the current user.
3440
     *
3441
     */
3442
    public function setTrackEAccessComplete(TrackEAccessComplete $trackEAccessComplete): User
3443
    {
3444
        $this->trackEAccessComplete = $trackEAccessComplete;
3445
        return $this;
3446
    }
3447
}
3448