5 require_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 createFor(ilStudyProgramme $a_prg, ilStudyProgrammeAssignment $a_ass)
Create a new progress object for a given program node and assignment.
addMissingProgresses()
Add missing progresses for new nodes in the programm.
deassign()
Remove this assignment.
getStudyProgramme()
Get the program node where this assignment was made.
getRootProgress()
Get the progress on the root node of the programme.
if(!array_key_exists('StateId', $_REQUEST)) $id
Storage implementation for ilStudyProgrammeUserProgress.
Exception is thrown when a progress for some programme node and assignment is missing.
static where($where, $operator=null)
static _getAllReferences($a_id)
get all reference ids of object
static _getStudyProgrammeUserProgressDB()
Get an instance of ilStudyProgrammeUserProgressDB.
static getInstanceByRefId($a_ref_id)
Get an instance of ilObjStudyProgramme, use cache.
Class ilStudyProgrammeAssignment.
const STATUS_NOT_RELEVANT
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.
getId()
Get the id of the assignment.
Create styles array
The data for the language used.
static getInstancesForProgram($a_program_id)
Get all assignments that were made to the given program.
static getInstancesOfUser($a_user_id)
Get all instances for a given user.
static getInstance($a_id)
Get an instance.
Represents one assignment of a user to a study programme.