ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLPStatusCollectionTLT Class Reference
+ Inheritance diagram for ilLPStatusCollectionTLT:
+ Collaboration diagram for ilLPStatusCollectionTLT:

Public Member Functions

 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getStatusInfo ($a_obj_id, $a_include_tlt_data=false)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 
 _getCountNotAttempted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getCountInProgress ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCountCompleted ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getCountFailed ()
 
 _getStatusInfo ($a_obj_id)
 
 _getTypicalLearningTime ($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...
 
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLPStatus
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 _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)
 
- 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
 
- Protected Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
- Static Protected Member Functions inherited from ilLPStatus
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...
 

Detailed Description

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusCollectionTLT::_getCompleted (   $a_obj_id)

Reimplemented from ilLPStatus.

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

37 {
38 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
39
40 $counter = 0;
41 $users = array();
42 foreach($status_info['items'] as $item_id)
43 {
44 $tmp_users = $status_info['completed'][$item_id];
45
46 if(!$counter++)
47 {
48 $users = $tmp_users;
49 }
50 else
51 {
52 $users = array_intersect($users,$tmp_users);
53 }
54 }
55 $users = array_unique($users);
56
57 return $users;
58 }
_getStatusInfo($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()

ilLPStatusCollectionTLT::_getInProgress (   $a_obj_id)

Reimplemented from ilLPStatus.

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

18 {
19 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
20
21 $users = array();
22 if(is_array($status_info['in_progress']))
23 {
24 foreach($status_info['in_progress'] as $in_progress)
25 {
26 $users = array_merge($users,$in_progress);
27 }
28 $users = array_unique($users);
29 }
30
31 $users = array_diff($users,ilLPStatusWrapper::_getCompleted($a_obj_id));
32
33 return $users;
34 }
_getCompleted($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()

ilLPStatusCollectionTLT::_getStatusInfo (   $a_obj_id,
  $a_include_tlt_data = false 
)

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

61 {
62 global $ilDB;
63
64 $status_info = array();
65
66 include_once "Services/Object/classes/class.ilObjectLP.php";
67 $olp = ilObjectLP::getInstance($a_obj_id);
68 $collection = $olp->getCollectionInstance();
69 if($collection)
70 {
71 $status_info["items"] = $collection->getItems($a_obj_id);
72
73 include_once './Services/MetaData/classes/class.ilMDEducational.php';
74 foreach($status_info["items"] as $item_id)
75 {
76 $status_info["in_progress"][$item_id] = array();
77 $status_info["completed"][$item_id] = array();
78
79 $status_info["tlt"][$item_id] = ilMDEducational::_getTypicalLearningTimeSeconds($a_obj_id, $item_id);
80 }
81
82 $ref_ids = ilObject::_getAllReferences($a_obj_id);
83 $ref_id = end($ref_ids);
84 $possible_items = $collection->getPossibleItems($ref_id);
85 $chapter_ids = array_intersect(array_keys($possible_items),
86 $status_info["items"]);
87
88 // fix order (adapt from possible items)
89 $status_info["items"] = $chapter_ids;
90
91 if($chapter_ids)
92 {
93 foreach($chapter_ids as $item_id)
94 {
95 $status_info["item_titles"][$item_id] = $possible_items[$item_id]["title"];
96 }
97
98 $set = $ilDB->query("SELECT obj_id,usr_id,spent_seconds".
99 " FROM lm_read_event".
100 " WHERE ".$ilDB->in("obj_id", $chapter_ids, "", "integer"));
101 while($row = $ilDB->fetchAssoc($set))
102 {
103 if($row["spent_seconds"] < $status_info["tlt"][$row["obj_id"]])
104 {
105 $status_info["in_progress"][$row["obj_id"]][] = $row["usr_id"];
106 }
107 else
108 {
109 $status_info["completed"][$row["obj_id"]][] = $row["usr_id"];
110 }
111
112 if($a_include_tlt_data)
113 {
114 $status_info["tlt_users"][$row["obj_id"]][$row["usr_id"]] = $row["spent_seconds"];
115 }
116 }
117 }
118 }
119
120 if(!$a_include_tlt_data)
121 {
122 unset($status_info["tlt"]);
123 }
124
125 return $status_info;
126 }
_getTypicalLearningTimeSeconds($a_rbac_id, $a_obj_id=0)
static getInstance($a_obj_id)
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39
global $ilDB

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

Referenced by determineStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineStatus()

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

Determine status.

Parameters

return

Reimplemented from ilLPStatus.

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

129 {
130 $info = self::_getStatusInfo($a_obj_id);
131
132 $completed_once = false;
133
134 if(is_array($info["completed"]))
135 {
136 $completed = true;
137 foreach($info["completed"] as $user_ids)
138 {
139 // must have completed all items to complete collection
140 if(!in_array($a_user_id, $user_ids))
141 {
142 $completed = false;
143 break;
144 }
145 else
146 {
147 $completed_once = true;
148 }
149 }
150 if($completed)
151 {
153 }
154 }
155
156 // #14997
157 if($completed_once)
158 {
160 }
161
162 if(is_array($info["in_progress"]))
163 {
164 foreach($info["in_progress"] as $user_ids)
165 {
166 if(in_array($a_user_id, $user_ids))
167 {
169 }
170 }
171 }
172
174 }
_getStatusInfo($a_obj_id, $a_include_tlt_data=false)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
$info
Definition: example_052.php:80

References $info, _getStatusInfo(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

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