ILIAS  release_8 Revision v8.24
ilLPStatusVisitedPages Class Reference
+ Inheritance diagram for ilLPStatusVisitedPages:
+ Collaboration diagram for ilLPStatusVisitedPages:

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, object $a_obj=null)
 
 determinePercentage (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 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)
 

Static Protected Member Functions

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

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
 
- Protected Attributes inherited from ilLPStatus
int $obj_id
 
ilDBInterface $db
 
ilObjectDataCache $ilObjDataCache
 

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

Member Function Documentation

◆ _getCompleted()

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

Reimplemented from ilLPStatus.

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

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

References getLMPages().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusVisitedPages::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

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

14 : array
15 {
16 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
17 $users = array_diff(
18 $users,
20 );
21 return $users;
22 }
static lookupUsersInProgress(int $a_obj_id)
static _getCompleted(int $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 ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Reimplemented from ilLPStatus.

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

65 : int {
66 $all_page_ids = sizeof(self::getLMPages($a_obj_id));
67 if (!$all_page_ids) {
68 return 0;
69 }
70 $user_page_ids = sizeof(self::getVisitedPages($a_obj_id, $a_usr_id));
71 return (int) floor($user_page_ids / $all_page_ids * 100);
72 }
static getVisitedPages(int $a_obj_id, ?int $a_user_id=null)

◆ determineStatus()

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

Reimplemented from ilLPStatus.

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

44 : int {
46 switch (ilObject::_lookupType($a_obj_id)) {
47 case 'lm':
48 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
50
51 if (self::hasVisitedAllPages($a_obj_id, $a_usr_id)) {
53 }
54 }
55 break;
56 }
57
58 return $status;
59 }
static hasAccessed(int $a_obj_id, int $a_usr_id)
Has accessed.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupType(int $id, bool $reference=false)

References ilChangeEvent\hasAccessed(), ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilLPStatus\LP_STATUS_IN_PROGRESS_NUM.

+ Here is the call graph for this function:

◆ getLMPages()

static ilLPStatusVisitedPages::getLMPages ( int  $a_obj_id)
staticprotected

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

86 : array
87 {
88 global $DIC;
89
90 $ilDB = $DIC['ilDB'];
91
92 $res = array();
93
94 $set = $ilDB->query(
95 "SELECT lm_data.obj_id" .
96 " FROM lm_data" .
97 " JOIN lm_tree ON (lm_tree.child = lm_data.obj_id)" .
98 " WHERE lm_tree.lm_id = " . $ilDB->quote($a_obj_id, "integer") .
99 " AND lm_data.type = " . $ilDB->quote("pg", "text")
100 );
101 while ($row = $ilDB->fetchAssoc($set)) {
102 // only active pages (time-based activation not supported)
103 if (ilPageObject::_lookupActive($row["obj_id"], "lm")) {
104 $res[] = (int) $row["obj_id"];
105 }
106 }
107 return $res;
108 }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, ilPageObject\_lookupActive(), and ILIAS\Repository\int().

Referenced by _getCompleted().

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

◆ getVisitedPages()

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

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

113 : array {
114 global $DIC;
115
116 $ilDB = $DIC['ilDB'];
117
118 $res = array();
119
120 $all_page_ids = self::getLMPages($a_obj_id);
121 if (!sizeof($all_page_ids)) {
122 return $res;
123 }
124
125 $sql = "SELECT obj_id, usr_id" .
126 " FROM lm_read_event" .
127 " WHERE " . $ilDB->in("obj_id", $all_page_ids, "", "integer");
128
129 if ($a_user_id) {
130 $sql .= " AND usr_id = " . $ilDB->quote($a_user_id, "integer");
131 }
132
133 $set = $ilDB->query($sql);
134 while ($row = $ilDB->fetchAssoc($set)) {
135 $res[(int) $row["usr_id"]][] = (int) $row["obj_id"];
136 }
137
138 if ($a_user_id) {
139 $res = $res[$a_user_id] ?? [];
140 }
141
142 return $res;
143 }

◆ hasVisitedAllPages()

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

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

77 : bool {
78 $all_page_ids = self::getLMPages($a_obj_id);
79 if (!sizeof($all_page_ids)) {
80 return false;
81 }
82 $user_page_ids = self::getVisitedPages($a_obj_id, $a_user_id);
83 return !(bool) array_diff($all_page_ids, $user_page_ids);
84 }

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