ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilStudyProgrammeUserProgressDB Class Reference

Storage implementation for ilStudyProgrammeUserProgress. More...

+ Collaboration diagram for ilStudyProgrammeUserProgressDB:

Public Member Functions

 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...
 
 statusToRepr ($a_status)
 Get a user readable representation of a status. More...
 

Static Public Member Functions

static getInstanceForAssignment ($a_program_id, $a_assignment_id)
 Get the instance for the assignment on the program. More...
 
static getInstancesForAssignment ($a_assignment_id)
 Get the instance for an assignment. More...
 
static getInstancesForProgram ($a_program_id)
 Get the instances for a program node. More...
 

Detailed Description

Member Function Documentation

◆ 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 23 of file class.ilStudyProgrammeUserProgressDB.php.

References array.

24  {
25  return new ilStudyProgrammeUserProgress(array($a_assignment_id, $a_program_id, $a_user_id));
26  }
Create styles array
The data for the language used.
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 34 of file class.ilStudyProgrammeUserProgressDB.php.

35  {
36  $prgrs = ilStudyProgrammeProgress::find($a_prgrs_id);
37  if ($prgrs === null) {
38  throw new ilException("Unknown progress id $a_prgrs_id.");
39  }
40  return new ilStudyProgrammeUserProgress($prgrs);
41  }
Represents the progress of a user at one node of a study programme.

◆ getInstanceForAssignment()

static ilStudyProgrammeUserProgressDB::getInstanceForAssignment (   $a_program_id,
  $a_assignment_id 
)
static

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 70 of file class.ilStudyProgrammeUserProgressDB.php.

References array, and ActiveRecord\where().

71  {
72  $progresses = ilStudyProgrammeProgress::where(array( "prg_id" => $a_program_id
73  , "assignment_id" => $a_assignment_id
74  ))->get();
75  if (count($progresses) == 0) {
76  require_once("Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
77  throw new ilStudyProgrammeNoProgressForAssignmentException("ilStudyProgrammeUserProgress::getInstanceForAssignment: "
78  . "Assignment '$a_assignment_id' does not belong to program "
79  . "'$a_program_id'");
80  }
81  return new ilStudyProgrammeUserProgress(array_shift($progresses));
82  }
Exception is thrown when a progress for some programme node and assignment is missing.
static where($where, $operator=null)
Create styles array
The data for the language used.
Represents the progress of a user at one node of a study programme.
+ Here is the call graph for this function:

◆ getInstancesForAssignment()

static ilStudyProgrammeUserProgressDB::getInstancesForAssignment (   $a_assignment_id)
static

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 94 of file class.ilStudyProgrammeUserProgressDB.php.

References array, and ActiveRecord\where().

95  {
96  $progresses = ilStudyProgrammeProgress::where(array( "assignment_id" => $a_assignment_id
97  ))->get();
98  if (count($progresses) == 0) {
99  require_once("Modules/StudyProgramme/classes/exceptions/class.ilStudyProgrammeNoProgressForAssignmentException.php");
100  throw new ilStudyProgrammeNoProgressForAssignmentException("ilStudyProgrammeUserProgress::getInstancesForAssignment: "
101  . "Can't find progresses for assignment '$a_assignment_id'.");
102  }
103  return array_map(function ($dat) {
104  return new ilStudyProgrammeUserProgress($dat);
105  }, $progresses);
106  }
Exception is thrown when a progress for some programme node and assignment is missing.
static where($where, $operator=null)
Create styles array
The data for the language used.
Represents the progress of a user at one node of a study programme.
+ Here is the call graph for this function:

◆ getInstancesForProgram()

static ilStudyProgrammeUserProgressDB::getInstancesForProgram (   $a_program_id)
static

Get the instances for a program node.

Parameters
int$a_program_id
Returns
ilStudyProgrammeUserProgress[]

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

References array, and ActiveRecord\where().

115  {
116  $progresses = ilStudyProgrammeProgress::where(array( "prg_id" => $a_program_id
117  ))->get();
118  return array_values(array_map(function ($dat) {
119  return new ilStudyProgrammeUserProgress($dat);
120  }, $progresses));
121  }
static where($where, $operator=null)
Create styles array
The data for the language used.
Represents the progress of a user at one node of a study programme.
+ 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 50 of file class.ilStudyProgrammeUserProgressDB.php.

References array, and ActiveRecord\where().

51  {
52  $progresses = ilStudyProgrammeProgress::where(array( "prg_id" => $a_program_id
53  , "usr_id" => $a_user_id
54  ))->get();
55  return array_values(array_map(function ($dat) {
56  return new ilStudyProgrammeUserProgress($dat);
57  }, $progresses));
58  }
static where($where, $operator=null)
Create styles array
The data for the language used.
Represents the progress of a user at one node of a study programme.
+ Here is the call graph for this function:

◆ statusToRepr()

ilStudyProgrammeUserProgressDB::statusToRepr (   $a_status)

Get a user readable representation of a status.

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

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

127  {
128  global $DIC;
129  $lng = $DIC['lng'];
130  $lng->loadLanguageModule("prg");
131 
133  return $lng->txt("prg_status_in_progress");
134  }
136  return $lng->txt("prg_status_completed");
137  }
139  return $lng->txt("prg_status_accredited");
140  }
142  return $lng->txt("prg_status_not_relevant");
143  }
144  if ($a_status == ilStudyProgrammeProgress::STATUS_FAILED) {
145  return $lng->txt("prg_status_failed");
146  }
147  throw new ilException("Unknown status: '$a_status'");
148  }
global $DIC
Definition: saml.php:7
global $lng
Definition: privfeed.php:17

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