ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (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 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 25 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 73 of file class.ilLPStatusPlugin.php.

73 : array
74 {
75 $plugin = self::initPluginObj($a_obj_id);
76 if ($plugin) {
78 return (array) $plugin->getLPCompleted();
79 } else {
80 // re-use existing data for inactive plugin
82 $a_obj_id,
83 self::LP_STATUS_COMPLETED_NUM
84 );
85 }
86 }
87 return array();
88 }
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 90 of file class.ilLPStatusPlugin.php.

90 : array
91 {
92 $plugin = self::initPluginObj($a_obj_id);
93 if ($plugin) {
95 return (array) $plugin->getLPFailed();
96 } else {
97 // re-use existing data for inactive plugin
99 $a_obj_id,
100 self::LP_STATUS_FAILED_NUM
101 );
102 }
103 }
104 return array();
105 }

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 56 of file class.ilLPStatusPlugin.php.

56 : array
57 {
58 $plugin = self::initPluginObj($a_obj_id);
59 if ($plugin) {
61 return (array) $plugin->getLPInProgress();
62 } else {
63 // re-use existing data for inactive plugin
65 $a_obj_id,
66 self::LP_STATUS_IN_PROGRESS_NUM
67 );
68 }
69 }
70 return array();
71 }

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 39 of file class.ilLPStatusPlugin.php.

39 : array
40 {
41 $plugin = self::initPluginObj($a_obj_id);
42 if ($plugin) {
44 return (array) $plugin->getLPNotAttempted();
45 } else {
46 // re-use existing data for inactive plugin
48 $a_obj_id,
49 self::LP_STATUS_NOT_ATTEMPTED_NUM
50 );
51 }
52 }
53 return array();
54 }

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 126 of file class.ilLPStatusPlugin.php.

130 : int {
131 $plugin = self::initPluginObj($a_obj_id);
132 if ($plugin) {
134 if (method_exists($plugin, "getPercentageForUser")) {
135 return $plugin->getPercentageForUser($a_usr_id);
136 }
137 }
138 // re-use existing data for inactive plugin
139 return self::getPercentageForUser($a_obj_id, $a_usr_id);
140 }
141 // #11368
142 return 0;
143 }
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 107 of file class.ilLPStatusPlugin.php.

111 : int {
112 $plugin = self::initPluginObj($a_obj_id);
113 if ($plugin) {
115 // :TODO: create read_event here to make sure?
116 return $plugin->getLPStatusForUser($a_usr_id);
117 } else {
118 // re-use existing data for inactive plugin
119 return self::getLPDataForUser($a_obj_id, $a_usr_id);
120 }
121 }
122 // #11368
124 }
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 172 of file class.ilLPStatusPlugin.php.

175 : int {
176 global $DIC;
177
178 $ilDB = $DIC['ilDB'];
179
180 $set = $ilDB->query(
181 "SELECT status" .
182 " FROM ut_lp_marks" .
183 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
184 " AND usr_id = " . $ilDB->quote($a_user_id, "integer")
185 );
186 $row = $ilDB->fetchAssoc($set);
187 $status = $row["status"];
188 if (!$status) {
190 }
191 return $status;
192 }
global $DIC
Definition: shib_login.php:26

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 148 of file class.ilLPStatusPlugin.php.

151 : array {
152 global $DIC;
153
154 $ilDB = $DIC['ilDB'];
155
156 $all = array();
157 $set = $ilDB->query(
158 "SELECT usr_id" .
159 " FROM ut_lp_marks" .
160 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
161 " AND status = " . $ilDB->quote($a_status, "integer")
162 );
163 while ($row = $ilDB->fetchAssoc($set)) {
164 $all[] = (int) $row["usr_id"];
165 }
166 return $all;
167 }

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 194 of file class.ilLPStatusPlugin.php.

197 : int {
198 global $DIC;
199
200 $ilDB = $DIC['ilDB'];
201
202 $set = $ilDB->query(
203 "SELECT percentage" .
204 " FROM ut_lp_marks" .
205 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
206 " AND usr_id = " . $ilDB->quote($a_user_id, "integer")
207 );
208 $row = $ilDB->fetchAssoc($set);
209 return (int) ($row["percentage"] ?? 0);
210 }

◆ 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 33 of file class.ilLPStatusPlugin.php.

34 {
35 $olp = ilObjectLP::getInstance($a_obj_id);
36 return $olp->getPluginInstance();
37 }
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: