ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPStatusTestFinished.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once './Services/Tracking/classes/class.ilLPStatus.php';
6 
16 {
17 
18  function ilLPStatusTestFinished($a_obj_id)
19  {
20  global $ilDB;
21 
22  parent::ilLPStatus($a_obj_id);
23  $this->db =& $ilDB;
24  }
25 
26  function _getInProgress($a_obj_id)
27  {
28  global $ilDB;
29 
30  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
31 
32  $query = "SELECT DISTINCT(user_fi) FROM tst_active ".
33  " WHERE tries = ".$ilDB->quote(0, "integer").
34  " AND test_fi = ".$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id), "integer");
35 
36  $res = $ilDB->query($query);
37  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
38  {
39  $user_ids[] = $row->user_fi;
40  }
41  return $user_ids ? $user_ids : array();
42  }
43 
44 
45  function _getCompleted($a_obj_id)
46  {
47  global $ilDB;
48 
49  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
50 
51  $query = "SELECT DISTINCT(user_fi) FROM tst_active ".
52  " WHERE tries > ".$ilDB->quote(0, "integer").
53  " AND test_fi = ".$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id));
54 
55  $res = $ilDB->query($query);
56  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
57  {
58  $user_ids[] = $row->user_fi;
59  }
60  return $user_ids ? $user_ids : array();
61  }
62 
69  function getParticipants($a_obj_id)
70  {
71  global $ilDB;
72 
73  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
74 
75  $res = $ilDB->query("SELECT DISTINCT user_fi FROM tst_active".
76  " WHERE test_fi = ".$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id)));
77  $user_ids = array();
78 
79  while($rec = $ilDB->fetchAssoc($res))
80  {
81  $user_ids[] = $rec["user_fi"];
82  }
83  return $user_ids;
84  }
85 
86 
95  function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
96  {
97  global $ilObjDataCache, $ilDB, $ilLog;
98 
100 
101  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
102 
103  $res = $ilDB->query("SELECT tries FROM tst_active".
104  " WHERE user_fi = ".$ilDB->quote($a_user_id, "integer").
105  " AND test_fi = ".$ilDB->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id)));
106 
107  if ($rec = $ilDB->fetchAssoc($res))
108  {
109  if ($rec["tries"] == 0)
110  {
111  $status = LP_STATUS_IN_PROGRESS_NUM;
112  }
113  else if ($rec["tries"] > 0)
114  {
115  $status = LP_STATUS_COMPLETED_NUM;
116  }
117 
118  }
119 
120  return $status;
121  }
122 
123 }
124 ?>