6declare(strict_types=1);
52 return $this->assignment->getId();
66 throw new ilException(
"ilStudyProgrammeUserAssignment::getStudyProgramme: "
67 .
"could not find ref_id for program '"
68 . $this->assignment->getRootId() .
"'.");
79 return $this->assignment->getRestartDate();
87 return $this->assignment->getRestartedAssignmentId();
109 $this->assignment_repository->update(
110 $this->assignment->setRestartedAssignmentId($restarted->getId())
113 $this->sp_events->userReAssigned($this);
120 $this->sp_events->informUserByMailToRestart($this);
125 return $this->assignment->getUserId();
141 public function delete() :
void
143 $progresses = $this->sp_user_progress_db->getInstancesForAssignment($this->
getId());
144 foreach ($progresses as $progress) {
147 $this->assignment_repository->delete(
159 $id = $this->
getId();
161 $prg->applyToSubTreeNodes(
165 return $progress->updateFromProgramNode();
177 if (!$progress->hasSuccessStatus()) {
181 $validity_settings = $prg->getValidityOfQualificationSettings();
182 $period = $validity_settings->getQualificationPeriod();
183 $date = $validity_settings->getQualificationDate();
186 $date = $progress->getCompletionDate();
187 $date->add(
new DateInterval(
'P' . $period .
'D'));
189 $progress->setValidityOfQualification($date);
190 $progress->storeProgress();
197 if ($progress->hasSuccessStatus()) {
201 $deadline_settings = $prg->getDeadlineSettings();
202 $period = $deadline_settings->getDeadlinePeriod();
203 $date = $deadline_settings->getDeadlineDate();
205 $date = $progress->getAssignmentDate();
206 $date->add(
new DateInterval(
'P' . $period .
'D'));
208 $progress->setDeadline($date);
209 $progress->storeProgress();
220 public static function sendInformToReAssignMail(
int $assignment_id,
int $usr_id) : void
225 $lng->loadLanguageModule(
"prg");
226 $lng->loadLanguageModule(
"mail");
231 $assignment = $assignment_db->getInstanceById($assignment_id);
235 if (!$prg->shouldSendInfoToReAssignMail()) {
236 $log->write(
"Send info to re assign mail is deactivated in study programme settings");
240 $subject =
$lng->txt(
"info_to_re_assign_mail_subject");
244 $lng->txt(
"info_to_re_assign_mail_body"),
245 $lng->txt(
"mail_salutation_" . $gender),
251 $mail =
new ilMail(ANONYMOUS_USER_ID);
261 }
catch (Exception
$e) {
266 $assignment_db->reminderSendFor(
$assignment->getId());
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
static getInstanceByRefId($a_ref_id)
getProgressForAssignment(int $a_assignment_id)
Get the progress for an assignment on this node.
static _lookupLogin($a_user_id)
lookup login
static _lookupGender($a_user_id)
Lookup gender.
static _lookupFullname($a_user_id)
Lookup Full Name.
static _getAllReferences($a_id)
get all reference ids of object
Class ilStudyProgrammeAssignment.
Represents one assignment of a user to a study programme.
getStudyProgramme()
Get the program node where this assignment was made.
getId()
Get the id of the assignment.
updateValidityFromProgram()
deassign()
Remove this assignment.
getRootProgress()
Get the progress on the root node of the programme.
restartAssignment()
Assign the user belonging to this assignment to the prg belonging to this assignment again.
getRestartedAssignmentId()
Get restarted assignment id.
__construct(ilStudyProgrammeAssignment $assignment, ilStudyProgrammeUserProgressDB $sp_user_progress_db, ilStudyProgrammeAssignmentRepository $assignment_repository, ilStudyProgrammeEvents $sp_events)
informUserByMailToRestart()
getRestartDate()
Get the possible restart date of this assignment.
updateDeadlineFromProgram()
Storage implementation for ilStudyProgrammeUserProgress.
Represents the progress of a user at one node of a study programme.