1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource; |
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
11
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
12
|
|
|
use Doctrine\Common\Collections\Collection; |
13
|
|
|
use Doctrine\ORM\Mapping as ORM; |
14
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @ORM\Table( |
18
|
|
|
* name="c_attendance", |
19
|
|
|
* indexes={ |
20
|
|
|
* @ORM\Index(name="active", columns={"active"}) |
21
|
|
|
* } |
22
|
|
|
* ) |
23
|
|
|
* @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CAttendanceRepository") |
24
|
|
|
*/ |
25
|
|
|
class CAttendance extends AbstractResource implements ResourceInterface |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* @ORM\Column(name="iid", type="integer") |
29
|
|
|
* @ORM\Id |
30
|
|
|
* @ORM\GeneratedValue |
31
|
|
|
*/ |
32
|
|
|
protected int $iid; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @ORM\Column(name="name", type="text", nullable=false) |
36
|
|
|
*/ |
37
|
|
|
#[Assert\NotBlank] |
38
|
|
|
protected string $name; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @ORM\Column(name="description", type="text", nullable=true) |
42
|
|
|
*/ |
43
|
|
|
protected ?string $description; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\Column(name="active", type="integer", nullable=false) |
47
|
|
|
*/ |
48
|
|
|
#[Assert\NotBlank] |
49
|
|
|
protected int $active; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @ORM\Column(name="attendance_qualify_title", type="string", length=255, nullable=true) |
53
|
|
|
*/ |
54
|
|
|
protected ?string $attendanceQualifyTitle = null; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @ORM\Column(name="attendance_qualify_max", type="integer", nullable=false) |
58
|
|
|
*/ |
59
|
|
|
protected int $attendanceQualifyMax; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @ORM\Column(name="attendance_weight", type="float", precision=6, scale=2, nullable=false) |
63
|
|
|
*/ |
64
|
|
|
#[Assert\NotNull] |
65
|
|
|
protected float $attendanceWeight; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @ORM\Column(name="locked", type="integer", nullable=false) |
69
|
|
|
*/ |
70
|
|
|
protected int $locked; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @var Collection|CAttendanceCalendar[] |
74
|
|
|
* |
75
|
|
|
* @ORM\OneToMany(targetEntity="CAttendanceCalendar", mappedBy="attendance", cascade={"persist", "remove"}) |
76
|
|
|
*/ |
77
|
|
|
protected Collection $calendars; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var Collection|CAttendanceResult[] |
81
|
|
|
* |
82
|
|
|
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CAttendanceResult", mappedBy="attendance", cascade={"persist", "remove"}) |
83
|
|
|
*/ |
84
|
|
|
protected Collection $results; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var Collection|CAttendanceSheetLog[] |
88
|
|
|
* |
89
|
|
|
* @ORM\OneToMany(targetEntity="CAttendanceSheetLog", mappedBy="attendance", cascade={"persist", "remove"}) |
90
|
|
|
*/ |
91
|
|
|
protected Collection $logs; |
92
|
|
|
|
93
|
|
|
public function __construct() |
94
|
|
|
{ |
95
|
|
|
$this->description = ''; |
96
|
|
|
$this->active = 1; |
97
|
|
|
$this->attendanceQualifyMax = 0; |
98
|
|
|
$this->locked = 0; |
99
|
|
|
$this->calendars = new ArrayCollection(); |
100
|
|
|
$this->results = new ArrayCollection(); |
101
|
|
|
$this->logs = new ArrayCollection(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function __toString(): string |
105
|
|
|
{ |
106
|
|
|
return $this->getName(); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function setName(string $name): self |
110
|
|
|
{ |
111
|
|
|
$this->name = $name; |
112
|
|
|
|
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function getName(): string |
117
|
|
|
{ |
118
|
|
|
return $this->name; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function setDescription(string $description): self |
122
|
|
|
{ |
123
|
|
|
$this->description = $description; |
124
|
|
|
|
125
|
|
|
return $this; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function getDescription(): ?string |
129
|
|
|
{ |
130
|
|
|
return $this->description; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function setActive(int $active): self |
134
|
|
|
{ |
135
|
|
|
$this->active = $active; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function getActive(): int |
141
|
|
|
{ |
142
|
|
|
return $this->active; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function setAttendanceQualifyTitle(string $attendanceQualifyTitle): self |
146
|
|
|
{ |
147
|
|
|
$this->attendanceQualifyTitle = $attendanceQualifyTitle; |
148
|
|
|
|
149
|
|
|
return $this; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function getAttendanceQualifyTitle(): ?string |
153
|
|
|
{ |
154
|
|
|
return $this->attendanceQualifyTitle; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function setAttendanceQualifyMax(int $attendanceQualifyMax): self |
158
|
|
|
{ |
159
|
|
|
$this->attendanceQualifyMax = $attendanceQualifyMax; |
160
|
|
|
|
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Get attendanceQualifyMax. |
166
|
|
|
* |
167
|
|
|
* @return int |
168
|
|
|
*/ |
169
|
|
|
public function getAttendanceQualifyMax() |
170
|
|
|
{ |
171
|
|
|
return $this->attendanceQualifyMax; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function setAttendanceWeight(float $attendanceWeight): self |
175
|
|
|
{ |
176
|
|
|
$this->attendanceWeight = $attendanceWeight; |
177
|
|
|
|
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Get attendanceWeight. |
183
|
|
|
* |
184
|
|
|
* @return float |
185
|
|
|
*/ |
186
|
|
|
public function getAttendanceWeight() |
187
|
|
|
{ |
188
|
|
|
return $this->attendanceWeight; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
public function setLocked(int $locked): self |
192
|
|
|
{ |
193
|
|
|
$this->locked = $locked; |
194
|
|
|
|
195
|
|
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Get locked. |
200
|
|
|
* |
201
|
|
|
* @return int |
202
|
|
|
*/ |
203
|
|
|
public function getLocked() |
204
|
|
|
{ |
205
|
|
|
return $this->locked; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public function getIid(): int |
209
|
|
|
{ |
210
|
|
|
return $this->iid; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function getCalendars(): Collection |
214
|
|
|
{ |
215
|
|
|
return $this->calendars; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
public function setCalendars(Collection $calendars): self |
219
|
|
|
{ |
220
|
|
|
$this->calendars = $calendars; |
221
|
|
|
|
222
|
|
|
return $this; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @return CAttendanceSheetLog[]|Collection |
227
|
|
|
*/ |
228
|
|
|
public function getLogs() |
229
|
|
|
{ |
230
|
|
|
return $this->logs; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* @param CAttendanceSheetLog[]|Collection $logs |
235
|
|
|
*/ |
236
|
|
|
public function setLogs(Collection $logs): self |
237
|
|
|
{ |
238
|
|
|
$this->logs = $logs; |
239
|
|
|
|
240
|
|
|
return $this; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return CAttendanceResult[]|Collection |
245
|
|
|
*/ |
246
|
|
|
public function getResults() |
247
|
|
|
{ |
248
|
|
|
return $this->results; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
public function setResults(Collection $results): self |
252
|
|
|
{ |
253
|
|
|
$this->results = $results; |
254
|
|
|
|
255
|
|
|
return $this; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
public function getResourceIdentifier(): int |
259
|
|
|
{ |
260
|
|
|
return $this->getIid(); |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
public function getResourceName(): string |
264
|
|
|
{ |
265
|
|
|
return $this->getName(); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
public function setResourceName(string $name): self |
269
|
|
|
{ |
270
|
|
|
return $this->setName($name); |
271
|
|
|
} |
272
|
|
|
} |
273
|
|
|
|