ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPStatusTestPassed.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
33 include_once './Services/Tracking/classes/class.ilLPStatus.php';
34 
36 {
37 
38  function ilLPStatusTestPassed($a_obj_id)
39  {
40  global $ilDB;
41 
42  parent::ilLPStatus($a_obj_id);
43  $this->db =& $ilDB;
44  }
45 
46  function _getInProgress($a_obj_id)
47  {
48  global $ilDB;
49 
50  global $ilBench;
51  $ilBench->start('LearningProgress','9182_LPStatusTestPassed_inProgress');
52 
53 
54  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
55 
56  $query = "SELECT DISTINCT(user_fi) FROM tst_active ".
57  "WHERE test_fi = '".ilObjTestAccess::_getTestIDFromObjectID($a_obj_id)."'";
58 
59  $res = $ilDB->query($query);
60  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
61  {
62  $user_ids[] = $row->user_fi;
63  }
64 
65  $users = array_diff((array) $user_ids,ilLPStatusWrapper::_getCompleted($a_obj_id));
66  $users = array_diff((array) $users,ilLPStatusWrapper::_getFailed($a_obj_id));
67 
68  $ilBench->stop('LearningProgress','9182_LPStatusTestPassed_inProgress');
69  return $users ? $users : array();
70  }
71 
72  function _getCompleted($a_obj_id)
73  {
74  global $ilDB;
75 
76  global $ilBench;
77  $ilBench->start('LearningProgress','9183_LPStatusTestPassed_completed');
78 
79  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
80  include_once './Services/Tracking/classes/class.ilTestResultCache.php';
81 
82  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
83  foreach($status_info['results'] as $user_data)
84  {
85  if($user_data['passed'])
86  {
87  $user_ids[] = $user_data['user_id'];
88  }
89  }
90  $ilBench->stop('LearningProgress','9183_LPStatusTestPassed_completed');
91  return $user_ids ? $user_ids : array();
92  }
93 
94  function _getFailed($a_obj_id)
95  {
96  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
97  foreach($status_info['results'] as $user_data)
98  {
99  if($user_data['failed'])
100  {
101  $user_ids[] = $user_data['user_id'];
102  }
103  }
104  return $user_ids ? $user_ids : array();
105  }
106 
107  function _getStatusInfo($a_obj_id)
108  {
109  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
110  $status_info['results'] = ilObjTestAccess::_getPassedUsers($a_obj_id);
111  return $status_info;
112  }
113 
114 }
115 ?>