ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 
const AUTO_ASSIGNED_BY_RESTART = -5
 

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 58 of file class.ilPRGAssignment.php.

59 {
60 $this->id = $id;
61 $this->usr_id = $usr_id;
62 $this->events = new PRGNullEvents();
63 }

References $id, and $usr_id.

Member Function Documentation

◆ getEvents()

ilPRGAssignment::getEvents ( )

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

◆ getId()

◆ getLastChange()

ilPRGAssignment::getLastChange ( )

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

80 : ?\DateTimeImmutable
81 {
82 return $this->last_change;
83 }
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 75 of file class.ilPRGAssignment.php.

75 : int
76 {
78 }

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 170 of file class.ilPRGAssignment.php.

170 : array
171 {
172 if (!$pgs) {
173 $pgs = $this->getProgressTree();
174 }
175
176 $ret[] = $pgs;
177 foreach ($pgs->getSubnodes() as $id => $sub) {
178 $this->getProgresses($ret, $sub);
179 }
180 return $ret;
181 }
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 196 of file class.ilPRGAssignment.php.

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

◆ getProgressForNode()

ilPRGAssignment::getProgressForNode ( int  $node_id)

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

184 {
185 $pgs = $this->getProgressTree();
186 $path = $pgs->findSubnodePath((string) $node_id);
187
188 foreach ($path as $hop) {
189 if ($pgs->getId() !== $hop) {
190 $pgs = $pgs->getSubnode($hop);
191 }
192 }
193 return $pgs;
194 }
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:30

References $path.

Referenced by ilObjStudyProgramme\getCompletedCourses(), 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 160 of file class.ilPRGAssignment.php.

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

◆ getRestartDate()

ilPRGAssignment::getRestartDate ( )

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

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

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

+ Here is the caller graph for this function:

◆ getRestartedAssignmentId()

ilPRGAssignment::getRestartedAssignmentId ( )

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

110 : int
111 {
113 }

Referenced by ilPRGAssignmentDBRepository\store().

+ Here is the caller graph for this function:

◆ getRootId()

◆ getUserId()

◆ getUserInformation()

ilPRGAssignment::getUserInformation ( )

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

149 {
150 return $this->user_info;
151 }
ilPRGUserInformation $user_info
Additional information about a user, used in context of assignments.

Referenced by ilStudyProgrammeUserTable\toRow().

+ Here is the caller graph for this function:

◆ isManuallyAssigned()

ilPRGAssignment::isManuallyAssigned ( )

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

130 : bool
131 {
133 }

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

+ Here is the caller graph for this function:

◆ isRestarted()

ilPRGAssignment::isRestarted ( )

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

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

◆ withEvents()

ilPRGAssignment::withEvents ( StudyProgrammeEvents  $events)

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

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

◆ withLastChange()

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

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

88 : self {
89 if ($this->getLastChange()
90 && $this->getLastChange()->format(self::DATE_TIME_FORMAT) > $last_change->format(self::DATE_TIME_FORMAT)
91 ) {
92 throw new ilException(
93 "Cannot set last change to an earlier date:"
94 . "\ncurrent: " . $this->getLastChange()->format(self::DATE_TIME_FORMAT)
95 . "\nnew: " . $last_change,
96 1
97 );
98 }
99 $clone = clone $this;
100 $clone->last_change = $last_change;
101 $clone->last_change_by = $last_change_by;
102 return $clone;
103 }
Base class for ILIAS Exception handling.

References $last_change, and getLastChange().

+ Here is the call graph for this function:

◆ withManuallyAssigned()

ilPRGAssignment::withManuallyAssigned ( bool  $manual)

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

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

◆ withProgressTree()

ilPRGAssignment::withProgressTree ( ilPRGProgress  $progress)

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

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

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 120 of file class.ilPRGAssignment.php.

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

◆ withUserInformation()

ilPRGAssignment::withUserInformation ( ilPRGUserInformation  $user_info)

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

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

Field Documentation

◆ $events

StudyProgrammeEvents ilPRGAssignment::$events
protected

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

◆ $id

int ilPRGAssignment::$id
protected

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

Referenced by __construct(), and getId().

◆ $last_change

DateTimeImmutable ilPRGAssignment::$last_change = null
protected

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

Referenced by getLastChange(), and withLastChange().

◆ $last_change_by

int ilPRGAssignment::$last_change_by = null
protected

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

Referenced by getLastChangeBy().

◆ $manually_assigned

bool ilPRGAssignment::$manually_assigned
protected

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

◆ $progress

ilPRGProgress ilPRGAssignment::$progress
protected

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

◆ $progresses

array ilPRGAssignment::$progresses = []
protected

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

◆ $restarted_asssignment_id

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

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

◆ $user_info

ilPRGUserInformation ilPRGAssignment::$user_info
protected

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

◆ $usr_id

int ilPRGAssignment::$usr_id
protected

Definition at line 44 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_RESTART

const ilPRGAssignment::AUTO_ASSIGNED_BY_RESTART = -5

◆ 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 47 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: