ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLPStatusManualByTutor Class Reference
+ Inheritance diagram for ilLPStatusManualByTutor:
+ Collaboration diagram for ilLPStatusManualByTutor:

Public Member Functions

 __construct ($a_obj_id)
 Constructor. More...
 
 determineStatus ($a_obj_id, $a_user_id, $a_obj=null)
 Determine status. More...
 
- Public Member Functions inherited from ilLPStatus
 __construct ($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...
 

Static Public Member Functions

static _getNotAttempted ($a_obj_id)
 get not attempted More...
 
static _getInProgress ($a_obj_id)
 get in progress More...
 
static _getCompleted ($a_obj_id)
 
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 _getCountNotAttempted ($a_obj_id)
 
static _getNotAttempted ($a_obj_id)
 
static _getCountInProgress ($a_obj_id)
 
static _getInProgress ($a_obj_id)
 
static _getCountCompleted ($a_obj_id)
 
static _getCompleted ($a_obj_id)
 
static _getFailed ($a_obj_id)
 
static _getCountFailed ()
 
static _getStatusInfo ($a_obj_id)
 
static _getTypicalLearningTime ($a_obj_id)
 
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 _lookupStatusChanged ($a_obj_id, $a_user_id)
 Lookup status changed. 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 raiseEvent ($a_obj_id, $a_usr_id, $a_status, $a_percentage)
 
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
 

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

Reimplemented from ilLPStatus.

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

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

References $ilDB.

Member Function Documentation

◆ _getCompleted()

static ilLPStatusManualByTutor::_getCompleted (   $a_obj_id)
static

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(ilDBConstants::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 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

◆ _getInProgress()

static ilLPStatusManualByTutor::_getInProgress (   $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 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.
static _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()

static ilLPStatusManualByTutor::_getNotAttempted (   $a_obj_id)
static

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.
static _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 190 of file class.ilLPStatusManualByTutor.php.

191 {
192 if(!$a_user_ids)
193 {
194 $a_user_ids = self::getMembers($a_obj_id);
195 if(!$a_user_ids)
196 {
197 return array();
198 }
199 }
200 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_COMPLETED_NUM, $a_user_ids);
201 }
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 210 of file class.ilLPStatusManualByTutor.php.

211 {
212 return array();
213 }

◆ _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 222 of file class.ilLPStatusManualByTutor.php.

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

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 case 'grp':
176 include_once './Services/Membership/classes/class.ilParticipants.php';
177 return ilParticipants::getInstanceByObjId($a_obj_id)->getMembers();
178 }
179
180 return array();
181 }
static getInstanceByObjId($a_obj_id)
Get instance by obj type.

References ilParticipants\getInstanceByObjId().

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: