ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLPStatusManualByTutor Class Reference
+ Inheritance diagram for ilLPStatusManualByTutor:
+ Collaboration diagram for ilLPStatusManualByTutor:

Public Member Functions

 determineStatus (int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
 Determine status. More...
 
 refreshStatus (int $a_obj_id, ?array $a_users=null)
 Refresh status. More...
 
- 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)
 get not attempted More...
 
static _getInProgress (int $a_obj_id)
 get in progress @access public More...
 
static _getCompleted (int $a_obj_id)
 
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 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 getMembers (int $a_obj_id)
 Get members for object. More...
 
- 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
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om @ilCtrl_Calls

Definition at line 26 of file class.ilLPStatusManualByTutor.php.

Member Function Documentation

◆ _getCompleted()

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

Reimplemented from ilLPStatus.

Definition at line 75 of file class.ilLPStatusManualByTutor.php.

75 : array
76 {
77 global $DIC;
78
79 $ilDB = $DIC['ilDB'];
80
81 $usr_ids = array();
82
83 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks " .
84 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
85 "AND completed = '1' ";
86
87 $res = $ilDB->query($query);
88 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
89 $usr_ids[] = (int) $row->user_id;
90 }
91
92 if ($usr_ids) {
93 // Exclude all non members
94 $usr_ids = array_intersect(self::getMembers($a_obj_id), $usr_ids);
95 }
96 return $usr_ids;
97 }
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ _getInProgress()

static ilLPStatusManualByTutor::_getInProgress ( int  $a_obj_id)
static

get in progress @access public

Parameters
intobject id
Returns
array int Array of user ids

Reimplemented from ilLPStatus.

Definition at line 57 of file class.ilLPStatusManualByTutor.php.

57 : array
58 {
59 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
60
61 // Exclude all users with status completed.
62 $users = array_diff(
63 $users,
65 );
66
67 if ($users) {
68 // Exclude all non members
69 $users = array_intersect(self::getMembers($a_obj_id), $users);
70 }
71
72 return $users;
73 }
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:

◆ _getNotAttempted()

static ilLPStatusManualByTutor::_getNotAttempted ( int  $a_obj_id)
static

get not attempted

Reimplemented from ilLPStatus.

Definition at line 31 of file class.ilLPStatusManualByTutor.php.

31 : array
32 {
33 $users = array();
34
35 $members = self::getMembers($a_obj_id);
36 if ($members) {
37 // diff in progress and completed (use stored result in LPStatusWrapper)
38 $users = array_diff(
39 $members,
41 );
42 $users = array_diff(
43 $users,
45 );
46 }
47
48 return $users;
49 }
static getMembers(int $a_obj_id)
Get members for object.
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getInProgress(), and getMembers().

+ Here is the call graph for this function:

◆ _lookupCompletedForObject()

static ilLPStatusManualByTutor::_lookupCompletedForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get completed users for object.

Reimplemented from ilLPStatus.

Definition at line 189 of file class.ilLPStatusManualByTutor.php.

192 : array {
193 if (!$a_user_ids) {
194 $a_user_ids = self::getMembers($a_obj_id);
195 if (!$a_user_ids) {
196 return array();
197 }
198 }
200 $a_obj_id,
201 self::LP_STATUS_COMPLETED_NUM,
202 $a_user_ids
203 );
204 }
static _lookupStatusForObject(int $a_obj_id, int $a_status, ?array $a_user_ids=null)
Get users with given status for object.

◆ _lookupFailedForObject()

static ilLPStatusManualByTutor::_lookupFailedForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get failed users for object.

Reimplemented from ilLPStatus.

Definition at line 209 of file class.ilLPStatusManualByTutor.php.

212 : array {
213 return array();
214 }

◆ _lookupInProgressForObject()

static ilLPStatusManualByTutor::_lookupInProgressForObject ( int  $a_obj_id,
?array  $a_user_ids = null 
)
static

Get in progress users for object.

Reimplemented from ilLPStatus.

Definition at line 219 of file class.ilLPStatusManualByTutor.php.

222 : array {
223 if (!$a_user_ids) {
224 $a_user_ids = self::getMembers($a_obj_id);
225 if (!$a_user_ids) {
226 return array();
227 }
228 }
230 $a_obj_id,
231 self::LP_STATUS_IN_PROGRESS_NUM,
232 $a_user_ids
233 );
234 }

◆ determineStatus()

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

Determine status.

Reimplemented from ilLPStatus.

Definition at line 102 of file class.ilLPStatusManualByTutor.php.

106 : int {
107 global $DIC;
108
109 $ilObjDataCache = $DIC['ilObjDataCache'];
110
112 switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
113 case "crs":
114 case "grp":
115 // completed?
116 $set = $this->db->query(
117 $q = "SELECT usr_id FROM ut_lp_marks " .
118 "WHERE obj_id = " . $this->db->quote(
119 $a_obj_id,
120 'integer'
121 ) . " " .
122 "AND usr_id = " . $this->db->quote(
123 $a_usr_id,
124 'integer'
125 ) . " " .
126 "AND completed = '1' "
127 );
128 if ($rec = $this->db->fetchAssoc($set)) {
130 } else {
131 if (ilChangeEvent::hasAccessed($a_obj_id, $a_usr_id)) {
133 }
134 }
135 break;
136 }
137 return $status;
138 }
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
ilObjectDataCache $ilObjDataCache
$q
Definition: shib_logout.php:23

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

+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusManualByTutor::getMembers ( int  $a_obj_id)
staticprotected

Get members for object.

Definition at line 169 of file class.ilLPStatusManualByTutor.php.

169 : array
170 {
171 global $DIC;
172
173 $ilObjDataCache = $DIC['ilObjDataCache'];
174
175 switch ($ilObjDataCache->lookupType($a_obj_id)) {
176 case 'crs':
177 case 'grp':
179 $a_obj_id
180 )->getMembers();
181 }
182
183 return array();
184 }
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.

References $DIC, and ilParticipants\getInstanceByObjId().

Referenced by _getNotAttempted().

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

◆ refreshStatus()

ilLPStatusManualByTutor::refreshStatus ( int  $a_obj_id,
?array  $a_users = null 
)

Refresh status.

Reimplemented from ilLPStatus.

Definition at line 140 of file class.ilLPStatusManualByTutor.php.

140 : void
141 {
142 parent::refreshStatus($a_obj_id, $a_users);
143
144 if (ilObject::_lookupType($a_obj_id) !== 'crs') {
145 return;
146 }
147
148 $course_gui = new ilObjCourseGUI('', $a_obj_id, false);
149
150 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
151 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
152 $failed = ilLPStatusWrapper::_getFailed($a_obj_id);
153 $not_attempted = ilLPStatusWrapper::_getNotAttempted($a_obj_id);
154 $all_active_users = array_unique(
155 array_merge($in_progress, $completed, $failed, $not_attempted)
156 );
157
158 foreach ($all_active_users as $usr_id) {
159 $course_gui->updateLPFromStatus(
160 $usr_id,
161 ilParticipants::_hasPassed($a_obj_id, $usr_id)
162 );
163 }
164 }
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getNotAttempted(int $a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
Class ilObjCourseGUI.
static _lookupType(int $id, bool $reference=false)
static _hasPassed(int $a_obj_id, int $a_usr_id)
Check if user has passed course.

References ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilLPStatusWrapper\_getNotAttempted(), ilParticipants\_hasPassed(), and ilObject\_lookupType().

+ Here is the call graph for this function:

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