ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLPStatusStudyProgramme Class Reference
+ Inheritance diagram for ilLPStatusStudyProgramme:
+ Collaboration diagram for ilLPStatusStudyProgramme:

Public Member Functions

 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 
- Public Member Functions inherited from ilLPStatus
 __construct (int $a_obj_id)
 
 _updateStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) Learning progress: More...
 
 determinePercentage (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 determineStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 
 refreshStatus (int $a_obj_id, ?array $a_users=null)
 Refresh status. More...
 

Static Public Member Functions

static _getCountInProgress ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCountCompleted ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted (int $a_obj_id)
 
static _getNotAttempted (int $a_obj_id)
 
static _getCountInProgress (int $a_obj_id)
 
static _getInProgress (int $a_obj_id)
 
static _getCountCompleted (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getFailed (int $a_obj_id)
 
static _getCountFailed (int $a_obj_id)
 
static _getStatusInfo (int $a_obj_id)
 
static _getTypicalLearningTime (string $type, int $obj_id, int $sub_id=0)
 
static checkStatusForObject (int $a_obj_id, ?array $a_users=null)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus (int $a_obj_id, int $a_user_id, int $a_status, int $a_percentage=0, bool $a_force_per=false, ?int &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted (int $a_obj_id, int $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty (int $a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus (int $a_obj_id, int $a_user_id, bool $a_create=true)
 Lookup status. More...
 
static _lookupPercentage (int $a_obj_id, int $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted (int $a_obj_id, int $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged (int $a_obj_id, int $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject (int $a_obj_id, ?array $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData (array $a_obj_ids)
 
static getListGUIStatus (int $a_obj_id, bool $a_image_only=true)
 
static hasListGUIStatus (int $a_obj_id)
 

Static Protected Member Functions

static getAssignments (int $obj_id, ?int $usr_id=null)
 
static getStatusForAssignments (array $assignments, int $prg_obj_id)
 determine a status based on a single users collection of assignments. More...
 
static getAssignmentsLPMatrix (array $assignments, int $prg_obj_id)
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent (int $a_obj_id, int $a_usr_id, int $a_status, int $a_old_status, int $a_percentage)
 
static _lookupStatusForObject (int $a_obj_id, int $a_status, ?array $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects (int $a_user_id, array $a_obj_ids, int $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects (array $a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects (int $a_user_id, array $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
const LP_STATUS_NOT_ATTEMPTED = 'trac_no_attempted'
 
const LP_STATUS_IN_PROGRESS = 'trac_in_progress'
 
const LP_STATUS_COMPLETED = 'trac_completed'
 
const LP_STATUS_FAILED = 'trac_failed'
 
const LP_STATUS_NOT_ATTEMPTED_NUM = 0
 
const LP_STATUS_IN_PROGRESS_NUM = 1
 
const LP_STATUS_COMPLETED_NUM = 2
 
const LP_STATUS_FAILED_NUM = 3
 
const LP_STATUS_REGISTERED = 'trac_registered'
 
const LP_STATUS_NOT_REGISTERED = 'trac_not_registered'
 
const LP_STATUS_PARTICIPATED = 'trac_participated'
 
const LP_STATUS_NOT_PARTICIPATED = 'trac_not_participated'
 
- Static Public Attributes inherited from ilLPStatus
static $list_gui_cache
 
- Protected Attributes inherited from ilLPStatus
int $obj_id
 
ilDBInterface $db
 
ilObjectDataCache $ilObjDataCache
 

Detailed Description

Definition at line 21 of file class.ilLPStatusStudyProgramme.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusStudyProgramme::_getCompleted (   $a_obj_id)
static

Definition at line 122 of file class.ilLPStatusStudyProgramme.php.

References ilLPStatus\LP_STATUS_COMPLETED_NUM.

122  : array
123  {
124  $assignments = self::getAssignments((int) $a_obj_id);
125  $matrix = self::getAssignmentsLPMatrix($assignments, (int) $a_obj_id);
126  return $matrix[ilLPStatus::LP_STATUS_COMPLETED_NUM];
127  }
const LP_STATUS_COMPLETED_NUM

◆ _getCountCompleted()

static ilLPStatusStudyProgramme::_getCountCompleted (   $a_obj_id)
static

Definition at line 117 of file class.ilLPStatusStudyProgramme.php.

117  : int
118  {
119  return count(self::_getCompleted($a_obj_id));
120  }

◆ _getCountInProgress()

static ilLPStatusStudyProgramme::_getCountInProgress (   $a_obj_id)
static

Definition at line 104 of file class.ilLPStatusStudyProgramme.php.

104  : int
105  {
106  throw new \Exception('called');
107  return count(self::_getInProgress($a_obj_id));
108  }

◆ _getFailed()

static ilLPStatusStudyProgramme::_getFailed (   $a_obj_id)
static

Definition at line 129 of file class.ilLPStatusStudyProgramme.php.

References ilLPStatus\LP_STATUS_FAILED_NUM.

129  : array
130  {
131  $assignments = self::getAssignments((int) $a_obj_id);
132  $matrix = self::getAssignmentsLPMatrix($assignments, (int) $a_obj_id);
133  return $matrix[ilLPStatus::LP_STATUS_FAILED_NUM];
134  }
const LP_STATUS_FAILED_NUM

◆ _getInProgress()

static ilLPStatusStudyProgramme::_getInProgress (   $a_obj_id)
static

Definition at line 110 of file class.ilLPStatusStudyProgramme.php.

References ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

110  : array
111  {
112  $assignments = self::getAssignments((int) $a_obj_id);
113  $matrix = self::getAssignmentsLPMatrix($assignments, (int) $a_obj_id);
115  }
const LP_STATUS_IN_PROGRESS_NUM

◆ determineStatus()

ilLPStatusStudyProgramme::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Definition at line 136 of file class.ilLPStatusStudyProgramme.php.

136  : int
137  {
138  $assignments = self::getAssignments((int) $a_obj_id, (int) $a_user_id);
139  return self::getStatusForAssignments($assignments, (int) $a_obj_id);
140  }

◆ getAssignments()

static ilLPStatusStudyProgramme::getAssignments ( int  $obj_id,
?int  $usr_id = null 
)
staticprotected

Definition at line 23 of file class.ilLPStatusStudyProgramme.php.

References $dic, and ilStudyProgrammeDIC\dic().

23  : array
24  {
26  $repo = $dic['repo.assignment'];
27 
28  if ($usr_id) {
29  $usr_id = [$usr_id];
30  }
31  $assignments = $repo->getAllForNodeIsContained((int) $obj_id, $usr_id);
32 
33  //restarted assignments will lose validity for LPStatus
34  $assignments = array_filter($assignments, fn($ass) => !$ass->isRestarted());
35 
36  return $assignments;
37  }
$dic
Definition: result.php:31
+ Here is the call graph for this function:

◆ getAssignmentsLPMatrix()

static ilLPStatusStudyProgramme::getAssignmentsLPMatrix ( array  $assignments,
int  $prg_obj_id 
)
staticprotected
Parameters
ilPRGAssignment[]$assignments

Definition at line 79 of file class.ilLPStatusStudyProgramme.php.

References ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

79  : array
80  {
81  $matrix = [
86  ];
87 
88  $user_centric = [];
89  foreach ($assignments as $ass) {
90  $usr_id = $ass->getUserId();
91  if (!array_key_exists($usr_id, $user_centric)) {
92  $user_centric[$usr_id] = [];
93  }
94  $user_centric[$usr_id][] = $ass;
95  }
96  foreach ($user_centric as $usr_id => $assignments) {
97  $status = self::getStatusForAssignments($assignments, $prg_obj_id);
98  $matrix[$status][] = $usr_id;
99  }
100 
101  return $matrix;
102  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM

◆ getStatusForAssignments()

static ilLPStatusStudyProgramme::getStatusForAssignments ( array  $assignments,
int  $prg_obj_id 
)
staticprotected

determine a status based on a single users collection of assignments.

Definition at line 42 of file class.ilLPStatusStudyProgramme.php.

References ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_FAILED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

42  : int
43  {
44  if($assignments === []) {
46  }
47  $now = new DateTimeImmutable();
48  $pgss = [];
49  $sorting = [];
50  foreach ($assignments as $ass) {
51  $pgs = $ass->getProgressForNode($prg_obj_id);
52  $pgss[$ass->getId()] = $pgs;
53  $sorting[] = $ass->getId();
54  }
55 
56  //use the highest assignment first
57  sort($sorting);
58  $sorting = array_reverse($sorting);
59  $pgs = $pgss[reset($sorting)];
60 
61  if (!$pgs || !$pgs->isRelevant()) {
63  }
64 
65  if ($pgs->hasValidQualification($now)) {
67  }
68 
69  if ($pgs->isSuccessful() || $pgs->isFailed()) {
71  }
72 
74  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
+ Here is the call graph for this function:

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