ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (string $type, int $obj_id, int $sub_id=0)
 
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 26 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 38 of file class.ilLPStatusVisitedPages.php.

38 : array
39 {
40 $users = array();
41
42 $all_page_ids = self::getLMPages($a_obj_id);
43 foreach (self::getVisitedPages(
44 $a_obj_id
45 ) as $user_id => $user_page_ids) {
46 if (!(bool) sizeof(array_diff($all_page_ids, $user_page_ids))) {
47 $users[] = $user_id;
48 }
49 }
50
51 return $users;
52 }

References $user_id, and getLMPages().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusVisitedPages::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

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

28 : array
29 {
30 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
31 $users = array_diff(
32 $users,
34 );
35 return $users;
36 }
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 75 of file class.ilLPStatusVisitedPages.php.

79 : int {
80 $all_page_ids = sizeof(self::getLMPages($a_obj_id));
81 if (!$all_page_ids) {
82 return 0;
83 }
84 $user_page_ids = sizeof(self::getVisitedPages($a_obj_id, $a_usr_id));
85 return (int) floor($user_page_ids / $all_page_ids * 100);
86 }
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 54 of file class.ilLPStatusVisitedPages.php.

58 : int {
60 switch (ilObject::_lookupType($a_obj_id)) {
61 case 'lm':
62 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
64
65 if (self::hasVisitedAllPages($a_obj_id, $a_usr_id)) {
67 }
68 }
69 break;
70 }
71
72 return $status;
73 }
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 100 of file class.ilLPStatusVisitedPages.php.

100 : array
101 {
102 global $DIC;
103
104 $ilDB = $DIC['ilDB'];
105
106 $res = array();
107
108 $set = $ilDB->query(
109 "SELECT lm_data.obj_id" .
110 " FROM lm_data" .
111 " JOIN lm_tree ON (lm_tree.child = lm_data.obj_id)" .
112 " WHERE lm_tree.lm_id = " . $ilDB->quote($a_obj_id, "integer") .
113 " AND lm_data.type = " . $ilDB->quote("pg", "text")
114 );
115 while ($row = $ilDB->fetchAssoc($set)) {
116 // only active pages (time-based activation not supported)
117 if (ilPageObject::_lookupActive($row["obj_id"], "lm")) {
118 $res[] = (int) $row["obj_id"];
119 }
120 }
121 return $res;
122 }
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26

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

127 : array {
128 global $DIC;
129
130 $ilDB = $DIC['ilDB'];
131
132 $res = array();
133
134 $all_page_ids = self::getLMPages($a_obj_id);
135 if (!sizeof($all_page_ids)) {
136 return $res;
137 }
138
139 $sql = "SELECT obj_id, usr_id" .
140 " FROM lm_read_event" .
141 " WHERE " . $ilDB->in("obj_id", $all_page_ids, "", "integer");
142
143 if ($a_user_id) {
144 $sql .= " AND usr_id = " . $ilDB->quote($a_user_id, "integer");
145 }
146
147 $set = $ilDB->query($sql);
148 while ($row = $ilDB->fetchAssoc($set)) {
149 $res[(int) $row["usr_id"]][] = (int) $row["obj_id"];
150 }
151
152 if ($a_user_id) {
153 $res = $res[$a_user_id] ?? [];
154 }
155
156 return $res;
157 }

◆ hasVisitedAllPages()

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

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

91 : bool {
92 $all_page_ids = self::getLMPages($a_obj_id);
93 if (!sizeof($all_page_ids)) {
94 return false;
95 }
96 $user_page_ids = self::getVisitedPages($a_obj_id, $a_user_id);
97 return !(bool) array_diff($all_page_ids, $user_page_ids);
98 }

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