ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeUserProgressDB Class Reference

Storage implementation for ilStudyProgrammeUserProgress. More...

+ Collaboration diagram for ilStudyProgrammeUserProgressDB:

Public Member Functions

 __construct (ilStudyProgrammeProgressRepository $progress_repository, ilStudyProgrammeAssignmentRepository $assignment_repository, ilLanguage $lng, ilStudyProgrammeEvents $events)
 
 getInstance ($a_assignment_id, $a_program_id, $a_user_id)
 Get an instance. More...
 
 getInstanceById ($a_prgrs_id)
 Get an instance by progress id. More...
 
 getInstancesForUser ($a_program_id, $a_user_id)
 Get the instances that user has on program. More...
 
 getInstanceForAssignment ($a_program_id, $a_assignment_id)
 Get the instance for the assignment on the program. More...
 
 getInstancesForAssignment ($a_assignment_id)
 Get the instance for an assignment. More...
 
 getInstancesForProgram ($a_program_id)
 Get the instances for a program node. More...
 
 getExpiredSuccessfulInstances ()
 Get all expired and successful progresses. More...
 
 getPassedDeadline ()
 
 getRiskyToFailInstances ()
 
 statusToRepr ($a_status)
 Get a user readable representation of a status. More...
 
 reminderSendFor (int $assignment_id)
 

Protected Member Functions

 getObjectsByModels (array $models)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeUserProgressDB::__construct ( ilStudyProgrammeProgressRepository  $progress_repository,
ilStudyProgrammeAssignmentRepository  $assignment_repository,
ilLanguage  $lng,
ilStudyProgrammeEvents  $events 
)

Definition at line 11 of file class.ilStudyProgrammeUserProgressDB.php.

References $lng.

16  {
17  $this->progress_repository = $progress_repository;
18  $this->assignment_repository = $assignment_repository;
19  $this->lng = $lng;
20  $this->events = $events;
21  }
$lng

Member Function Documentation

◆ getExpiredSuccessfulInstances()

ilStudyProgrammeUserProgressDB::getExpiredSuccessfulInstances ( )

Get all expired and successful progresses.

Returns
ilStudyProgrammeUserProgress[]

Definition at line 143 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

143  : array
144  {
145  return $this->getObjectsByModels($this->progress_repository->readExpiredSuccessfull());
146  }
+ Here is the call graph for this function:

◆ getInstance()

ilStudyProgrammeUserProgressDB::getInstance (   $a_assignment_id,
  $a_program_id,
  $a_user_id 
)

Get an instance.

Just wraps constructor.

Exceptions
ilException
Parameters
int$a_assignment_id
int$a_program_id
int$a_user_id
Returns
ilStudyProgrammeUserProgress

Definition at line 32 of file class.ilStudyProgrammeUserProgressDB.php.

33  {
34  $prgrs = $this->progress_repository->readByIds($a_program_id, $a_assignment_id, $a_user_id);
36  $prgrs,
37  $this->progress_repository,
38  $this->assignment_repository,
39  $this->events
40  );
41  }
Represents the progress of a user at one node of a study programme.

◆ getInstanceById()

ilStudyProgrammeUserProgressDB::getInstanceById (   $a_prgrs_id)

Get an instance by progress id.

Parameters
int$a_prgrs_id
Returns
ilStudyProgrammeUserProgress

Definition at line 49 of file class.ilStudyProgrammeUserProgressDB.php.

50  {
51  $prgrs = $this->progress_repository->read($a_prgrs_id);
52  if ($prgrs === null) {
53  throw new ilException("Unknown progress id $a_prgrs_id.");
54  }
56  $prgrs,
57  $this->progress_repository,
58  $this->assignment_repository,
59  $this->events
60  );
61  }
Represents the progress of a user at one node of a study programme.

◆ getInstanceForAssignment()

ilStudyProgrammeUserProgressDB::getInstanceForAssignment (   $a_program_id,
  $a_assignment_id 
)

Get the instance for the assignment on the program.

Throws when the node does not belong to the assignment.

Exceptions
ilException
Parameters
int$a_program_id
int$a_user_id
Returns
ilStudyProgrammeUserProgress

Definition at line 89 of file class.ilStudyProgrammeUserProgressDB.php.

90  {
91  $progress = $this->progress_repository->readByPrgIdAndAssignmentId($a_program_id, $a_assignment_id);
92  if (!$progress) {
93  require_once("Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
94  throw new ilStudyProgrammeNoProgressForAssignmentException("ilStudyProgrammeUserProgress::getInstanceForAssignment: "
95  . "Assignment '$a_assignment_id' does not belong to program "
96  . "'$a_program_id'");
97  }
99  $progress,
100  $this->progress_repository,
101  $this->assignment_repository,
102  $this->events
103  );
104  }
Exception is thrown when a progress for some programme node and assignment is missing.
Represents the progress of a user at one node of a study programme.

◆ getInstancesForAssignment()

ilStudyProgrammeUserProgressDB::getInstancesForAssignment (   $a_assignment_id)

Get the instance for an assignment.

Throws when the node does not belong to the assignment.

Exceptions
ilException
Parameters
int$a_program_id
int$a_user_id
Returns
ilStudyProgrammeUserProgress

Definition at line 116 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

117  {
118  $progresses = $this->progress_repository->readByAssignmentId($a_assignment_id);
119  if (count($progresses) == 0) {
120  require_once("Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
121  throw new ilStudyProgrammeNoProgressForAssignmentException("ilStudyProgrammeUserProgress::getInstancesForAssignment: "
122  . "Can't find progresses for assignment '$a_assignment_id'.");
123  }
124  return $this->getObjectsByModels($progresses);
125  }
Exception is thrown when a progress for some programme node and assignment is missing.
+ Here is the call graph for this function:

◆ getInstancesForProgram()

ilStudyProgrammeUserProgressDB::getInstancesForProgram (   $a_program_id)

Get the instances for a program node.

Parameters
int$a_program_id
Returns
ilStudyProgrammeUserProgress[]

Definition at line 133 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

134  {
135  return array_values($this->getObjectsByModels($this->progress_repository->readByPrgId($a_program_id)));
136  }
+ Here is the call graph for this function:

◆ getInstancesForUser()

ilStudyProgrammeUserProgressDB::getInstancesForUser (   $a_program_id,
  $a_user_id 
)

Get the instances that user has on program.

Parameters
int$a_program_id
int$a_user_id
Returns
ilStudyProgrammeUserProgress[]

Definition at line 70 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

71  {
72  return array_values(
73  $this->getObjectsByModels(
74  $this->progress_repository->readByPrgIdAndUserId($a_program_id, $a_user_id)
75  )
76  );
77  }
+ Here is the call graph for this function:

◆ getObjectsByModels()

ilStudyProgrammeUserProgressDB::getObjectsByModels ( array  $models)
protected

Definition at line 161 of file class.ilStudyProgrammeUserProgressDB.php.

Referenced by getExpiredSuccessfulInstances(), getInstancesForAssignment(), getInstancesForProgram(), getInstancesForUser(), getPassedDeadline(), and getRiskyToFailInstances().

161  : array
162  {
163  return array_map(function ($dat) {
164  return new ilStudyProgrammeUserProgress(
165  $dat,
166  $this->progress_repository,
167  $this->assignment_repository,
168  $this->events
169  );
170  }, $models);
171  }
Represents the progress of a user at one node of a study programme.
+ Here is the caller graph for this function:

◆ getPassedDeadline()

ilStudyProgrammeUserProgressDB::getPassedDeadline ( )

Definition at line 148 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

148  : array
149  {
150  return $this->getObjectsByModels($this->progress_repository->readPassedDeadline());
151  }
+ Here is the call graph for this function:

◆ getRiskyToFailInstances()

ilStudyProgrammeUserProgressDB::getRiskyToFailInstances ( )
Returns
ilStudyProgrammeUserProgress[]

Definition at line 156 of file class.ilStudyProgrammeUserProgressDB.php.

References getObjectsByModels().

156  : array
157  {
158  return $this->getObjectsByModels($this->progress_repository->readRiskyToFailInstances());
159  }
+ Here is the call graph for this function:

◆ reminderSendFor()

ilStudyProgrammeUserProgressDB::reminderSendFor ( int  $assignment_id)

Definition at line 199 of file class.ilStudyProgrammeUserProgressDB.php.

199  : void
200  {
201  $this->progress_repository->reminderSendFor($assignment_id);
202  }

◆ statusToRepr()

ilStudyProgrammeUserProgressDB::statusToRepr (   $a_status)

Get a user readable representation of a status.

Definition at line 176 of file class.ilStudyProgrammeUserProgressDB.php.

References $lng, ilStudyProgrammeProgress\STATUS_ACCREDITED, ilStudyProgrammeProgress\STATUS_COMPLETED, ilStudyProgrammeProgress\STATUS_FAILED, ilStudyProgrammeProgress\STATUS_IN_PROGRESS, and ilStudyProgrammeProgress\STATUS_NOT_RELEVANT.

177  {
178  $lng = $this->lng;
179  $lng->loadLanguageModule("prg");
180 
182  return $lng->txt("prg_status_in_progress");
183  }
185  return $lng->txt("prg_status_completed");
186  }
188  return $lng->txt("prg_status_accredited");
189  }
191  return $lng->txt("prg_status_not_relevant");
192  }
193  if ($a_status == ilStudyProgrammeProgress::STATUS_FAILED) {
194  return $lng->txt("prg_status_failed");
195  }
196  throw new ilException("Unknown status: '$a_status'");
197  }
$lng

The documentation for this class was generated from the following file: