1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* For licensing terms, see /license.txt */ |
4
|
|
|
|
5
|
|
|
declare(strict_types=1); |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\User; |
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
11
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
12
|
|
|
|
13
|
|
|
#[ORM\Table(name: 'c_attendance_sheet')] |
14
|
|
|
#[ORM\Index(columns: ['presence'], name: 'presence')] |
15
|
|
|
#[ORM\Entity] |
16
|
|
|
class CAttendanceSheet |
17
|
|
|
{ |
18
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
19
|
|
|
#[ORM\Id] |
20
|
|
|
#[ORM\GeneratedValue] |
21
|
|
|
protected ?int $iid = null; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Attendance status for each user on a given date: |
25
|
|
|
* - 0: Absent (Score: 0) |
26
|
|
|
* - 1: Present (Score: 1) |
27
|
|
|
* - 2: Late less than 15 minutes (Score: 1) |
28
|
|
|
* - 3: Late more than 15 minutes (Score: 0.5) |
29
|
|
|
* - 4: Absent but justified (Score: 0.25) |
30
|
|
|
* |
31
|
|
|
* Scores are tentative and can be used for gradebook calculations. |
32
|
|
|
*/ |
33
|
|
|
#[Assert\NotNull] |
34
|
|
|
#[ORM\Column(name: 'presence', type: 'integer', nullable: true)] |
35
|
|
|
protected ?int $presence = null; |
36
|
|
|
|
37
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
38
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
39
|
|
|
protected User $user; |
40
|
|
|
|
41
|
|
|
#[ORM\ManyToOne(targetEntity: CAttendanceCalendar::class, inversedBy: 'sheets')] |
42
|
|
|
#[ORM\JoinColumn(name: 'attendance_calendar_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
43
|
|
|
protected CAttendanceCalendar $attendanceCalendar; |
44
|
|
|
|
45
|
|
|
#[ORM\Column(name: 'signature', type: 'text', nullable: true)] |
46
|
|
|
protected ?string $signature; |
47
|
|
|
|
48
|
|
|
public function getIid(): ?int |
49
|
|
|
{ |
50
|
|
|
return $this->iid; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function setPresence(?int $presence): self |
54
|
|
|
{ |
55
|
|
|
$this->presence = $presence; |
56
|
|
|
|
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getPresence(): ?int |
61
|
|
|
{ |
62
|
|
|
return $this->presence; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setSignature(?string $signature): static |
66
|
|
|
{ |
67
|
|
|
$this->signature = $signature; |
68
|
|
|
|
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function getSignature(): ?string |
73
|
|
|
{ |
74
|
|
|
return $this->signature; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function getUser(): User |
78
|
|
|
{ |
79
|
|
|
return $this->user; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function setUser(User $user): self |
83
|
|
|
{ |
84
|
|
|
$this->user = $user; |
85
|
|
|
|
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function getAttendanceCalendar(): CAttendanceCalendar |
90
|
|
|
{ |
91
|
|
|
return $this->attendanceCalendar; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function setAttendanceCalendar(CAttendanceCalendar $attendanceCalendar): self |
95
|
|
|
{ |
96
|
|
|
$this->attendanceCalendar = $attendanceCalendar; |
97
|
|
|
|
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|