5require_once(
"./Modules/StudyProgramme/classes/model/class.ilStudyProgrammeAssignment.php");
25 $this->assignment = $a_id_or_model;
28 $this->assignment = ilStudyProgrammeAssignment::find($a_id_or_model);
30 if ($this->assignment ===
null) {
31 throw new ilException(
"ilStudyProgrammeUserAssignment::__construct: "
32 .
"Unknown assignmemt id '$a_id_or_model'.");
63 foreach($assignments as $ass) {
66 if($tree->isInTree($value)) {
85 return array_map(
function($ass) {
87 }, array_values($assignments));
96 return $this->assignment->getId();
108 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
111 throw new ilException(
"ilStudyProgrammeUserAssignment::getStudyProgramme: "
112 .
"could not find ref_id for program '"
113 .$this->assignment->getRootId().
"'.");
134 return $this->assignment->getUserId();
147 public function delete() {
148 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
150 foreach ($progresses as $progress) {
154 $this->assignment->delete();
163 public function updateFromProgram() {
165 $id = $this->
getId();
167 $prg->applyToSubTreeNodes(
function($node) use ($id) {
172 $progress = $node->getProgressForAssignment($id);
173 return $progress->updateFromProgramNode();
187 require_once(
"Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
190 $id = $this->
getId();
193 $prg->applyToSubTreeNodes(
function($node) use ($id) {
195 $node->getProgressForAssignment($id);
200 $ilLog->write(
"Adding progress for: ".$this->
getId().
" ".$node->getId());
201 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 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.
__construct($a_id_or_model)
Throws when id does not refer to a study programme assignment.
addMissingProgresses()
Add missing progresses for new nodes in the programm.
getUserId()
Get the id of the user who is assigned.
static getInstancesForProgram($a_program_id)
Get all assignments that were made to the given program.
static getInstancesForAssignment($a_assignment_id)
Get the instance for an assignment.