ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPStatusWrapper.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 
38 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
39 include_once 'Services/Tracking/classes/class.ilLPStatusFactory.php';
40 
42 {
43 
47  function _getCountNotAttempted($a_obj_id)
48  {
49  return count(ilLPStatusWrapper::_getNotAttempted($a_obj_id));
50  }
51 
55  function _getNotAttempted($a_obj_id)
56  {
57  static $cache = array();
58 
59  if(isset($cache[$a_obj_id]))
60  {
61  return $cache[$a_obj_id];
62  }
63 
64  $class = ilLPStatusFactory::_getClassById($a_obj_id);
65 
66  $cache[$a_obj_id] = call_user_func(array($class,'_getNotAttempted'),$a_obj_id);
67 
68  return $cache[$a_obj_id];
69  }
70 
74  function _getCountInProgress($a_obj_id)
75  {
76  return count(ilLPStatusWrapper::_getInProgress($a_obj_id));
77  }
78 
82  function _getInProgress($a_obj_id)
83  {
84  static $cache = array();
85 
86  if(isset($cache[$a_obj_id]))
87  {
88  return $cache[$a_obj_id];
89  }
90 
91  global $ilBench;
92 
93  $class = ilLPStatusFactory::_getClassById($a_obj_id);
94 
95  $cache[$a_obj_id] = call_user_func($tmp = array($class,'_getInProgress'),$a_obj_id);
96 
97  return $cache[$a_obj_id];
98  }
99 
103  function _getCountCompleted($a_obj_id)
104  {
105  return count(ilLPStatusWrapper::_getCompleted($a_obj_id));
106  }
107 
111  function _getCompleted($a_obj_id)
112  {
113  static $cache = array();
114 
115  if(isset($cache[$a_obj_id]))
116  {
117  return $cache[$a_obj_id];
118  }
119  $class = ilLPStatusFactory::_getClassById($a_obj_id);
120  $cache[$a_obj_id] = call_user_func(array($class,'_getCompleted'),$a_obj_id);
121 
122  return $cache[$a_obj_id];
123  }
124 
128  function _getCountFailed($a_obj_id)
129  {
130  return count(ilLPStatusWrapper::_getFailed($a_obj_id));
131  }
132 
136  function _getFailed($a_obj_id)
137  {
138  static $cache = array();
139 
140  if(isset($cache[$a_obj_id]))
141  {
142  return $cache[$a_obj_id];
143  }
144 
145  $class = ilLPStatusFactory::_getClassById($a_obj_id);
146 
147  $cache[$a_obj_id] = call_user_func(array($class,'_getFailed'),$a_obj_id);
148 
149  return $cache[$a_obj_id];
150  }
151 
155  function _getStatusInfo($a_obj_id)
156  {
157  static $cache = array();
158 
159  if(isset($cache[$a_obj_id]))
160  {
161  return $cache[$a_obj_id];
162  }
163 
164  $class = ilLPStatusFactory::_getClassById($a_obj_id);
165  $cache[$a_obj_id] = call_user_func(array($class,'_getStatusInfo'),$a_obj_id);
166  return $cache[$a_obj_id];
167  }
168 
172  function _getTypicalLearningTime($a_obj_id)
173  {
174  static $cache = array();
175 
176  if(isset($cache[$a_obj_id]))
177  {
178  return $cache[$a_obj_id];
179  }
180 
181  $class = ilLPStatusFactory::_getClassById($a_obj_id);
182 
183  $cache[$a_obj_id] = call_user_func(array($class,'_getTypicalLearningTime'),$a_obj_id);
184 
185  return $cache[$a_obj_id];
186  }
187 
189  // Special functions for 'objects' that have not an entry in object_data
190  // E.g. events
192 
196  function _getCountNotAttemptedByType($a_obj_id,$a_type)
197  {
198  return count(ilLPStatusWrapper::_getNotAttemptedByType($a_obj_id,$a_type));
199  }
200  function _getNotAttemptedByType($a_obj_id,$a_type)
201  {
202  static $cache = array();
203 
204  if(isset($cache[$a_obj_id.'_'.$a_type]))
205  {
206  return $cache[$a_obj_id.'_'.$a_type];
207  }
208 
209  $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
210 
211  $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getNotAttempted'),$a_obj_id);
212 
213  return $cache[$a_obj_id.'_'.$a_type];
214  }
215  function _getCountInProgressByType($a_obj_id,$a_type)
216  {
217  return count(ilLPStatusWrapper::_getInProgressByType($a_obj_id,$a_type));
218  }
219  function _getInProgressByType($a_obj_id,$a_type)
220  {
221  static $cache = array();
222 
223  if(isset($cache[$a_obj_id.'_'.$a_type]))
224  {
225  return $cache[$a_obj_id.'_'.$a_type];
226  }
227 
228  $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
229 
230  $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getInProgress'),$a_obj_id);
231 
232  return $cache[$a_obj_id.'_'.$a_type];
233  }
234  function _getCountCompletedByType($a_obj_id,$a_type)
235  {
236  return count(ilLPStatusWrapper::_getCompletedByType($a_obj_id,$a_type));
237  }
238  function _getCompletedByType($a_obj_id,$a_type)
239  {
240  static $cache = array();
241 
242  if(isset($cache[$a_obj_id.'_'.$a_type]))
243  {
244  return $cache[$a_obj_id.'_'.$a_type];
245  }
246 
247  $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
248  $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getCompleted'),$a_obj_id);
249  return $cache[$a_obj_id.'_'.$a_type];
250  }
251  function _getCountFailedByType($a_obj_id,$a_type)
252  {
253  return count(ilLPStatusWrapper::_getFailedByType($a_obj_id,$a_type));
254  }
255  function _getFailedByType($a_obj_id,$a_type)
256  {
257  static $cache = array();
258 
259  if(isset($cache[$a_obj_id.'_'.$a_type]))
260  {
261  return $cache[$a_obj_id.'_'.$a_type];
262  }
263 
264  $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
265  $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getFailed'),$a_obj_id);
266  return $cache[$a_obj_id.'_'.$a_type];
267  }
268  function _getStatusInfoByType($a_obj_id,$a_type)
269  {
270  static $cache = array();
271 
272  if(isset($cache[$a_obj_id.'_'.$a_type]))
273  {
274  return $cache[$a_obj_id.'_'.$a_type];
275  }
276 
277  $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
278 
279  $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getStatusInfo'),$a_obj_id);
280 
281  return $cache[$a_obj_id.'_'.$a_type];
282  }
283 }
284 ?>