ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLPStatusTestFinished Class Reference
+ Inheritance diagram for ilLPStatusTestFinished:
+ Collaboration diagram for ilLPStatusTestFinished:

Public Member Functions

 ilLPStatusTestFinished ($a_obj_id)
 
 _getInProgress ($a_obj_id)
 
 _getCompleted ($a_obj_id)
 
 _getNotAttempted ($a_obj_id)
 
 getParticipants ($a_obj_id)
 Get participants. More...
 
 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_no_raise=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...
 

Additional Inherited Members

- 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)
 
- 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)
 
- 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...
 

Detailed Description

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

Definition at line 15 of file class.ilLPStatusTestFinished.php.

Member Function Documentation

◆ _getCompleted()

ilLPStatusTestFinished::_getCompleted (   $a_obj_id)

Definition at line 56 of file class.ilLPStatusTestFinished.php.

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

57  {
58  global $ilDB;
59 
60  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
61 
62  $query = "
63  SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
64  FROM tst_active
65  LEFT JOIN tst_sequence
66  ON tst_sequence.active_fi = tst_active.active_id
67  WHERE tries > {$ilDB->quote(0, "integer")}
68  AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
69  GROUP BY active_id, user_fi
70  HAVING COUNT(tst_sequence.active_fi) > {$ilDB->quote(0, "integer")}
71  ";
72 
73  $res = $ilDB->query($query);
74 
75  $user_ids = array();
76 
77  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
78  {
79  $user_ids[$row->user_fi] = $row->user_fi;
80  }
81 
82  return array_values($user_ids);
83  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

◆ _getInProgress()

ilLPStatusTestFinished::_getInProgress (   $a_obj_id)

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

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

27  {
28  global $ilDB;
29 
30  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
31 
32  $query = "
33  SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
34  FROM tst_active
35  LEFT JOIN tst_sequence
36  ON tst_sequence.active_fi = tst_active.active_id
37  WHERE tries = {$ilDB->quote(0, "integer")}
38  AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id), "integer")}
39  GROUP BY active_id, user_fi
40  HAVING COUNT(tst_sequence.active_fi) > {$ilDB->quote(0, "integer")}
41  ";
42 
43  $res = $ilDB->query($query);
44 
45  $user_ids = array();
46 
47  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
48  {
49  $user_ids[$row->user_fi] = $row->user_fi;
50  }
51 
52  return array_values($user_ids);
53  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

◆ _getNotAttempted()

ilLPStatusTestFinished::_getNotAttempted (   $a_obj_id)

Definition at line 85 of file class.ilLPStatusTestFinished.php.

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

86  {
87  global $ilDB;
88 
89  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
90 
91  $query = "
92  SELECT active_id, user_fi, COUNT(tst_sequence.active_fi) sequences
93  FROM tst_active
94  LEFT JOIN tst_sequence
95  ON tst_sequence.active_fi = tst_active.active_id
96  WHERE test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
97  GROUP BY active_id, user_fi
98  HAVING COUNT(tst_sequence.active_fi) = {$ilDB->quote(0, "integer")}
99  ";
100 
101  $res = $ilDB->query($query);
102 
103  $user_ids = array();
104 
105  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
106  {
107  $user_ids[$row->user_fi] = $row->user_fi;
108  }
109 
110  return array_values($user_ids);
111  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

◆ determineStatus()

ilLPStatusTestFinished::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 145 of file class.ilLPStatusTestFinished.php.

References $ilDB, and $res.

146  {
147  global $ilDB;
148 
149  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
150 
151  $res = $ilDB->query("
152  SELECT active_id, user_fi, tries, COUNT(tst_sequence.active_fi) sequences
153  FROM tst_active
154  LEFT JOIN tst_sequence
155  ON tst_sequence.active_fi = tst_active.active_id
156  WHERE user_fi = {$ilDB->quote($a_user_id, "integer")}
157  AND test_fi = {$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id))}
158  GROUP BY active_id, user_fi, tries
159  ");
160 
161  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
162 
163  if ($rec = $ilDB->fetchAssoc($res))
164  {
165  if ($rec['sequences'] > 0)
166  {
167  $status = self::LP_STATUS_IN_PROGRESS_NUM;
168 
169  if ($rec['tries'] > 0)
170  {
171  $status = self::LP_STATUS_COMPLETED_NUM;
172  }
173  }
174  }
175 
176  return $status;
177  }
global $ilDB

◆ getParticipants()

ilLPStatusTestFinished::getParticipants (   $a_obj_id)

Get participants.

Parameters

Definition at line 119 of file class.ilLPStatusTestFinished.php.

References $ilDB, $res, and ilObjTestAccess\_getTestIDFromObjectID().

120  {
121  global $ilDB;
122 
123  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
124 
125  $res = $ilDB->query("SELECT DISTINCT user_fi FROM tst_active".
126  " WHERE test_fi = ".$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id)));
127  $user_ids = array();
128 
129  while($rec = $ilDB->fetchAssoc($res))
130  {
131  $user_ids[] = $rec["user_fi"];
132  }
133  return $user_ids;
134  }
_getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
global $ilDB
+ Here is the call graph for this function:

◆ ilLPStatusTestFinished()

ilLPStatusTestFinished::ilLPStatusTestFinished (   $a_obj_id)

Definition at line 18 of file class.ilLPStatusTestFinished.php.

References $ilDB.

19  {
20  global $ilDB;
21 
22  parent::ilLPStatus($a_obj_id);
23  $this->db =& $ilDB;
24  }
global $ilDB

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