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

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 _getNotAttempted (int $a_obj_id)
 
static _getInProgress (int $a_obj_id)
 
static _getCompleted (int $a_obj_id)
 
static _getFailed (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 initPluginObj (int $a_obj_id)
 Get ilObjectPlugin for object id. More...
 
static getLPStatusData (int $a_obj_id, int $a_status)
 Read existing LP status data. More...
 
static getLPDataForUser (int $a_obj_id, int $a_user_id)
 Read existing LP status data for user. More...
 
static getPercentageForUser (int $a_obj_id, int $a_user_id)
 
- 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

Definition at line 11 of file class.ilLPStatusPlugin.php.

Member Function Documentation

◆ _getCompleted()

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

Reimplemented from ilLPStatus.

Definition at line 59 of file class.ilLPStatusPlugin.php.

59 : array
60 {
61 $plugin = self::initPluginObj($a_obj_id);
62 if ($plugin) {
64 return (array) $plugin->getLPCompleted();
65 } else {
66 // re-use existing data for inactive plugin
68 $a_obj_id,
69 self::LP_STATUS_COMPLETED_NUM
70 );
71 }
72 }
73 return array();
74 }
static initPluginObj(int $a_obj_id)
Get ilObjectPlugin for object id.
static getLPStatusData(int $a_obj_id, int $a_status)
Read existing LP status data.
const INACTIVE_PLUGIN

References XapiProxy\$plugin, getLPStatusData(), ilPluginLP\INACTIVE_PLUGIN, and initPluginObj().

+ Here is the call graph for this function:

◆ _getFailed()

static ilLPStatusPlugin::_getFailed ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 76 of file class.ilLPStatusPlugin.php.

76 : array
77 {
78 $plugin = self::initPluginObj($a_obj_id);
79 if ($plugin) {
81 return (array) $plugin->getLPFailed();
82 } else {
83 // re-use existing data for inactive plugin
85 $a_obj_id,
86 self::LP_STATUS_FAILED_NUM
87 );
88 }
89 }
90 return array();
91 }

References XapiProxy\$plugin, getLPStatusData(), ilPluginLP\INACTIVE_PLUGIN, and initPluginObj().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusPlugin::_getInProgress ( int  $a_obj_id)
static

Reimplemented from ilLPStatus.

Definition at line 42 of file class.ilLPStatusPlugin.php.

42 : array
43 {
44 $plugin = self::initPluginObj($a_obj_id);
45 if ($plugin) {
47 return (array) $plugin->getLPInProgress();
48 } else {
49 // re-use existing data for inactive plugin
51 $a_obj_id,
52 self::LP_STATUS_IN_PROGRESS_NUM
53 );
54 }
55 }
56 return array();
57 }

References XapiProxy\$plugin, getLPStatusData(), ilPluginLP\INACTIVE_PLUGIN, and initPluginObj().

+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusPlugin::_getNotAttempted ( int  $a_obj_id)
static
Parameters
int$a_obj_id
Returns
int[]

Reimplemented from ilLPStatus.

Definition at line 25 of file class.ilLPStatusPlugin.php.

25 : array
26 {
27 $plugin = self::initPluginObj($a_obj_id);
28 if ($plugin) {
30 return (array) $plugin->getLPNotAttempted();
31 } else {
32 // re-use existing data for inactive plugin
34 $a_obj_id,
35 self::LP_STATUS_NOT_ATTEMPTED_NUM
36 );
37 }
38 }
39 return array();
40 }

References XapiProxy\$plugin, getLPStatusData(), ilPluginLP\INACTIVE_PLUGIN, and initPluginObj().

+ Here is the call graph for this function:

◆ determinePercentage()

ilLPStatusPlugin::determinePercentage ( int  $a_obj_id,
int  $a_usr_id,
?object  $a_obj = null 
)

Reimplemented from ilLPStatus.

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

116 : int {
117 $plugin = self::initPluginObj($a_obj_id);
118 if ($plugin) {
120 if (method_exists($plugin, "getPercentageForUser")) {
121 return $plugin->getPercentageForUser($a_usr_id);
122 }
123 }
124 // re-use existing data for inactive plugin
125 return self::getPercentageForUser($a_obj_id, $a_usr_id);
126 }
127 // #11368
128 return 0;
129 }
static getPercentageForUser(int $a_obj_id, int $a_user_id)

References XapiProxy\$plugin, and ilPluginLP\INACTIVE_PLUGIN.

◆ determineStatus()

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

Reimplemented from ilLPStatus.

Definition at line 93 of file class.ilLPStatusPlugin.php.

97 : int {
98 $plugin = self::initPluginObj($a_obj_id);
99 if ($plugin) {
101 // :TODO: create read_event here to make sure?
102 return $plugin->getLPStatusForUser($a_usr_id);
103 } else {
104 // re-use existing data for inactive plugin
105 return self::getLPDataForUser($a_obj_id, $a_usr_id);
106 }
107 }
108 // #11368
110 }
static getLPDataForUser(int $a_obj_id, int $a_user_id)
Read existing LP status data for user.
const LP_STATUS_NOT_ATTEMPTED_NUM

References XapiProxy\$plugin, getLPDataForUser(), and ilPluginLP\INACTIVE_PLUGIN.

+ Here is the call graph for this function:

◆ getLPDataForUser()

static ilLPStatusPlugin::getLPDataForUser ( int  $a_obj_id,
int  $a_user_id 
)
staticprotected

Read existing LP status data for user.

Definition at line 158 of file class.ilLPStatusPlugin.php.

161 : int {
162 global $DIC;
163
164 $ilDB = $DIC['ilDB'];
165
166 $set = $ilDB->query(
167 "SELECT status" .
168 " FROM ut_lp_marks" .
169 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
170 " AND usr_id = " . $ilDB->quote($a_user_id, "integer")
171 );
172 $row = $ilDB->fetchAssoc($set);
173 $status = $row["status"];
174 if (!$status) {
176 }
177 return $status;
178 }
global $DIC
Definition: feed.php:28

Referenced by determineStatus().

+ Here is the caller graph for this function:

◆ getLPStatusData()

static ilLPStatusPlugin::getLPStatusData ( int  $a_obj_id,
int  $a_status 
)
staticprotected

Read existing LP status data.

Definition at line 134 of file class.ilLPStatusPlugin.php.

137 : array {
138 global $DIC;
139
140 $ilDB = $DIC['ilDB'];
141
142 $all = array();
143 $set = $ilDB->query(
144 "SELECT usr_id" .
145 " FROM ut_lp_marks" .
146 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
147 " AND status = " . $ilDB->quote($a_status, "integer")
148 );
149 while ($row = $ilDB->fetchAssoc($set)) {
150 $all[] = (int) $row["usr_id"];
151 }
152 return $all;
153 }

Referenced by _getCompleted(), _getFailed(), _getInProgress(), and _getNotAttempted().

+ Here is the caller graph for this function:

◆ getPercentageForUser()

static ilLPStatusPlugin::getPercentageForUser ( int  $a_obj_id,
int  $a_user_id 
)
staticprotected

Definition at line 180 of file class.ilLPStatusPlugin.php.

183 : int {
184 global $DIC;
185
186 $ilDB = $DIC['ilDB'];
187
188 $set = $ilDB->query(
189 "SELECT percentage" .
190 " FROM ut_lp_marks" .
191 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
192 " AND usr_id = " . $ilDB->quote($a_user_id, "integer")
193 );
194 $row = $ilDB->fetchAssoc($set);
195 return (int) ($row["percentage"] ?? 0);
196 }

◆ initPluginObj()

static ilLPStatusPlugin::initPluginObj ( int  $a_obj_id)
staticprotected

Get ilObjectPlugin for object id.

Parameters
int$a_obj_id
Returns
ilObjectPlugin|int
Todo:
refactor return type

Definition at line 19 of file class.ilLPStatusPlugin.php.

20 {
21 $olp = ilObjectLP::getInstance($a_obj_id);
22 return $olp->getPluginInstance();
23 }
static getInstance(int $obj_id)

References ilObjectLP\getInstance().

Referenced by _getCompleted(), _getFailed(), _getInProgress(), and _getNotAttempted().

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

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