ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilStudyProgrammeUserAssignment Class Reference

Represents one assignment of a user to a study programme. More...

+ Collaboration diagram for ilStudyProgrammeUserAssignment:

Public Member Functions

 __construct (ilStudyProgrammeAssignment $assignment, ilStudyProgrammeUserProgressDB $sp_user_progress_db, ilStudyProgrammeAssignmentRepository $assignment_repository, ilStudyProgrammeEvents $sp_events)
 
 getId ()
 Get the id of the assignment. More...
 
 getStudyProgramme ()
 Get the program node where this assignment was made. More...
 
 getRestartDate ()
 Get the possible restart date of this assignment. More...
 
 getRestartedAssignmentId ()
 Get restarted assignment id. More...
 
 getRootProgress ()
 Get the progress on the root node of the programme. More...
 
 restartAssignment ()
 Assign the user belonging to this assignment to the prg belonging to this assignment again. More...
 
 informUserByMailToRestart ()
 
 getUserId ()
 
 deassign ()
 Remove this assignment. More...
 
 delete ()
 Delete the assignment from database. More...
 
 updateValidityFromProgram ()
 
 updateDeadlineFromProgram ()
 
 getSPAssignment ()
 

Protected Attributes

 $assignment
 
 $assignment_repository
 
 $sp_events
 

Private Attributes

 $sp_user_progress_db
 

Detailed Description

Represents one assignment of a user to a study programme.

A user could have multiple assignments per programme.

Definition at line 13 of file class.ilStudyProgrammeUserAssignment.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeUserAssignment::__construct ( ilStudyProgrammeAssignment  $assignment,
ilStudyProgrammeUserProgressDB  $sp_user_progress_db,
ilStudyProgrammeAssignmentRepository  $assignment_repository,
ilStudyProgrammeEvents  $sp_events 
)

Member Function Documentation

◆ deassign()

ilStudyProgrammeUserAssignment::deassign ( )

Remove this assignment.

Exceptions
ilException

Definition at line 133 of file class.ilStudyProgrammeUserAssignment.php.

133 : void
134 {
135 $this->getStudyProgramme()->removeAssignment($this);
136 }
getStudyProgramme()
Get the program node where this assignment was made.

References getStudyProgramme().

+ Here is the call graph for this function:

◆ delete()

ilStudyProgrammeUserAssignment::delete ( )

Delete the assignment from database.

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

141 : void
142 {
143 $progresses = $this->sp_user_progress_db->getInstancesForAssignment($this->getId());
144 foreach ($progresses as $progress) {
145 $progress->delete();
146 }
147 $this->assignment_repository->delete(
148 $this->assignment
149 );
150 }

References getId().

Referenced by ilObjStudyProgramme\removeAssignment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

◆ getRestartDate()

ilStudyProgrammeUserAssignment::getRestartDate ( )

Get the possible restart date of this assignment.

Returns
DateTime | null

Definition at line 77 of file class.ilStudyProgrammeUserAssignment.php.

78 {
79 return $this->assignment->getRestartDate();
80 }

◆ getRestartedAssignmentId()

ilStudyProgrammeUserAssignment::getRestartedAssignmentId ( )

Get restarted assignment id.

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

85 : int
86 {
87 return $this->assignment->getRestartedAssignmentId();
88 }

◆ getRootProgress()

ilStudyProgrammeUserAssignment::getRootProgress ( )

Get the progress on the root node of the programme.

Exceptions
ilException

Definition at line 95 of file class.ilStudyProgrammeUserAssignment.php.

96 {
97 return $this->getStudyProgramme()->getProgressForAssignment($this->getId());
98 }
Represents the progress of a user at one node of a study programme.

References getId(), and getStudyProgramme().

Referenced by updateDeadlineFromProgram(), and updateValidityFromProgram().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSPAssignment()

ilStudyProgrammeUserAssignment::getSPAssignment ( )

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

213 {
214 return $this->assignment;
215 }
Class ilStudyProgrammeAssignment.

References $assignment.

◆ getStudyProgramme()

ilStudyProgrammeUserAssignment::getStudyProgramme ( )

Get the program node where this assignment was made.

Throws when program this assignment is about has no ref id.

Exceptions
ilException

Definition at line 62 of file class.ilStudyProgrammeUserAssignment.php.

63 {
64 $refs = ilObject::_getAllReferences((int) $this->assignment->getRootId());
65 if (!count($refs)) {
66 throw new ilException("ilStudyProgrammeUserAssignment::getStudyProgramme: "
67 . "could not find ref_id for program '"
68 . $this->assignment->getRootId() . "'.");
69 }
70 return ilObjStudyProgramme::getInstanceByRefId((int) array_shift($refs));
71 }
Base class for ILIAS Exception handling.
static getInstanceByRefId($a_ref_id)
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), and ilObjStudyProgramme\getInstanceByRefId().

Referenced by deassign(), ilObjStudyProgrammeMembersGUI\getAssignmentsById(), getRootProgress(), ilPDStudyProgrammeSimpleListGUI\hasPermission(), ilPDStudyProgrammeExpandableListGUI\new_ilStudyProgrammeAssignmentListGUI(), ilPDStudyProgrammeSimpleListGUI\new_ilStudyProgrammeAssignmentListGUI(), ilObjStudyProgramme\removeAssignment(), restartAssignment(), updateDeadlineFromProgram(), updateValidityFromProgram(), ilStudyProgrammeEvents\userAssigned(), ilStudyProgrammeEvents\userDeassigned(), and ilStudyProgrammeEvents\userReAssigned().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilStudyProgrammeUserAssignment::getUserId ( )

Definition at line 123 of file class.ilStudyProgrammeUserAssignment.php.

123 : int
124 {
125 return $this->assignment->getUserId();
126 }

Referenced by ilStudyProgrammeEvents\informUserByMailToRestart(), restartAssignment(), ilStudyProgrammeEvents\userAssigned(), ilStudyProgrammeEvents\userDeassigned(), and ilStudyProgrammeEvents\userReAssigned().

+ Here is the caller graph for this function:

◆ informUserByMailToRestart()

ilStudyProgrammeUserAssignment::informUserByMailToRestart ( )

Definition at line 118 of file class.ilStudyProgrammeUserAssignment.php.

118 : void
119 {
120 $this->sp_events->informUserByMailToRestart($this);
121 }

◆ restartAssignment()

ilStudyProgrammeUserAssignment::restartAssignment ( )

Assign the user belonging to this assignment to the prg belonging to this assignment again.

Exceptions
ilException

Definition at line 106 of file class.ilStudyProgrammeUserAssignment.php.

107 {
108 $restarted = $this->getStudyProgramme()->assignUser($this->getUserId(), $this->getUserId());
109 $this->assignment_repository->update(
110 $this->assignment->setRestartedAssignmentId($restarted->getId())
111 );
112
113 $this->sp_events->userReAssigned($this);
114
115 return $restarted;
116 }
Represents one assignment of a user to a study programme.

References getStudyProgramme(), and getUserId().

+ Here is the call graph for this function:

◆ updateDeadlineFromProgram()

ilStudyProgrammeUserAssignment::updateDeadlineFromProgram ( )

Definition at line 193 of file class.ilStudyProgrammeUserAssignment.php.

193 : void
194 {
195 $prg = $this->getStudyProgramme();
196 $progress = $this->getRootProgress();
197 if ($progress->hasSuccessStatus()) {
198 return;
199 }
200
201 $deadline_settings = $prg->getDeadlineSettings();
202 $period = $deadline_settings->getDeadlinePeriod();
203 $date = $deadline_settings->getDeadlineDate();
204 if ($period) {
205 $date = $progress->getAssignmentDate();
206 $date->add(new DateInterval('P' . $period . 'D'));
207 }
208 $progress->setDeadline($date);
209 $progress->storeProgress();
210 }
getRootProgress()
Get the progress on the root node of the programme.

References getRootProgress(), and getStudyProgramme().

Referenced by ilObjStudyProgrammeMembersGUI\updateUserAssignmentFromProgramm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateValidityFromProgram()

ilStudyProgrammeUserAssignment::updateValidityFromProgram ( )

Definition at line 173 of file class.ilStudyProgrammeUserAssignment.php.

173 : void
174 {
175 $prg = $this->getStudyProgramme();
176 $progress = $this->getRootProgress();
177 if (!$progress->hasSuccessStatus()) {
178 return;
179 }
180
181 $validity_settings = $prg->getValidityOfQualificationSettings();
182 $period = $validity_settings->getQualificationPeriod();
183 $date = $validity_settings->getQualificationDate();
184
185 if ($period) {
186 $date = $progress->getCompletionDate();
187 $date->add(new DateInterval('P' . $period . 'D'));
188 }
189 $progress->setValidityOfQualification($date);
190 $progress->storeProgress();
191 }

References getRootProgress(), and getStudyProgramme().

Referenced by ilObjStudyProgrammeMembersGUI\updateUserAssignmentFromProgramm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $assignment

ilStudyProgrammeUserAssignment ilStudyProgrammeUserAssignment::$assignment
protected

Definition at line 18 of file class.ilStudyProgrammeUserAssignment.php.

Referenced by __construct(), and getSPAssignment().

◆ $assignment_repository

ilStudyProgrammeUserAssignment::$assignment_repository
protected

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

Referenced by __construct().

◆ $sp_events

ilStudyProgrammeUserAssignment::$sp_events
protected

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

Referenced by __construct().

◆ $sp_user_progress_db

ilStudyProgrammeUserAssignment::$sp_user_progress_db
private

Definition at line 23 of file class.ilStudyProgrammeUserAssignment.php.

Referenced by __construct().


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