ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLPStatusManualByTutor Class Reference
+ Inheritance diagram for ilLPStatusManualByTutor:
+ Collaboration diagram for ilLPStatusManualByTutor:

Public Member Functions

 __construct ($a_obj_id)
 Constructor. More...
 
 _getNotAttempted ($a_obj_id)
 get not attempted More...
 
 _getInProgress ($a_obj_id)
 get in progress More...
 
 _getCompleted ($a_obj_id)
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
- Public Member Functions inherited from ilLPStatus
 ilLPStatus ($a_obj_id)
 
 _getCountNotAttempted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 _getCountInProgress ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCountCompleted ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getFailed ($a_obj_id)
 
 _getCountFailed ()
 
 _getStatusInfo ($a_obj_id)
 
 _getTypicalLearningTime ($a_obj_id)
 
 _updateStatus ($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
 New status handling (st: status, nr: accesses, p: percentage, t: time spent, m: mark) More...
 
 determinePercentage ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine percentage. More...
 
 determineStatus ($a_obj_id, $a_usr_id, $a_obj=null)
 Determine status. More...
 
 refreshStatus ($a_obj_id, $a_users=null)
 Refresh status. More...
 
 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. More...
 

Static Public Member Functions

static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
- Static Public Member Functions inherited from ilLPStatus
static checkStatusForObject ($a_obj_id, $a_users=false)
 This function checks whether the status for a given number of users is dirty and must be recalculated. More...
 
static writeStatus ($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
 Write status for user and object. More...
 
static setInProgressIfNotAttempted ($a_obj_id, $a_user_id)
 This function shoudl be clalled for normal "read events". More...
 
static setAllDirty ()
 Sets all status to dirty. More...
 
static setDirty ($a_obj_id)
 Sets status of an object to dirty. More...
 
static _lookupStatus ($a_obj_id, $a_user_id, $a_create=true)
 Lookup status. More...
 
static _lookupPercentage ($a_obj_id, $a_user_id)
 Lookup percentage. More...
 
static _hasUserCompleted ($a_obj_id, $a_user_id)
 Lookup user object completion. More...
 
static _lookupCompletedForObject ($a_obj_id, $a_user_ids=null)
 Get completed users for object. More...
 
static _lookupFailedForObject ($a_obj_id, $a_user_ids=null)
 Get failed users for object. More...
 
static _lookupInProgressForObject ($a_obj_id, $a_user_ids=null)
 Get in progress users for object. More...
 
static preloadListGUIData ($a_obj_ids)
 
static getListGUIStatus ($a_obj_id)
 

Static Protected Member Functions

static getMembers ($a_obj_id)
 Get members for object. More...
 
- Static Protected Member Functions inherited from ilLPStatus
static _lookupStatusForObject ($a_obj_id, $a_status, $a_user_ids=null)
 Get users with given status for object. More...
 
static validateLPForObjects ($a_user_id, $a_obj_ids, $a_parent_ref_id)
 Process given objects for lp-relevance. More...
 
static checkLPModesForObjects ($a_obj_ids, array &$a_coll_obj_ids)
 Process lp modes for given objects. More...
 
static getLPStatusForObjects ($a_user_id, $a_obj_ids)
 Get LP status for given objects (and user) More...
 

Additional Inherited Members

- Data Fields inherited from ilLPStatus
 $obj_id = null
 
 $db = null
 
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 Member Functions inherited from ilLPStatus
 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

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

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusManualByTutor::__construct (   $a_obj_id)

Constructor.

@access public

Parameters
intobject id

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

45 {
46 global $ilDB;
47
48 parent::ilLPStatus($a_obj_id);
49 $this->db = $ilDB;
50 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ _getCompleted()

ilLPStatusManualByTutor::_getCompleted (   $a_obj_id)

Reimplemented from ilLPStatus.

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

100 {
101 global $ilDB;
102
103 $usr_ids = array();
104
105 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks ".
106 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
107 "AND completed = '1' ";
108
109 $res = $ilDB->query($query);
110 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
111 {
112 $usr_ids[] = $row->user_id;
113 }
114
115 if($usr_ids)
116 {
117 // Exclude all non members
118 $usr_ids = array_intersect(self::getMembers($a_obj_id), (array)$usr_ids);
119 }
120
121 return $usr_ids;
122 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

◆ _getInProgress()

ilLPStatusManualByTutor::_getInProgress (   $a_obj_id)

get in progress

@access public

Parameters
intobject id
Returns
array int Array of user ids

Reimplemented from ilLPStatus.

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

83 {
84 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
85 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
86
87 // Exclude all users with status completed.
88 $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
89
90 if($users)
91 {
92 // Exclude all non members
93 $users = array_intersect(self::getMembers($a_obj_id), (array)$users);
94 }
95
96 return $users;
97 }
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
_getCompleted($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()

ilLPStatusManualByTutor::_getNotAttempted (   $a_obj_id)

get not attempted

@access public

Parameters
intobject id
Returns
array int Array of user ids

Reimplemented from ilLPStatus.

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

61 {
62 $users = array();
63
64 $members = self::getMembers($a_obj_id);
65 if($members)
66 {
67 // diff in progress and completed (use stored result in LPStatusWrapper)
68 $users = array_diff($members, ilLPStatusWrapper::_getInProgress($a_obj_id));
69 $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
70 }
71
72 return $users;
73 }
static getMembers($a_obj_id)
Get members for object.
_getInProgress($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 (   $a_obj_id,
  $a_user_ids = null 
)
static

Get completed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

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

References ilLPStatus\_lookupStatusForObject(), and getMembers().

+ Here is the call graph for this function:

◆ _lookupFailedForObject()

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

Get failed users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

215 {
216 return array();
217 }

◆ _lookupInProgressForObject()

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

Get in progress users for object.

Parameters
int$a_obj_id
array$a_user_ids
Returns
array

Reimplemented from ilLPStatus.

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

227 {
228 if(!$a_user_ids)
229 {
230 $a_user_ids = self::getMembers($a_obj_id);
231 if(!$a_user_ids)
232 {
233 return array();
234 }
235 }
236 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
237 }

References ilLPStatus\_lookupStatusForObject(), and getMembers().

+ Here is the call graph for this function:

◆ determineStatus()

ilLPStatusManualByTutor::determineStatus (   $a_obj_id,
  $a_user_id,
  $a_obj = null 
)

Determine status.

Parameters
integerobject id
integeruser id
objectobject (optional depends on object type)
Returns
integer status

Reimplemented from ilLPStatus.

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

133 {
134 global $ilObjDataCache, $ilDB;
135
137 switch ($ilObjDataCache->lookupType($a_obj_id))
138 {
139 case "crs":
140 case "grp":
141 // completed?
142 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks ".
143 "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
144 "AND usr_id = ".$ilDB->quote($a_user_id ,'integer')." ".
145 "AND completed = '1' ");
146 if ($rec = $ilDB->fetchAssoc($set))
147 {
149 }
150 else
151 {
152 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
153 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id))
154 {
156 }
157 }
158 break;
159 }
160 return $status;
161 }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM

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

+ Here is the call graph for this function:

◆ getMembers()

static ilLPStatusManualByTutor::getMembers (   $a_obj_id)
staticprotected

Get members for object.

Parameters
int$a_obj_id
Returns
array

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

169 {
170 global $ilObjDataCache;
171
172 switch($ilObjDataCache->lookupType($a_obj_id))
173 {
174 case 'crs':
175 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
176 $member_obj = ilCourseParticipants::_getInstanceByObjId($a_obj_id);
177 return $member_obj->getMembers();
178
179 case 'grp':
180 include_once './Modules/Group/classes/class.ilObjGroup.php';
181 return ilObjGroup::_getMembers($a_obj_id);
182 }
183
184 return array();
185 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
_getMembers($a_obj_id)

References ilCourseParticipants\_getInstanceByObjId(), and ilObjGroup\_getMembers().

Referenced by _getNotAttempted(), _lookupCompletedForObject(), and _lookupInProgressForObject().

+ 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: