ILIAS  release_7 Revision v7.30-3-g800a261c036
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, &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
 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, $a_image_only=true)
 

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_old_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
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
 $obj_id = null
 
 $db = null
 

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 $DIC;
47
48 $ilDB = $DIC['ilDB'];
49
50 parent::__construct($a_obj_id);
51 $this->db = $ilDB;
52 }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilDB

References $DIC, $ilDB, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

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 $DIC;
102
103 $ilDB = $DIC['ilDB'];
104
105 $usr_ids = array();
106
107 $query = "SELECT DISTINCT(usr_id) user_id FROM ut_lp_marks " .
108 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
109 "AND completed = '1' ";
110
111 $res = $ilDB->query($query);
112 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
113 $usr_ids[] = $row->user_id;
114 }
115
116 if ($usr_ids) {
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 }
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, 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 83 of file class.ilLPStatusManualByTutor.php.

84 {
85 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
86 $users = ilChangeEvent::lookupUsersInProgress($a_obj_id);
87
88 // Exclude all users with status completed.
89 $users = array_diff((array) $users, ilLPStatusWrapper::_getCompleted($a_obj_id));
90
91 if ($users) {
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 62 of file class.ilLPStatusManualByTutor.php.

63 {
64 $users = array();
65
66 $members = self::getMembers($a_obj_id);
67 if ($members) {
68 // diff in progress and completed (use stored result in LPStatusWrapper)
69 $users = array_diff($members, ilLPStatusWrapper::_getInProgress($a_obj_id));
70 $users = array_diff($users, ilLPStatusWrapper::_getCompleted($a_obj_id));
71 }
72
73 return $users;
74 }
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 189 of file class.ilLPStatusManualByTutor.php.

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

208 {
209 return array();
210 }

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

220 {
221 if (!$a_user_ids) {
222 $a_user_ids = self::getMembers($a_obj_id);
223 if (!$a_user_ids) {
224 return array();
225 }
226 }
227 return self::_lookupStatusForObject($a_obj_id, self::LP_STATUS_IN_PROGRESS_NUM, $a_user_ids);
228 }

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 $DIC;
135
136 $ilObjDataCache = $DIC['ilObjDataCache'];
137 $ilDB = $DIC['ilDB'];
138
140 switch ($ilObjDataCache->lookupType($a_obj_id)) {
141 case "crs":
142 case "grp":
143 // completed?
144 $set = $ilDB->query($q = "SELECT usr_id FROM ut_lp_marks " .
145 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
146 "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . " " .
147 "AND completed = '1' ");
148 if ($rec = $ilDB->fetchAssoc($set)) {
150 } else {
151 include_once './Services/Tracking/classes/class.ilChangeEvent.php';
152 if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
154 }
155 }
156 break;
157 }
158 return $status;
159 }
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 $DIC, $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 166 of file class.ilLPStatusManualByTutor.php.

167 {
168 global $DIC;
169
170 $ilObjDataCache = $DIC['ilObjDataCache'];
171
172 switch ($ilObjDataCache->lookupType($a_obj_id)) {
173 case 'crs':
174 case 'grp':
175 include_once './Services/Membership/classes/class.ilParticipants.php';
176 return ilParticipants::getInstanceByObjId($a_obj_id)->getMembers();
177 }
178
179 return array();
180 }
static getInstanceByObjId($a_obj_id)
Get instance by obj type.

References $DIC, and 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: