ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $id, and $usr_id.

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...

Member Function Documentation

◆ getEvents()

ilPRGAssignment::getEvents ( )

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

References $events.

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.

References $last_change.

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

79  : ?\DateTimeImmutable
80  {
81  return $this->last_change;
82  }
DateTimeImmutable $last_change
+ Here is the caller graph for this function:

◆ getLastChangeBy()

ilPRGAssignment::getLastChangeBy ( )

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

References $last_change_by.

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

74  : int
75  {
76  return $this->last_change_by;
77  }
+ 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.

References getProgressTree().

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

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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProgressesWithDeadline()

ilPRGAssignment::getProgressesWithDeadline ( DateTimeImmutable  $deadline)

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

References getProgresses().

197  : array {
198  return array_values(array_filter(
199  $this->getProgresses(),
200  fn ($pgs) => ! is_null($pgs->getDeadline()) && $pgs->getDeadline() <= $deadline
201  ));
202  }
getProgresses(array &$ret=[], ilPRGProgress $pgs=null)
+ Here is the call graph for this function:

◆ getProgressForNode()

ilPRGAssignment::getProgressForNode ( int  $node_id)

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

References $path, and getProgressTree().

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

182  : ilPRGProgress
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  }
$path
Definition: ltiservices.php:32
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProgressTree()

ilPRGAssignment::getProgressTree ( )

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

References $progress.

Referenced by ilStudyProgrammeMailTemplateContext\getLatestAssignment(), ilStudyProgrammePlaceholderValues\getLatestSuccessfulAssignment(), ilStudyProgrammeMailTemplateContext\getLatestSuccessfulAssignment(), getProgresses(), and getProgressForNode().

159  : ilPRGProgress
160  {
161  return $this->progress;
162  }
A Progress is the status of a user on a single node of an assignment; it is unique by assignment_id:u...
+ Here is the caller graph for this function:

◆ getRestartDate()

ilPRGAssignment::getRestartDate ( )

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

References $restart_date.

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

104  : ?\DateTimeImmutable
105  {
106  return $this->restart_date;
107  }
DateTimeImmutable $restart_date
+ Here is the caller graph for this function:

◆ getRestartedAssignmentId()

ilPRGAssignment::getRestartedAssignmentId ( )

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

References $restarted_asssignment_id.

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

109  : int
110  {
112  }
+ Here is the caller graph for this function:

◆ getRootId()

◆ getUserId()

◆ getUserInformation()

ilPRGAssignment::getUserInformation ( )

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

References $user_info.

Referenced by ilPRGMail\sendMail(), and ilStudyProgrammeUserTable\toRow().

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...
+ Here is the caller graph for this function:

◆ isManuallyAssigned()

ilPRGAssignment::isManuallyAssigned ( )

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

References $manually_assigned.

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

129  : bool
130  {
132  }
+ Here is the caller graph for this function:

◆ isRestarted()

ilPRGAssignment::isRestarted ( )

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

References getRestartedAssignmentId().

114  : bool
115  {
116  return $this->getRestartedAssignmentId() !== -1;
117  }
+ Here is the call graph for this function:

◆ withEvents()

ilPRGAssignment::withEvents ( StudyProgrammeEvents  $events)

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

References $events.

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

◆ withLastChange()

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

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

References $last_change, $last_change_by, and getLastChange().

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  }
DateTimeImmutable $last_change
+ 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.

References $progress.

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

153  : self
154  {
155  $clone = clone $this;
156  $clone->progress = $progress;
157  return $clone;
158  }
+ 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.

References $restart_date, and $restarted_asssignment_id.

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

◆ withUserInformation()

ilPRGAssignment::withUserInformation ( ilPRGUserInformation  $user_info)

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

References $user_info.

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

Field Documentation

◆ $events

StudyProgrammeEvents ilPRGAssignment::$events
protected

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

Referenced by getEvents(), and withEvents().

◆ $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(), and withLastChange().

◆ $manually_assigned

bool ilPRGAssignment::$manually_assigned
protected

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

Referenced by isManuallyAssigned().

◆ $progress

ilPRGProgress ilPRGAssignment::$progress
protected

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

Referenced by getProgressTree(), and withProgressTree().

◆ $progresses

array ilPRGAssignment::$progresses = []
protected

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

◆ $restart_date

DateTimeImmutable ilPRGAssignment::$restart_date = null
protected

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

Referenced by getRestartDate(), and withRestarted().

◆ $restarted_asssignment_id

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

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

Referenced by getRestartedAssignmentId(), and withRestarted().

◆ $user_info

ilPRGUserInformation ilPRGAssignment::$user_info
protected

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

Referenced by getUserInformation(), and withUserInformation().

◆ $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

◆ NO_RESTARTED_ASSIGNMENT

const ilPRGAssignment::NO_RESTARTED_ASSIGNMENT = -1

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

Referenced by ilPRGAssignmentDBRepository\createFor().


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