3 declare(strict_types=1);
10 const TABLE =
'prg_usr_progress';
45 self::FIELD_ID => $id,
46 self::FIELD_ASSIGNMENT_ID => $ass->
getId(),
47 self::FIELD_PRG_ID => $prg->
getObjId(),
50 self::FIELD_POINTS_CUR => 0,
52 self::FIELD_COMPLETION_BY => null,
55 self::FIELD_LAST_CHANGE_BY => null,
56 self::FIELD_COMPLETION_DATE => null,
57 self::FIELD_DEADLINE => null,
58 self::FIELD_VQ_DATE => null,
59 self::FIELD_INVALIDATED => 0
72 foreach ($this->
loadByFilter([self::FIELD_ID => $id]) as $row) {
103 self::FIELD_PRG_ID => $prg_id,
104 self::FIELD_ASSIGNMENT_ID => $assignment_id
108 foreach (
$rows as $row) {
121 foreach ($this->
loadByFilter([self::FIELD_PRG_ID => $prg_id, self::FIELD_USR_ID => $usr_id]) as $row) {
135 foreach ($this->
loadByFilter([self::FIELD_PRG_ID => $prg_id]) as $row) {
147 foreach ($this->
loadByFilter([self::FIELD_PRG_ID => $prg_id]) as $row) {
160 foreach ($this->
loadByFilter([self::FIELD_ASSIGNMENT_ID => $assignment_id]) as $row) {
215 self::FIELD_ID => $progress->
getId(),
217 self::FIELD_PRG_ID => $progress->
getNodeId(),
218 self::FIELD_USR_ID => $progress->
getUserId(),
219 self::FIELD_STATUS => $progress->
getStatus(),
226 self::FIELD_COMPLETION_DATE =>
231 self::FIELD_INVALIDATED => $progress->
isInvalidated() ? 1 : 0
241 $this->
deleteDB($progress->getId());
249 self::FIELD_ID => [
'integer', $row[self::FIELD_ID]]
250 , self::FIELD_ASSIGNMENT_ID => [
'integer', $row[self::FIELD_ASSIGNMENT_ID]]
251 , self::FIELD_PRG_ID => [
'integer', $row[self::FIELD_PRG_ID]]
252 , self::FIELD_USR_ID => [
'integer', $row[self::FIELD_USR_ID]]
253 , self::FIELD_STATUS => [
'integer', $row[self::FIELD_STATUS]]
254 , self::FIELD_POINTS => [
'integer', $row[self::FIELD_POINTS]]
255 , self::FIELD_POINTS_CUR => [
'integer', $row[self::FIELD_POINTS_CUR]]
256 , self::FIELD_COMPLETION_BY => [
'integer', $row[self::FIELD_COMPLETION_BY]]
257 , self::FIELD_LAST_CHANGE_BY => [
'integer', $row[self::FIELD_LAST_CHANGE_BY]]
258 , self::FIELD_LAST_CHANGE => [
'text', $row[self::FIELD_LAST_CHANGE]]
259 , self::FIELD_ASSIGNMENT_DATE => [
'timestamp', $row[self::FIELD_ASSIGNMENT_DATE]]
260 , self::FIELD_COMPLETION_DATE => [
'timestamp', $row[self::FIELD_COMPLETION_DATE]]
261 , self::FIELD_DEADLINE => [
'text', $row[self::FIELD_DEADLINE]]
262 , self::FIELD_VQ_DATE => [
'timestamp', $row[self::FIELD_VQ_DATE]]
263 , self::FIELD_INVALIDATED => [
'timestamp', $row[self::FIELD_INVALIDATED]]
270 $this->db->manipulate(
271 'DELETE FROM ' . self::TABLE .
' WHERE ' . self::FIELD_ID .
' = ' . $this->db->quote($id,
'integer')
285 self::FIELD_MAIL_SEND => [
291 $this->db->update(self::TABLE, $values, $where);
299 $data[self::FIELD_ID]
304 self::FIELD_ASSIGNMENT_ID => [
306 $data[self::FIELD_ASSIGNMENT_ID]
308 self::FIELD_PRG_ID => [
310 $data[self::FIELD_PRG_ID]
312 self::FIELD_USR_ID => [
314 $data[self::FIELD_USR_ID]
316 self::FIELD_STATUS => [
318 $data[self::FIELD_STATUS]
320 self::FIELD_POINTS => [
322 $data[self::FIELD_POINTS]
324 self::FIELD_POINTS_CUR => [
326 $data[self::FIELD_POINTS_CUR]
328 self::FIELD_COMPLETION_BY => [
330 $data[self::FIELD_COMPLETION_BY]
332 self::FIELD_LAST_CHANGE_BY => [
334 $data[self::FIELD_LAST_CHANGE_BY]
336 self::FIELD_LAST_CHANGE => [
338 $data[self::FIELD_LAST_CHANGE]
340 self::FIELD_ASSIGNMENT_DATE => [
342 $data[self::FIELD_ASSIGNMENT_DATE]
344 self::FIELD_COMPLETION_DATE => [
346 $data[self::FIELD_COMPLETION_DATE]
348 self::FIELD_DEADLINE => [
350 $data[self::FIELD_DEADLINE]
352 self::FIELD_VQ_DATE => [
354 $data[self::FIELD_VQ_DATE]
356 self::FIELD_INVALIDATED => [
358 $data[self::FIELD_INVALIDATED]
362 $this->db->update(self::TABLE, $values, $where);
371 ->setAssignmentId((
int) $row[self::FIELD_ASSIGNMENT_ID])
372 ->setNodeId((
int) $row[self::FIELD_PRG_ID])
373 ->setUserId((
int) $row[self::FIELD_USR_ID])
374 ->setStatus((
int) $row[self::FIELD_STATUS])
375 ->setAmountOfPoints((
int) $row[self::FIELD_POINTS])
376 ->setCurrentAmountOfPoints((
int) $row[self::FIELD_POINTS_CUR])
377 ->setCompletionBy((
int) $row[self::FIELD_COMPLETION_BY])
379 $row[self::FIELD_DEADLINE] ?
387 $row[self::FIELD_COMPLETION_DATE] ?
392 $row[self::FIELD_LAST_CHANGE] ?
396 ->setValidityOfQualification(
397 $row[self::FIELD_VQ_DATE] ?
401 if ((
int) $row[self::FIELD_INVALIDATED] === 1) {
405 if (!is_null($row[self::FIELD_LAST_CHANGE_BY])) {
406 $prgrs = $prgrs->setLastChangeBy((
int) $row[self::FIELD_LAST_CHANGE_BY]);
416 foreach ($filter as $field => $value) {
417 $q .=
' AND ' . $field .
' = ' . $this->db->quote($value,
'text');
419 $res = $this->db->query($q);
420 while ($rec = $this->db->fetchAssoc(
$res)) {
428 .
' WHERE ' . $this->db->in(
437 .
' AND ' . self::FIELD_VQ_DATE .
' IS NOT NULL' 438 .
' AND DATE(' . self::FIELD_VQ_DATE .
') < ' 443 .
' AND ' . self::FIELD_INVALIDATED .
' != 1 OR ' . self::FIELD_INVALIDATED .
' IS NULL';
445 $res = $this->db->query($q);
446 while ($rec = $this->db->fetchAssoc(
$res)) {
455 .
'WHERE ' . $this->db->in(
464 .
'AND ' . self::FIELD_DEADLINE .
' IS NOT NULL' . PHP_EOL
465 .
'AND DATE(' . self::FIELD_DEADLINE .
') < ' . $this->db->quote(
470 $res = $this->db->query($q);
471 while ($rec = $this->db->fetchAssoc(
$res)) {
479 .
' WHERE ' . $this->db->in(
488 .
' AND ' . self::FIELD_DEADLINE .
' IS NOT NULL' 489 .
' AND DATE(' . self::FIELD_DEADLINE .
') < ' 494 .
' AND ' . self::FIELD_MAIL_SEND .
' IS NULL' 496 $res = $this->db->query($q);
497 while ($rec = $this->db->fetchAssoc(
$res)) {
504 return 'SELECT ' . self::FIELD_ID
505 .
', ' . self::FIELD_ASSIGNMENT_ID
506 .
', ' . self::FIELD_PRG_ID
507 .
', ' . self::FIELD_USR_ID
508 .
', ' . self::FIELD_STATUS
509 .
', ' . self::FIELD_POINTS
510 .
', ' . self::FIELD_POINTS_CUR
511 .
', ' . self::FIELD_COMPLETION_BY
512 .
', ' . self::FIELD_LAST_CHANGE
513 .
', ' . self::FIELD_LAST_CHANGE_BY
514 .
', ' . self::FIELD_ASSIGNMENT_DATE
515 .
', ' . self::FIELD_COMPLETION_DATE
516 .
', ' . self::FIELD_DEADLINE
517 .
', ' . self::FIELD_VQ_DATE
518 .
', ' . self::FIELD_INVALIDATED
519 .
' FROM ' . self::TABLE;
524 return (
int) $this->db->nextId(self::TABLE);
createFor(ilStudyProgrammeSettings $prg, ilStudyProgrammeAssignment $ass)
Create a record corresponding to a progress and return corresponding object.Will throw if a record al...
const FIELD_COMPLETION_BY
__construct(ilDBInterface $db)
readExpiredSuccessfull()
Load all progress objects which are successfull and whose validity is expired.
getUserId()
Get the id of the user who is assigned.
readByIds(int $prg_id, int $assignment_id, int $usr_id)
Load progress belonging to a prg id and assignment.Will throw if the record does not exist yet...
getAssignmentId()
Get the assignment, this progress belongs to.
getLastChangeBy()
Get the id of the user who did the last change on this assignment.
readRiskyToFailInstances()
read(int $id)
Load progress belonging to a id.Will throw if the record does not exist yet.
getCurrentAmountOfPoints()
Get the amount of points the user currently has achieved on the node.
update(ilStudyProgrammeProgress $progress)
Update record corresponding to progress.Will throw if the record does not exist yet.
getDeadline()
Get the deadline of this progress.
readByPrgId(int $prg_id)
Load progress objects belonging to a prg id.
loadRiskyToFailInstance()
getCompletionDate()
Get the timestamp of the complition of this progress.
const FIELD_COMPLETION_DATE
readByPrgIdAndAssignmentId(int $prg_id, int $assignment_id)
Load progress belonging to a prg id and assignment.Will throw if the record does not exist yet...
getCompletionBy()
Get the id of object or user that lead to the successful completion of this node. ...
static now()
Return current timestamp in Y-m-d H:i:s format.
loadByFilter(array $filter)
getId()
Get the id of the progress.
getStatus()
Get the status the user has on this node.
foreach($_POST as $key=> $value) $res
readByAssignmentId(int $assignment_id)
Load progress objects belonging to an assignment id.Will throw if the record does not exist yet...
getAmountOfPoints()
Get the amount of points the user needs to achieve on the subnodes of this node.
readFirstByPrgId(int $prg_id)
Class ilStudyProgrammeAssignment.
const FIELD_ASSIGNMENT_DATE
getUserId()
Get the id of the user this progress is for.
Class ilStudyProgrammeProgress.
getObjId()
Get the id of the study program.
readByPrgIdAndUserId(int $prg_id, int $usr_id)
Load progress objects belonging to a prg id and a user id.
getAssignmentDate()
Get the date of assignment.
reminderSendFor(int $progress_id)
Covers the persistence of settings belonging to a study programme (SP).
getLastChange()
Get the timestamp of the last change on this progress.
getNodeId()
Get the id of the program node this progress belongs to.
invalidate()
Toggle invalidated.
const FIELD_LAST_CHANGE_BY
getValidityOfQualification()
Get the limited validity of qualification date.
const FIELD_ASSIGNMENT_ID
getId()
Get the id of the assignment.