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

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, ?object $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 _getInProgress (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getStatusInfo (int $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)
 

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
 
- 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...
 
- Protected Attributes inherited from ilLPStatus
int $obj_id
 
ilDBInterface $db
 
ilObjectDataCache $ilObjDataCache
 

Detailed Description

Definition at line 26 of file class.ilLPStatusCollectionTLT.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionTLT::_getCompleted ( int  $a_obj_id)
static

Definition at line 48 of file class.ilLPStatusCollectionTLT.php.

References ilLPStatusWrapper\_getStatusInfo().

48  : array
49  {
50  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
51 
52  $counter = 0;
53  $users = array();
54  foreach ($status_info['items'] as $item_id) {
55  $tmp_users = $status_info['completed'][$item_id];
56 
57  if (!$counter++) {
58  $users = $tmp_users;
59  } else {
60  $users = array_intersect($users, $tmp_users);
61  }
62  }
63  $users = array_unique($users);
64 
65  return $users;
66  }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollectionTLT::_getInProgress ( int  $a_obj_id)
static

Definition at line 28 of file class.ilLPStatusCollectionTLT.php.

References ilLPStatusWrapper\_getCompleted(), and ilLPStatusWrapper\_getStatusInfo().

28  : array
29  {
30  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
31 
32  $users = array();
33  if (isset($status_info['in_progress'])) {
34  foreach ($status_info['in_progress'] as $in_progress) {
35  $users = array_merge($users, $in_progress);
36  }
37  $users = array_unique($users);
38  }
39 
40  $users = array_diff(
41  $users,
43  );
44 
45  return $users;
46  }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusCollectionTLT::_getStatusInfo ( int  $a_obj_id)
static

Definition at line 68 of file class.ilLPStatusCollectionTLT.php.

References $DIC, $ilDB, $ref_id, ilObject\_getAllReferences(), and ilObjectLP\getInstance().

68  : array
69  {
70  global $DIC;
71 
72  $ilDB = $DIC['ilDB'];
73  $status_info = array();
74  $olp = ilObjectLP::getInstance($a_obj_id);
75  $collection = $olp->getCollectionInstance();
76  if ($collection) {
77  // @todo check if obj_id can be removed
78  $status_info["items"] = $collection->getItems($a_obj_id);
79 
80  foreach ($status_info["items"] as $item_id) {
81  $status_info["in_progress"][$item_id] = array();
82  $status_info["completed"][$item_id] = array();
83 
84  /*
85  * Seems to only be used for collections of LM chapters,
86  * so we manually set 'st' for chapters here.
87  */
88  $status_info["tlt"][$item_id] = parent::_getTypicalLearningTime(
89  'st',
90  $a_obj_id,
91  $item_id
92  );
93  }
94 
95  $ref_ids = ilObject::_getAllReferences($a_obj_id);
96  $ref_id = end($ref_ids);
97  $possible_items = $collection->getPossibleItems($ref_id);
98  $chapter_ids = array_intersect(
99  array_keys($possible_items),
100  $status_info["items"]
101  );
102 
103  // fix order (adapt from possible items)
104  $status_info["items"] = $chapter_ids;
105 
106  if ($chapter_ids) {
107  foreach ($chapter_ids as $item_id) {
108  $status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
109  }
110 
111  $set = $ilDB->query(
112  "SELECT obj_id,usr_id,spent_seconds" .
113  " FROM lm_read_event" .
114  " WHERE " . $ilDB->in("obj_id", $chapter_ids, "", "integer")
115  );
116  while ($row = $ilDB->fetchAssoc($set)) {
117  if ($row["spent_seconds"] < $status_info["tlt"][$row["obj_id"]]) {
118  $status_info["in_progress"][$row["obj_id"]][] = $row["usr_id"];
119  } else {
120  $status_info["completed"][$row["obj_id"]][] = $row["usr_id"];
121  }
122  }
123  }
124  }
125  return $status_info;
126  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ determineStatus()

ilLPStatusCollectionTLT::determineStatus ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Definition at line 128 of file class.ilLPStatusCollectionTLT.php.

132  : int {
133  $info = self::_getStatusInfo($a_obj_id);
134 
135  $completed_once = false;
136 
137  if (isset($info["completed"])) {
138  $completed = true;
139  foreach ($info["completed"] as $user_ids) {
140  // must have completed all items to complete collection
141  if (!in_array($a_usr_id, $user_ids)) {
142  $completed = false;
143  break;
144  } else {
145  $completed_once = true;
146  }
147  }
148  if ($completed) {
149  return self::LP_STATUS_COMPLETED_NUM;
150  }
151  }
152 
153  // #14997
154  if ($completed_once) {
155  return self::LP_STATUS_IN_PROGRESS_NUM;
156  }
157 
158  if (isset($info["in_progress"])) {
159  foreach ($info["in_progress"] as $user_ids) {
160  if (in_array($a_usr_id, $user_ids)) {
161  return self::LP_STATUS_IN_PROGRESS_NUM;
162  }
163  }
164  }
165 
166  return self::LP_STATUS_NOT_ATTEMPTED_NUM;
167  }

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