ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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
 
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.

References $id, and $usr_id.

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

Member Function Documentation

◆ getEvents()

ilPRGAssignment::getEvents ( )

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

References $events.

213  {
214  return $this->events;
215  }
StudyProgrammeEvents $events

◆ getId()

◆ getLastChange()

ilPRGAssignment::getLastChange ( )

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

References $last_change.

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

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

◆ getLastChangeBy()

ilPRGAssignment::getLastChangeBy ( )

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

References $last_change_by.

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

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

References getProgressTree().

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

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

◆ getProgressesWithDeadline()

ilPRGAssignment::getProgressesWithDeadline ( DateTimeImmutable  $deadline)

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

References getProgresses().

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

◆ getProgressForNode()

ilPRGAssignment::getProgressForNode ( int  $node_id)

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

References $path, and getProgressTree().

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

183  : ilPRGProgress
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  }
$path
Definition: ltiservices.php:29
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 ( )

◆ getRestartDate()

ilPRGAssignment::getRestartDate ( )

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

References $restart_date.

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

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

◆ getRestartedAssignmentId()

ilPRGAssignment::getRestartedAssignmentId ( )

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

References $restarted_asssignment_id.

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

110  : int
111  {
113  }
+ Here is the caller graph for this function:

◆ getRootId()

◆ getUserId()

◆ getUserInformation()

ilPRGAssignment::getUserInformation ( )

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

References $user_info.

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

149  {
150  return $this->user_info;
151  }
ilPRGUserInformation $user_info
Additional information about a user, used in context of assignments.
+ Here is the caller graph for this function:

◆ isManuallyAssigned()

ilPRGAssignment::isManuallyAssigned ( )

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

References $manually_assigned.

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

130  : bool
131  {
133  }
+ Here is the caller graph for this function:

◆ isRestarted()

ilPRGAssignment::isRestarted ( )

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

References getRestartedAssignmentId().

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

◆ withEvents()

ilPRGAssignment::withEvents ( StudyProgrammeEvents  $events)

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

References $events.

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

◆ withLastChange()

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

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

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

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

References $progress.

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

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

References $restart_date, and $restarted_asssignment_id.

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

◆ withUserInformation()

ilPRGAssignment::withUserInformation ( ilPRGUserInformation  $user_info)

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

References $user_info.

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

Field Documentation

◆ $events

StudyProgrammeEvents ilPRGAssignment::$events
protected

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

Referenced by getEvents(), and withEvents().

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

◆ $manually_assigned

bool ilPRGAssignment::$manually_assigned
protected

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

Referenced by isManuallyAssigned().

◆ $progress

ilPRGProgress ilPRGAssignment::$progress
protected

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

Referenced by getProgressTree(), and withProgressTree().

◆ $progresses

array ilPRGAssignment::$progresses = []
protected

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

◆ $restart_date

DateTimeImmutable ilPRGAssignment::$restart_date = null
protected

Definition at line 47 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 48 of file class.ilPRGAssignment.php.

Referenced by getRestartedAssignmentId(), and withRestarted().

◆ $user_info

ilPRGUserInformation ilPRGAssignment::$user_info
protected

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

Referenced by getUserInformation(), and withUserInformation().

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

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