5require_once(
"./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php");
32 $this->assignment = $a_id_or_model;
34 $this->assignment = ilStudyProgrammeAssignment::find($a_id_or_model);
36 if ($this->assignment ===
null) {
37 throw new ilException(
"ilStudyProgrammeUserAssignment::__construct: "
38 .
"Unknown assignmemt id '$a_id_or_model'.");
72 foreach ($assignments as $ass) {
75 if (
$tree->isInTree($value)) {
95 return array_map(
function ($ass) {
97 }, array_values($assignments));
107 return $this->assignment->getId();
120 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
123 throw new ilException(
"ilStudyProgrammeUserAssignment::getStudyProgramme: "
124 .
"could not find ref_id for program '"
125 . $this->assignment->getRootId() .
"'.");
148 return $this->assignment->getUserId();
162 public function delete()
164 $progresses = $this->sp_user_progress_db->getInstancesForAssignment($this->
getId());
165 foreach ($progresses as $progress) {
169 $this->assignment->delete();
178 public function updateFromProgram()
183 $prg->applyToSubTreeNodes(
function ($node) use (
$id) {
188 $progress = $node->getProgressForAssignment(
$id);
189 return $progress->updateFromProgramNode();
204 require_once(
"Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
210 $prg->applyToSubTreeNodes(
function ($node) use (
$id) {
212 $node->getProgressForAssignment(
$id);
216 $ilLog->write(
"Adding progress for: " . $this->
getId() .
" " . $node->getId());
217 require_once(
"Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php");
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
static _getStudyProgrammeUserProgressDB()
Get an instance of ilStudyProgrammeUserProgressDB.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
static _getAllReferences($a_id)
get all reference ids of object
Class ilStudyProgrammeAssignment.
Exception is thrown when a progress for some programme node and assignment is missing.
const STATUS_NOT_RELEVANT
static createFor(ilStudyProgramme $a_prg, ilStudyProgrammeAssignment $a_ass)
Create a new progress object for a given program node and assignment.
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.
static getInstance($a_id)
Get an instance.
deassign()
Remove this assignment.
getRootProgress()
Get the progress on the root node of the programme.
static getInstancesOfUser($a_user_id)
Get all instances for a given user.
addMissingProgresses()
Add missing progresses for new nodes in the programm.
getUserId()
Get the id of the user who is assigned.
__construct($a_id_or_model, \ilStudyProgrammeUserProgressDB $sp_user_progress_db)
Throws when id does not refer to a study programme assignment.
static getInstancesForProgram($a_program_id)
Get all assignments that were made to the given program.
Storage implementation for ilStudyProgrammeUserProgress.
if(!array_key_exists('StateId', $_REQUEST)) $id