ILIAS  release_8 Revision v8.24
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 (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)
 

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 10 of file class.ilLPStatusCollectionTLT.php.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusCollectionTLT::_getCompleted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

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

32 : array
33 {
34 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
35
36 $counter = 0;
37 $users = array();
38 foreach ($status_info['items'] as $item_id) {
39 $tmp_users = $status_info['completed'][$item_id];
40
41 if (!$counter++) {
42 $users = $tmp_users;
43 } else {
44 $users = array_intersect($users, $tmp_users);
45 }
46 }
47 $users = array_unique($users);
48
49 return $users;
50 }
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.

References ilLPStatusWrapper\_getStatusInfo().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusCollectionTLT::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

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

12 : array
13 {
14 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
15
16 $users = array();
17 if (isset($status_info['in_progress'])) {
18 foreach ($status_info['in_progress'] as $in_progress) {
19 $users = array_merge($users, $in_progress);
20 }
21 $users = array_unique($users);
22 }
23
24 $users = array_diff(
25 $users,
27 );
28
29 return $users;
30 }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.

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

+ Here is the call graph for this function:

◆ _getStatusInfo()

static ilLPStatusCollectionTLT::_getStatusInfo ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

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

52 : array
53 {
54 global $DIC;
55
56 $ilDB = $DIC['ilDB'];
57 $status_info = array();
58 $olp = ilObjectLP::getInstance($a_obj_id);
59 $collection = $olp->getCollectionInstance();
60 if ($collection) {
61 // @todo check if obj_id can be removed
62 $status_info["items"] = $collection->getItems($a_obj_id);
63
64 foreach ($status_info["items"] as $item_id) {
65 $status_info["in_progress"][$item_id] = array();
66 $status_info["completed"][$item_id] = array();
67
68 $status_info["tlt"][$item_id] = ilMDEducational::_getTypicalLearningTimeSeconds(
69 $a_obj_id,
70 $item_id
71 );
72 }
73
74 $ref_ids = ilObject::_getAllReferences($a_obj_id);
75 $ref_id = end($ref_ids);
76 $possible_items = $collection->getPossibleItems($ref_id);
77 $chapter_ids = array_intersect(
78 array_keys($possible_items),
79 $status_info["items"]
80 );
81
82 // fix order (adapt from possible items)
83 $status_info["items"] = $chapter_ids;
84
85 if ($chapter_ids) {
86 foreach ($chapter_ids as $item_id) {
87 $status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
88 }
89
90 $set = $ilDB->query(
91 "SELECT obj_id,usr_id,spent_seconds" .
92 " FROM lm_read_event" .
93 " WHERE " . $ilDB->in("obj_id", $chapter_ids, "", "integer")
94 );
95 while ($row = $ilDB->fetchAssoc($set)) {
96 if ($row["spent_seconds"] < $status_info["tlt"][$row["obj_id"]]) {
97 $status_info["in_progress"][$row["obj_id"]][] = $row["usr_id"];
98 } else {
99 $status_info["completed"][$row["obj_id"]][] = $row["usr_id"];
100 }
101 }
102 }
103 }
104 return $status_info;
105 }
static _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id=0)
static getInstance(int $obj_id)
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67

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

+ Here is the call graph for this function:

◆ determineStatus()

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

Reimplemented from ilLPStatus.

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

111 : int {
112 $info = self::_getStatusInfo($a_obj_id);
113
114 $completed_once = false;
115
116 if (isset($info["completed"])) {
117 $completed = true;
118 foreach ($info["completed"] as $user_ids) {
119 // must have completed all items to complete collection
120 if (!in_array($a_usr_id, $user_ids)) {
121 $completed = false;
122 break;
123 } else {
124 $completed_once = true;
125 }
126 }
127 if ($completed) {
129 }
130 }
131
132 // #14997
133 if ($completed_once) {
135 }
136
137 if (isset($info["in_progress"])) {
138 foreach ($info["in_progress"] as $user_ids) {
139 if (in_array($a_usr_id, $user_ids)) {
141 }
142 }
143 }
144
146 }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM

References ilLPStatus\LP_STATUS_COMPLETED_NUM.


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