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

Public Member Functions

 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
 __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 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 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 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

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()

static ilLPStatusVisitedPages::_getCompleted (   $a_obj_id)
static

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 if (!(bool) sizeof(array_diff($all_page_ids, $user_page_ids))) {
34 $users[] = $user_id;
35 }
36 }
37
38 return $users;
39 }
$users
Definition: authpage.php:44

References $users, and getLMPages().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusVisitedPages::_getInProgress (   $a_obj_id)
static

Reimplemented from ilLPStatus.

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

18 {
19 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
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.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.

References $users, 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 82 of file class.ilLPStatusVisitedPages.php.

83 {
84 /* once completed will not be changed anymore
85 if(ilLPStatus::_hasUserCompleted($a_obj_id, $a_user_id))
86 {
87 return 100;
88 }
89 */
90
91 $all_page_ids = sizeof(self::getLMPages($a_obj_id));
92 if (!$all_page_ids) {
93 return 0;
94 }
95
96 $user_page_ids = sizeof(self::getVisitedPages($a_obj_id, $a_user_id));
97
98 return floor($user_page_ids/$all_page_ids*100);
99 }
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 49 of file class.ilLPStatusVisitedPages.php.

50 {
51 /* once completed will not be changed anymore
52 if(ilLPStatus::_hasUserCompleted($a_obj_id, $a_user_id))
53 {
54 return self::LP_STATUS_COMPLETED_NUM;
55 }
56 */
57
59 switch (ilObject::_lookupType($a_obj_id)) {
60 case 'lm':
61 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
63
64 if (self::hasVisitedAllPages($a_obj_id, $a_user_id)) {
66 }
67 }
68 break;
69 }
70
71 return $status;
72 }
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 117 of file class.ilLPStatusVisitedPages.php.

118 {
119 global $ilDB;
120
121 $res = array();
122
123 include_once "Services/COPage/classes/class.ilPageObject.php";
124
125 $set = $ilDB->query("SELECT lm_data.obj_id" .
126 " FROM lm_data" .
127 " JOIN lm_tree ON (lm_tree.child = lm_data.obj_id)" .
128 " WHERE lm_tree.lm_id = " . $ilDB->quote($a_obj_id, "integer") .
129 " AND lm_data.type = " . $ilDB->quote("pg", "text"));
130 while ($row = $ilDB->fetchAssoc($set)) {
131 // only active pages (time-based activation not supported)
132 if (ilPageObject::_lookupActive($row["obj_id"], "lm")) {
133 $res[] = $row["obj_id"];
134 }
135 }
136
137 return $res;
138 }
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
foreach($_POST as $key=> $value) $res
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 140 of file class.ilLPStatusVisitedPages.php.

141 {
142 global $ilDB;
143
144 $res = array();
145
146 $all_page_ids = self::getLMPages($a_obj_id);
147 if (!sizeof($all_page_ids)) {
148 return $res;
149 }
150
151 $sql = "SELECT obj_id, usr_id" .
152 " FROM lm_read_event" .
153 " WHERE " . $ilDB->in("obj_id", $all_page_ids, "", "integer");
154
155 if ($a_user_id) {
156 $sql .= " AND usr_id = " . $ilDB->quote($a_user_id, "integer");
157 }
158
159 $set = $ilDB->query($sql);
160 while ($row = $ilDB->fetchAssoc($set)) {
161 $res[$row["usr_id"]][] = $row["obj_id"];
162 }
163
164 if ($a_user_id) {
165 $res = (array) $res[$a_user_id];
166 }
167
168 return $res;
169 }

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 106 of file class.ilLPStatusVisitedPages.php.

107 {
108 $all_page_ids = self::getLMPages($a_obj_id);
109 if (!sizeof($all_page_ids)) {
110 return false;
111 }
112
113 $user_page_ids = self::getVisitedPages($a_obj_id, $a_user_id);
114 return !(bool) sizeof(array_diff($all_page_ids, $user_page_ids));
115 }

References getLMPages(), and getVisitedPages().

+ Here is the call graph for this function:

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