ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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=true)
 

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 24 of file class.ilLPStatusCollectionMobs.php.

References $users, and ilLPStatusWrapper\_getStatusInfo().

25  {
26  $users = array();
27 
28  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
29  if (is_array($status_info["user_status"]["completed"])) {
30  $users = $status_info["user_status"]["completed"];
31  }
32 
33  return $users;
34  }
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, and ilLPStatusWrapper\_getStatusInfo().

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  return $users;
22  }
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 36 of file class.ilLPStatusCollectionMobs.php.

References $DIC, $ilDB, $res, $row, $users, and ilChangeEvent\lookupUsersInProgress().

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

◆ determineStatus()

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

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

References $DIC, $ilDB, $row, and ilChangeEvent\hasAccessed().

122  {
123  global $DIC;
124 
125  $ilDB = $DIC['ilDB'];
126 
127  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
128 
129  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
130  $status = self::LP_STATUS_IN_PROGRESS_NUM;
131  }
132 
133  // an empty collection is always not attempted
134  $items = self::getCollectionItems($a_obj_id);
135  if (sizeof($items)) {
136  // process mob status for user
137 
138  $found = array();
139 
140  $set = $ilDB->query("SELECT obj_id FROM read_event" .
141  " WHERE usr_id = " . $ilDB->quote($a_user_id, "integer") .
142  " AND " . $ilDB->in("obj_id", $items, "", "integer"));
143  while ($row = $ilDB->fetchAssoc($set)) {
144  $found[] = $row["obj_id"];
145  }
146 
147  if (sizeof($found)) {
148  $status = self::LP_STATUS_IN_PROGRESS_NUM;
149 
150  if (sizeof($found) == sizeof($items)) {
151  $status = self::LP_STATUS_COMPLETED_NUM;
152  }
153  }
154  }
155 
156  return $status;
157  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the call graph for this function:

◆ getCollectionItems()

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

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

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

94  {
95  $res = array();
96 
97  include_once './Services/Object/classes/class.ilObjectLP.php';
98  $olp = ilObjectLP::getInstance($a_obj_id);
99  $collection = $olp->getCollectionInstance();
100  if ($collection) {
101  $possible = $collection->getPossibleItems();
102 
103  // there could be invalid items in the selection
104  $valid = array_intersect(
105  $collection->getItems(),
106  array_keys($possible)
107  );
108 
109  if ($a_include_titles) {
110  foreach ($valid as $item_id) {
111  $res[$item_id] = $possible[$item_id];
112  }
113  } else {
114  $res = $valid;
115  }
116  }
117 
118  return $res;
119  }
$valid
foreach($_POST as $key=> $value) $res
static getInstance($a_obj_id)
+ Here is the call graph for this function:

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