ILIAS  release_8 Revision v8.24
ilPRGAssignment Class Reference

Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PRG-tree. More...

+ Collaboration diagram for ilPRGAssignment:

Public Member Functions

 __construct (int $id, int $usr_id)
 
 getId ()
 
 getUserId ()
 
 getLastChangeBy ()
 
 getLastChange ()
 
 withLastChange (int $last_change_by, \DateTimeImmutable $last_change)
 
 getRestartDate ()
 
 getRestartedAssignmentId ()
 
 isRestarted ()
 
 withRestarted (int $restarted_asssignment_id, \DateTimeImmutable $restart_date=null)
 
 isManuallyAssigned ()
 
 withManuallyAssigned (bool $manual)
 
 withUserInformation (ilPRGUserInformation $user_info)
 
 getUserInformation ()
 
 withProgressTree (ilPRGProgress $progress)
 
 getProgressTree ()
 
 getRootId ()
 
 getProgresses (array &$ret=[], ilPRGProgress $pgs=null)
 
 getProgressForNode (int $node_id)
 
 getProgressesWithDeadline (DateTimeImmutable $deadline)
 
 withEvents (StudyProgrammeEvents $events)
 
 getEvents ()
 

Data Fields

const DATE_TIME_FORMAT = 'Y-m-d H:i:s'
 
const DATE_FORMAT = 'Y-m-d'
 
const NO_RESTARTED_ASSIGNMENT = -1
 
const AUTO_ASSIGNED_BY_ROLE = -1
 
const AUTO_ASSIGNED_BY_ORGU = -2
 
const AUTO_ASSIGNED_BY_COURSE = -3
 
const AUTO_ASSIGNED_BY_GROUP = -4
 

Protected Attributes

int $id
 
int $usr_id
 
DateTimeImmutable $last_change = null
 
int $last_change_by = null
 
 DateTimeImmutable$restart_date = null
 
int $restarted_asssignment_id = self::NO_RESTARTED_ASSIGNMENT
 
bool $manually_assigned
 
array $progresses = []
 
ilPRGProgress $progress
 
ilPRGUserInformation $user_info
 
StudyProgrammeEvents $events
 

Detailed Description

Assignments are relations of users to a PRG; They hold progress-information for (sub-)nodes of the PRG-tree.

Definition at line 28 of file class.ilPRGAssignment.php.

Constructor & Destructor Documentation

◆ __construct()

ilPRGAssignment::__construct ( int  $id,
int  $usr_id 
)

Definition at line 57 of file class.ilPRGAssignment.php.

58 {
59 $this->id = $id;
60 $this->usr_id = $usr_id;
61 $this->events = new PRGNullEvents();
62 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $id, and $usr_id.

Member Function Documentation

◆ getEvents()

ilPRGAssignment::getEvents ( )

Definition at line 211 of file class.ilPRGAssignment.php.

212 {
213 return $this->events;
214 }
StudyProgrammeEvents $events
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getId()

◆ getLastChange()

ilPRGAssignment::getLastChange ( )

Definition at line 79 of file class.ilPRGAssignment.php.

79 : ?\DateTimeImmutable
80 {
81 return $this->last_change;
82 }
DateTimeImmutable $last_change

References $last_change.

Referenced by ilPRGAssignmentDBRepository\store(), and withLastChange().

+ Here is the caller graph for this function:

◆ getLastChangeBy()

ilPRGAssignment::getLastChangeBy ( )

Definition at line 74 of file class.ilPRGAssignment.php.

74 : int
75 {
77 }

References $last_change_by.

Referenced by ilPRGAssignmentDBRepository\store(), and ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ getProgresses()

ilPRGAssignment::getProgresses ( array &  $ret = [],
ilPRGProgress  $pgs = null 
)

Definition at line 169 of file class.ilPRGAssignment.php.

169 : array
170 {
171 if (!$pgs) {
172 $pgs = $this->getProgressTree();
173 }
174
175 $ret[] = $pgs;
176 foreach ($pgs->getSubnodes() as $id => $sub) {
177 $this->getProgresses($ret, $sub);
178 }
179 return $ret;
180 }
getProgresses(array &$ret=[], ilPRGProgress $pgs=null)

References $id.

Referenced by ilObjStudyProgramme\removeAssignment(), and ilPRGAssignmentDBRepository\store().

+ Here is the caller graph for this function:

◆ getProgressesWithDeadline()

ilPRGAssignment::getProgressesWithDeadline ( DateTimeImmutable  $deadline)

Definition at line 195 of file class.ilPRGAssignment.php.

197 : array {
198 return array_values(array_filter(
199 $this->getProgresses(),
200 fn ($pgs) => ! is_null($pgs->getDeadline()) && $pgs->getDeadline() <= $deadline
201 ));
202 }

◆ getProgressForNode()

ilPRGAssignment::getProgressForNode ( int  $node_id)

Definition at line 182 of file class.ilPRGAssignment.php.

183 {
184 $pgs = $this->getProgressTree();
185 $path = $pgs->findSubnodePath((string) $node_id);
186
187 foreach ($path as $hop) {
188 if ($pgs->getId() !== $hop) {
189 $pgs = $pgs->getSubnode($hop);
190 }
191 }
192 return $pgs;
193 }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
$path
Definition: ltiservices.php:32

References $path.

Referenced by ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsChangePoints(), ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsInitDates(), ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsMarkAccredited(), ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsMarkRelevant(), ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsSucceedAndDeadline(), and ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ getProgressTree()

ilPRGAssignment::getProgressTree ( )

Definition at line 159 of file class.ilPRGAssignment.php.

160 {
161 return $this->progress;
162 }

◆ getRestartDate()

ilPRGAssignment::getRestartDate ( )

Definition at line 104 of file class.ilPRGAssignment.php.

104 : ?\DateTimeImmutable
105 {
106 return $this->restart_date;
107 }

Referenced by ilPRGAssignmentDBRepository\store(), and ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ getRestartedAssignmentId()

ilPRGAssignment::getRestartedAssignmentId ( )

Definition at line 109 of file class.ilPRGAssignment.php.

109 : int
110 {
112 }

Referenced by ilPRGAssignmentDBRepository\store().

+ Here is the caller graph for this function:

◆ getRootId()

◆ getUserId()

◆ getUserInformation()

ilPRGAssignment::getUserInformation ( )

Definition at line 147 of file class.ilPRGAssignment.php.

148 {
149 return $this->user_info;
150 }
ilPRGUserInformation $user_info
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ isManuallyAssigned()

ilPRGAssignment::isManuallyAssigned ( )

Definition at line 129 of file class.ilPRGAssignment.php.

129 : bool
130 {
132 }

Referenced by ilPRGAssignmentDBRepository\store(), and ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ isRestarted()

ilPRGAssignment::isRestarted ( )

Definition at line 114 of file class.ilPRGAssignment.php.

114 : bool
115 {
116 return $this->getRestartedAssignmentId() !== -1;
117 }

◆ withEvents()

ilPRGAssignment::withEvents ( StudyProgrammeEvents  $events)

Definition at line 204 of file class.ilPRGAssignment.php.

204 : self
205 {
206 $clone = clone $this;
207 $clone->events = $events;
208 return $clone;
209 }

◆ withLastChange()

ilPRGAssignment::withLastChange ( int  $last_change_by,
\DateTimeImmutable  $last_change 
)

Definition at line 84 of file class.ilPRGAssignment.php.

87 : self {
88 if ($this->getLastChange()
89 && $this->getLastChange()->format(self::DATE_TIME_FORMAT) > $last_change->format(self::DATE_TIME_FORMAT)
90 ) {
91 throw new ilException(
92 "Cannot set last change to an earlier date:"
93 . "\ncurrent: " . $this->getLastChange()->format(self::DATE_TIME_FORMAT)
94 . "\nnew: " . $last_change,
95 1
96 );
97 }
98 $clone = clone $this;
99 $clone->last_change = $last_change;
100 $clone->last_change_by = $last_change_by;
101 return $clone;
102 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $last_change, and getLastChange().

+ Here is the call graph for this function:

◆ withManuallyAssigned()

ilPRGAssignment::withManuallyAssigned ( bool  $manual)

Definition at line 134 of file class.ilPRGAssignment.php.

134 : self
135 {
136 $clone = clone $this;
137 $clone->manually_assigned = $manual;
138 return $clone;
139 }

◆ withProgressTree()

ilPRGAssignment::withProgressTree ( ilPRGProgress  $progress)

Definition at line 153 of file class.ilPRGAssignment.php.

153 : self
154 {
155 $clone = clone $this;
156 $clone->progress = $progress;
157 return $clone;
158 }

Referenced by ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsMarkAccredited(), and ilStudyProgrammeAssignmentActionsTest\testPRGAssignmentActionsSucceedAndDeadline().

+ Here is the caller graph for this function:

◆ withRestarted()

ilPRGAssignment::withRestarted ( int  $restarted_asssignment_id,
\DateTimeImmutable  $restart_date = null 
)

Definition at line 119 of file class.ilPRGAssignment.php.

122 : self {
123 $clone = clone $this;
124 $clone->restarted_asssignment_id = $restarted_asssignment_id;
125 $clone->restart_date = $restart_date;
126 return $clone;
127 }

◆ withUserInformation()

ilPRGAssignment::withUserInformation ( ilPRGUserInformation  $user_info)

Definition at line 141 of file class.ilPRGAssignment.php.

141 : self
142 {
143 $clone = clone $this;
144 $clone->user_info = $user_info;
145 return $clone;
146 }

Field Documentation

◆ $events

StudyProgrammeEvents ilPRGAssignment::$events
protected

Definition at line 55 of file class.ilPRGAssignment.php.

◆ $id

int ilPRGAssignment::$id
protected

Definition at line 42 of file class.ilPRGAssignment.php.

Referenced by __construct(), and getId().

◆ $last_change

DateTimeImmutable ilPRGAssignment::$last_change = null
protected

Definition at line 44 of file class.ilPRGAssignment.php.

Referenced by getLastChange(), and withLastChange().

◆ $last_change_by

int ilPRGAssignment::$last_change_by = null
protected

Definition at line 45 of file class.ilPRGAssignment.php.

Referenced by getLastChangeBy().

◆ $manually_assigned

bool ilPRGAssignment::$manually_assigned
protected

Definition at line 48 of file class.ilPRGAssignment.php.

◆ $progress

ilPRGProgress ilPRGAssignment::$progress
protected

Definition at line 53 of file class.ilPRGAssignment.php.

◆ $progresses

array ilPRGAssignment::$progresses = []
protected

Definition at line 52 of file class.ilPRGAssignment.php.

◆ $restarted_asssignment_id

int ilPRGAssignment::$restarted_asssignment_id = self::NO_RESTARTED_ASSIGNMENT
protected

Definition at line 47 of file class.ilPRGAssignment.php.

◆ $user_info

ilPRGUserInformation ilPRGAssignment::$user_info
protected

Definition at line 54 of file class.ilPRGAssignment.php.

◆ $usr_id

int ilPRGAssignment::$usr_id
protected

Definition at line 43 of file class.ilPRGAssignment.php.

Referenced by __construct(), and getUserId().

◆ AUTO_ASSIGNED_BY_COURSE

const ilPRGAssignment::AUTO_ASSIGNED_BY_COURSE = -3

Definition at line 39 of file class.ilPRGAssignment.php.

◆ AUTO_ASSIGNED_BY_GROUP

const ilPRGAssignment::AUTO_ASSIGNED_BY_GROUP = -4

Definition at line 40 of file class.ilPRGAssignment.php.

◆ AUTO_ASSIGNED_BY_ORGU

const ilPRGAssignment::AUTO_ASSIGNED_BY_ORGU = -2

Definition at line 38 of file class.ilPRGAssignment.php.

◆ AUTO_ASSIGNED_BY_ROLE

const ilPRGAssignment::AUTO_ASSIGNED_BY_ROLE = -1

Definition at line 37 of file class.ilPRGAssignment.php.

◆ DATE_FORMAT

const ilPRGAssignment::DATE_FORMAT = 'Y-m-d'

Definition at line 33 of file class.ilPRGAssignment.php.

◆ DATE_TIME_FORMAT

◆ DateTimeImmutable$restart_date

ilPRGAssignment::DateTimeImmutable$restart_date = null
protected

Definition at line 46 of file class.ilPRGAssignment.php.

◆ NO_RESTARTED_ASSIGNMENT

const ilPRGAssignment::NO_RESTARTED_ASSIGNMENT = -1

Definition at line 35 of file class.ilPRGAssignment.php.


The documentation for this class was generated from the following file: