ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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, $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_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$

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

Constructor & Destructor Documentation

◆ __construct()

ilLPStatusManualByTutor::__construct (   $a_obj_id)

Constructor.

public

Parameters
intobject id

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

References $DIC, and $ilDB.

45  {
46  global $DIC;
47 
48  $ilDB = $DIC['ilDB'];
49 
50  parent::__construct($a_obj_id);
51  $this->db = $ilDB;
52  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ _getCompleted()

static ilLPStatusManualByTutor::_getCompleted (   $a_obj_id)
static

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

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

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  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB

◆ _getInProgress()

static ilLPStatusManualByTutor::_getInProgress (   $a_obj_id)
static

get in progress

public

Parameters
intobject id
Returns
array int Array of user ids

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

References $users, ilLPStatusWrapper\_getCompleted(), and ilChangeEvent\lookupUsersInProgress().

84  {
85  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
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 _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
$users
Definition: authpage.php:44
static lookupUsersInProgress($a_obj_id)
Lookup users in progress.
+ Here is the call graph for this function:

◆ _getNotAttempted()

static ilLPStatusManualByTutor::_getNotAttempted (   $a_obj_id)
static

get not attempted

public

Parameters
intobject id
Returns
array int Array of user ids

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

References $users, ilLPStatusWrapper\_getCompleted(), and ilLPStatusWrapper\_getInProgress().

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 _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
$users
Definition: authpage.php:44
+ 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

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  }

◆ _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

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

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  }

◆ 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

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

References $DIC, $ilDB, and ilChangeEvent\hasAccessed().

133  {
134  global $DIC;
135 
136  $ilObjDataCache = $DIC['ilObjDataCache'];
137  $ilDB = $DIC['ilDB'];
138 
139  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
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)) {
149  $status = self::LP_STATUS_COMPLETED_NUM;
150  } else {
151  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
152  if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id)) {
153  $status = self::LP_STATUS_IN_PROGRESS_NUM;
154  }
155  }
156  break;
157  }
158  return $status;
159  }
static hasAccessed($a_obj_id, $a_usr_id)
Has accessed.
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

References $DIC, and ilParticipants\getInstanceByObjId().

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  }
global $DIC
Definition: saml.php:7
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
+ Here is the call graph for this function:

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