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'.");
62 foreach($assignments as $ass) {
65 if($tree->isInTree($value)) {
84 return array_map(
function($ass) {
86 }, array_values($assignments));
95 return $this->assignment->getId();
107 require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
110 throw new ilException(
"ilStudyProgrammeUserAssignment::getStudyProgramme: "
111 .
"could not find ref_id for program '"
112 .$this->assignment->getRootId().
"'.");
133 return $this->assignment->getUserId();
146 public function delete() {
147 require_once(
"Modules/StudyProgramme/classes/class.ilStudyProgrammeUserProgress.php");
149 foreach ($progresses as $progress) {
153 $this->assignment->delete();
162 public function updateFromProgram() {
164 $id = $this->
getId();
166 $prg->applyToSubTreeNodes(
function($node) use ($id) {
171 $progress = $node->getProgressForAssignment($id);
172 return $progress->updateFromProgramNode();
186 require_once(
"Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
189 $id = $this->
getId();
194 $prg->applyToSubTreeNodes(
function($node) use ($id, $self) {
196 $node->getProgressForAssignment($id);
200 $ilLog->write(
"Adding progress for: ".$self->getId().
" ".$node->getId());
201 require_once(
"Modules/StudyProgramme/classes/model/class.ilStudyProgrammeProgress.php");
static where($where, $operator=NULL)
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.