ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLPStatusCollectionMobs Class Reference
+ Inheritance diagram for ilLPStatusCollectionMobs:
+ Collaboration diagram for ilLPStatusCollectionMobs:

Public Member Functions

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

Static Public Member Functions

static _getInProgress ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getStatusInfo ($a_parent_obj_id)
 
- Static Public Member Functions inherited from ilLPStatus
static _getCountNotAttempted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
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 _getCountFailed ()
 
static _getStatusInfo ($a_obj_id)
 
static _getTypicalLearningTime ($a_obj_id)
 
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty ($a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status. More...
 
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. More...
 
static _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData ($a_obj_ids)
 
static getListGUIStatus ($a_obj_id, $a_image_only=false)
 

Static Protected Member Functions

static getCollectionItems ($a_obj_id, $a_include_titles=false)
 
- Static Protected Member Functions inherited from ilLPStatus
static raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects ($a_user_id, $a_obj_ids, $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects ($a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects ($a_user_id, $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
 $obj_id = null
 
 $db = null
 
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
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionMobs::_getCompleted (   $a_obj_id)
static

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

References $users, ilLPStatusWrapper\_getStatusInfo(), and array.

26  {
27  $users = array();
28 
29  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
30  if (is_array($status_info["user_status"]["completed"])) {
31  $users = $status_info["user_status"]["completed"];
32  }
33 
34  return $users;
35  }
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollectionMobs::_getInProgress (   $a_obj_id)
static

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

References $users, ilLPStatusWrapper\_getStatusInfo(), and array.

14  {
15  $users = array();
16 
17  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
18  if (is_array($status_info["user_status"]["in_progress"])) {
19  $users = $status_info["user_status"]["in_progress"];
20  }
21 
22  return $users;
23  }
Create styles array
The data for the language used.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusCollectionMobs::_getStatusInfo (   $a_parent_obj_id)
static

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

References $ilDB, $res, $row, and array.

38  {
39  global $ilDB;
40 
41  $res = array();
42 
43  $coll_items = self::getCollectionItems($a_parent_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("SELECT obj_id, usr_id FROM read_event" .
59  " WHERE " . $ilDB->in("obj_id", $res["items"], "", "integer"));
60  while ($row = $ilDB->fetchAssoc($set)) {
61  $res["completed"][$row["obj_id"]][] = $row["usr_id"];
62  }
63 
64  // status per user
65  $tmp = array();
66  foreach ($res["items"] as $mob_id) {
67  foreach ($res["completed"][$mob_id] as $user_id) {
68  $tmp[$user_id][] = $mob_id;
69  }
70  }
71  foreach ($tmp as $user_id => $completed_items) {
72  if (sizeof($completed_items) == sizeof($res["items"])) {
73  $res["user_status"]["completed"][] = $user_id;
74  } else {
75  $res["user_status"]["in_progress"][] = $user_id;
76  }
77  }
78  }
79 
80  return $res;
81  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB

◆ determineStatus()

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

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

References $ilDB, $row, and array.

112  {
113  global $ilDB;
114 
115  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
116 
117  // an empty collection is always not attempted
118  $items = self::getCollectionItems($a_obj_id);
119  if (sizeof($items)) {
120  // process mob status for user
121 
122  $found = array();
123 
124  $set = $ilDB->query("SELECT obj_id FROM read_event" .
125  " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
126  " AND " . $ilDB->in("obj_id", $items, "", "integer"));
127  while ($row = $ilDB->fetchAssoc($set)) {
128  $found[] = $row["obj_id"];
129  }
130 
131  if (sizeof($found)) {
132  $status = self::LP_STATUS_IN_PROGRESS_NUM;
133 
134  if (sizeof($found) == sizeof($items)) {
135  $status = self::LP_STATUS_COMPLETED_NUM;
136  }
137  }
138  }
139 
140  return $status;
141  }
Create styles array
The data for the language used.
global $ilDB

◆ getCollectionItems()

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

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

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

84  {
85  $res = array();
86 
87  include_once './Services/Object/classes/class.ilObjectLP.php';
88  $olp = ilObjectLP::getInstance($a_obj_id);
89  $collection = $olp->getCollectionInstance();
90  if ($collection) {
91  $possible = $collection->getPossibleItems();
92 
93  // there could be invalid items in the selection
94  $valid = array_intersect(
95  $collection->getItems(),
96  array_keys($possible)
97  );
98 
99  if ($a_include_titles) {
100  foreach ($valid as $item_id) {
101  $res[$item_id] = $possible[$item_id];
102  }
103  } else {
104  $res = $valid;
105  }
106  }
107 
108  return $res;
109  }
$valid
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
static getInstance($a_obj_id)
+ Here is the call graph for this function:

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