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

Public Member Functions

 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
 determinePercentage ($a_obj_id, $a_user_id, $a_obj=null)
 Determine percentage. 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...
 

Static Protected Member Functions

static hasVisitedAllPages ($a_obj_id, $a_user_id)
 
static getLMPages ($a_obj_id)
 
static getVisitedPages ($a_obj_id, $a_user_id=null)
 
- 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...
 

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)
 

Detailed Description

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

◆ _getCompleted()

ilLPStatusVisitedPages::_getCompleted (   $a_obj_id)

Reimplemented from ilLPStatus.

Definition at line 27 of file class.ilLPStatusVisitedPages.php.

28 {
29 $users = array();
30
31 $all_page_ids = self::getLMPages($a_obj_id);
32 foreach(self::getVisitedPages($a_obj_id) as $user_id => $user_page_ids)
33 {
34 if(!(bool)sizeof(array_diff($all_page_ids, $user_page_ids)))
35 {
36 $users[] = $user_id;
37 }
38 }
39
40 return $users;
41 }

References getLMPages().

+ Here is the call graph for this function:

◆ _getInProgress()

ilLPStatusVisitedPages::_getInProgress (   $a_obj_id)

Reimplemented from ilLPStatus.

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

18 {
19 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
20 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
21
22 $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
23
24 return $users;
25 }
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.

References ilLPStatusWrapper\_getCompleted(), and ilChangeEvent\lookupUsersInProgress().

+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusVisitedPages::determinePercentage (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine percentage.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer percentage

Reimplemented from ilLPStatus.

Definition at line 87 of file class.ilLPStatusVisitedPages.php.

88 {
89 /* once completed will not be changed anymore
90 if(ilLPStatus::_hasUserCompleted($a_obj_id, $a_user_id))
91 {
92 return 100;
93 }
94 */
95
96 $all_page_ids = sizeof(self::getLMPages($a_obj_id));
97 if(!sizeof($all_page_ids))
98 {
99 return 0;
100 }
101
102 $user_page_ids = sizeof(self::getVisitedPages($a_obj_id, $a_user_id));
103
104 return floor($user_page_ids/$all_page_ids*100);
105 }
static getVisitedPages($a_obj_id, $a_user_id=null)

References getLMPages(), and getVisitedPages().

+ Here is the call graph for this function:

◆ determineStatus()

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

Determine status.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

Reimplemented from ilLPStatus.

Definition at line 51 of file class.ilLPStatusVisitedPages.php.

52 {
53 /* once completed will not be changed anymore
54 if(ilLPStatus::_hasUserCompleted($a_obj_id, $a_user_id))
55 {
56 return self::LP_STATUS_COMPLETED_NUM;
57 }
58 */
59
61 switch(ilObject::_lookupType($a_obj_id))
62 {
63 case 'lm':
64 if(ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
65 {
67
68 if(self::hasVisitedAllPages($a_obj_id, $a_user_id))
69 {
71 }
72 }
73 break;
74 }
75
76 return $status;
77 }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType(), ilChangeEvent\hasAccessed(), 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:

◆ getLMPages()

static ilLPStatusVisitedPages::getLMPages (   $a_obj_id)
staticprotected

Definition at line 124 of file class.ilLPStatusVisitedPages.php.

125 {
126 global $ilDB;
127
128 $res = array();
129
130 include_once "Services/COPage/classes/class.ilPageObject.php";
131
132 $set = $ilDB->query("SELECT lm_data.obj_id".
133 " FROM lm_data".
134 " JOIN lm_tree ON (lm_tree.child = lm_data.obj_id)".
135 " WHERE lm_tree.lm_id = ".$ilDB->quote($a_obj_id, "integer").
136 " AND lm_data.type = ".$ilDB->quote("pg", "text"));
137 while($row = $ilDB->fetchAssoc($set))
138 {
139 // only active pages (time-based activation not supported)
140 if(ilPageObject::_lookupActive($row["obj_id"], "lm"))
141 {
142 $res[] = $row["obj_id"];
143 }
144 }
145
146 return $res;
147 }
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
global $ilDB

References $ilDB, $res, $row, and ilPageObject\_lookupActive().

Referenced by _getCompleted(), determinePercentage(), getVisitedPages(), and hasVisitedAllPages().

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

◆ getVisitedPages()

static ilLPStatusVisitedPages::getVisitedPages (   $a_obj_id,
  $a_user_id = null 
)
staticprotected

Definition at line 149 of file class.ilLPStatusVisitedPages.php.

150 {
151 global $ilDB;
152
153 $res = array();
154
155 $all_page_ids = self::getLMPages($a_obj_id);
156 if(!sizeof($all_page_ids))
157 {
158 return $res;
159 }
160
161 $sql = "SELECT obj_id, usr_id".
162 " FROM lm_read_event".
163 " WHERE ".$ilDB->in("obj_id", $all_page_ids, "", "integer");
164
165 if($a_user_id)
166 {
167 $sql .= " AND usr_id = ".$ilDB->quote($a_user_id, "integer");
168 }
169
170 $set = $ilDB->query($sql);
171 while($row = $ilDB->fetchAssoc($set))
172 {
173 $res[$row["usr_id"]][] = $row["obj_id"];
174 }
175
176 if($a_user_id)
177 {
178 $res = (array)$res[$a_user_id];
179 }
180
181 return $res;
182 }

References $ilDB, $res, $row, and getLMPages().

Referenced by determinePercentage(), and hasVisitedAllPages().

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

◆ hasVisitedAllPages()

static ilLPStatusVisitedPages::hasVisitedAllPages (   $a_obj_id,
  $a_user_id 
)
staticprotected

Definition at line 112 of file class.ilLPStatusVisitedPages.php.

113 {
114 $all_page_ids = self::getLMPages($a_obj_id);
115 if(!sizeof($all_page_ids))
116 {
117 return false;
118 }
119
120 $user_page_ids = self::getVisitedPages($a_obj_id, $a_user_id);
121 return !(bool)sizeof(array_diff($all_page_ids, $user_page_ids));
122 }

References getLMPages(), and getVisitedPages().

+ Here is the call graph for this function:

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