ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLPStatusCollectionMobs Class Reference
+ Inheritance diagram for ilLPStatusCollectionMobs:
+ Collaboration diagram for ilLPStatusCollectionMobs:

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, object $a_obj=null)
 
 determinePercentage (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 (int $a_obj_id)
 
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 getCollectionItems ( $a_obj_id, $a_include_titles=false)
 
- 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 10 of file class.ilLPStatusCollectionMobs.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionMobs::_getCompleted ( int  $a_obj_id)
static

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

References ilLPStatusWrapper\_getStatusInfo().

23  : array
24  {
25  $users = array();
26 
27  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
28  if (isset($status_info["user_status"]["completed"])) {
29  $users = $status_info["user_status"]["completed"];
30  }
31 
32  return $users;
33  }
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 ilLPStatusCollectionMobs::_getInProgress ( int  $a_obj_id)
static

Definition at line 12 of file class.ilLPStatusCollectionMobs.php.

References ilLPStatusWrapper\_getStatusInfo().

12  : array
13  {
14  $users = array();
15 
16  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
17  if (isset($status_info["user_status"]["in_progress"])) {
18  $users = $status_info["user_status"]["in_progress"];
19  }
20  return $users;
21  }
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 ilLPStatusCollectionMobs::_getStatusInfo ( int  $a_obj_id)
static

Definition at line 35 of file class.ilLPStatusCollectionMobs.php.

References $DIC, $ilDB, $res, ILIAS\Repository\int(), and ilChangeEvent\lookupUsersInProgress().

35  : array
36  {
37  global $DIC;
38 
39  $ilDB = $DIC['ilDB'];
40 
41  $res = array();
42 
43  $coll_items = self::getCollectionItems($a_obj_id, true);
44 
45  $res["items"] = array_keys($coll_items);
46  if (sizeof($res["items"])) {
47  // titles
48  foreach ($coll_items as $mob_id => $item) {
49  $res["item_titles"][$mob_id] = $item["title"];
50  }
51 
52  // status per item
53  foreach ($res["items"] as $mob_id) {
54  $res["completed"][$mob_id] = array();
55  $res["in_progress"][$mob_id] = array();
56  }
57 
58  $set = $ilDB->query(
59  "SELECT obj_id, usr_id FROM read_event" .
60  " WHERE " . $ilDB->in("obj_id", $res["items"], "", "integer")
61  );
62  while ($row = $ilDB->fetchAssoc($set)) {
63  $res["completed"][(int) $row["obj_id"]][] = (int) $row["usr_id"];
64  }
65 
66  // status per user
67  $tmp = array();
68  foreach ($res["items"] as $mob_id) {
69  foreach ($res["completed"][$mob_id] as $user_id) {
70  $tmp[$user_id][] = (int) $mob_id;
71  }
72  }
73  foreach ($tmp as $user_id => $completed_items) {
74  if (sizeof($completed_items) == sizeof($res["items"])) {
75  $res["user_status"]["completed"][] = (int) $user_id;
76  } else {
77  $res["user_status"]["in_progress"][] = (int) $user_id;
78  }
79  }
80  }
81 
82  $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
83  foreach ($users as $user_id) {
84  if ((!isset($res["user_status"]["in_progress"]) || !in_array(
85  $user_id,
86  $res["user_status"]["in_progress"]
87  )) &&
88  (!isset($res["user_status"]["completed"]) || !in_array(
89  $user_id,
90  $res["user_status"]["completed"]
91  ))) {
92  $res["user_status"]["in_progress"][] = (int) $user_id;
93  }
94  }
95 
96  return $res;
97  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
static lookupUsersInProgress(int $a_obj_id)
+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusCollectionMobs::determinePercentage ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Definition at line 164 of file class.ilLPStatusCollectionMobs.php.

References ILIAS\Repository\int().

168  : int
169  {
170  $per = 0;
171 
172  // an empty collection is always not attempted
173  $items = self::getCollectionItems($a_obj_id);
174  if (count($items) > 0) {
175  // process mob status for user
176 
177  $found = array();
178  $set = $this->db->query(
179  "SELECT obj_id FROM read_event" .
180  " WHERE usr_id = " . $this->db->quote($a_usr_id, "integer") .
181  " AND " . $this->db->in("obj_id", $items, false, "integer")
182  );
183  while ($row = $this->db->fetchAssoc($set)) {
184  $found[] = (int) $row["obj_id"];
185  }
186 
187  if (count($found) > 0 && count($items) > 0) {
188  $per = round(100 / count($items) * count($found));
189  }
190  }
191 
192  return $per;
193  }
+ Here is the call graph for this function:

◆ determineStatus()

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

Definition at line 127 of file class.ilLPStatusCollectionMobs.php.

References ilChangeEvent\hasAccessed(), and ILIAS\Repository\int().

131  : int {
132  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
133  if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
134  $status = self::LP_STATUS_IN_PROGRESS_NUM;
135  }
136 
137  // an empty collection is always not attempted
138  $items = self::getCollectionItems($a_obj_id);
139  if (count($items) > 0) {
140  // process mob status for user
141 
142  $found = array();
143 
144  $set = $this->db->query(
145  "SELECT obj_id FROM read_event" .
146  " WHERE usr_id = " . $this->db->quote($a_usr_id, "integer") .
147  " AND " . $this->db->in("obj_id", $items, false, "integer")
148  );
149  while ($row = $this->db->fetchAssoc($set)) {
150  $found[] = (int) $row["obj_id"];
151  }
152 
153  if (count($found) > 0) {
154  $status = self::LP_STATUS_IN_PROGRESS_NUM;
155 
156  if (count($found) == count($items)) {
157  $status = self::LP_STATUS_COMPLETED_NUM;
158  }
159  }
160  }
161  return $status;
162  }
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
+ Here is the call graph for this function:

◆ getCollectionItems()

static ilLPStatusCollectionMobs::getCollectionItems (   $a_obj_id,
  $a_include_titles = false 
)
staticprotected

Definition at line 99 of file class.ilLPStatusCollectionMobs.php.

References $res, $valid, and ilObjectLP\getInstance().

102  {
103  $res = array();
104 
105  $olp = ilObjectLP::getInstance($a_obj_id);
106  $collection = $olp->getCollectionInstance();
107  if ($collection) {
108  $possible = $collection->getPossibleItems();
109 
110  // there could be invalid items in the selection
111  $valid = array_intersect(
112  $collection->getItems(),
113  array_keys($possible)
114  );
115 
116  if ($a_include_titles) {
117  foreach ($valid as $item_id) {
118  $res[$item_id] = $possible[$item_id];
119  }
120  } else {
121  $res = $valid;
122  }
123  }
124  return $res;
125  }
$res
Definition: ltiservices.php:69
$valid
static getInstance(int $obj_id)
+ Here is the call graph for this function:

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