ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLPStatusFactory.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.ilLPObjSettings.php';
6 
20 {
21  static private $class_by_obj_id = array();
22 
23  const PATH = 'Services/Tracking/classes/status/';
24 
25  function _getClassById($a_obj_id, $a_mode = NULL)
26  {
27  if($a_mode === NULL)
28  {
29  include_once 'Services/Object/classes/class.ilObjectLP.php';
30  $olp = ilObjectLP::getInstance($a_obj_id);
31  $a_mode = $olp->getCurrentMode();
32 
33  // please keep the cache in this if-block, otherwise default values
34  // will not trigger the include_once calls
35  if (isset(self::$class_by_obj_id[$a_obj_id]))
36  {
37  return self::$class_by_obj_id[$a_obj_id];
38  }
39  }
40 
41  switch($a_mode)
42  {
44  include_once self::PATH.'class.ilLPStatusVisits.php';
45  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusVisits';
46 
48  include_once self::PATH.'class.ilLPStatusCollection.php';
49  return self::$class_by_obj_id[$a_obj_id] ='ilLPStatusCollection';
50 
52  include_once self::PATH.'class.ilLPStatusTypicalLearningTime.php';
53  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusTypicalLearningTime';
54 
56  include_once self::PATH.'class.ilLPStatusSCORM.php';
57  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusSCORM';
58 
60  include_once self::PATH.'class.ilLPStatusTestFinished.php';
61  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusTestFinished';
62 
64  include_once self::PATH.'class.ilLPStatusTestPassed.php';
65  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusTestPassed';
66 
68  include_once self::PATH.'class.ilLPStatusManual.php';
69  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusManual';
70 
72  include_once self::PATH.'class.ilLPStatusManualByTutor.php';
73  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusManualByTutor';
74 
76  include_once self::PATH.'class.ilLPStatusExerciseReturned.php';
77  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusExerciseReturned';
78 
80  include_once self::PATH.'class.ilLPStatusObjectives.php';
81  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusObjectives';
82 
84  include_once self::PATH.'class.ilLPStatusSCORMPackage.php';
85  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusSCORMPackage';
86 
88  include_once self::PATH.'class.ilLPStatusEvent.php';
89  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusEvent';
90 
92  include_once self::PATH.'class.ilLPStatusPlugin.php';
93  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusPlugin';
94 
96  include_once self::PATH.'class.ilLPStatusCollectionTLT.php';
97  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusCollectionTLT';
98 
100  include_once self::PATH.'class.ilLPStatusCollectionManual.php';
101  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusCollectionManual';
102 
104  include_once self::PATH.'class.ilLPStatusQuestions.php';
105  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatusQuestions';
106 
108  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
109  return self::$class_by_obj_id[$a_obj_id] = 'ilLPStatus';
110 
112  include_once 'Services/Object/classes/class.ilObjectLP.php';
113  $olp = ilObjectLP::getInstance($a_obj_id);
114  $mode = $olp->getCurrentMode();
116  {
117  return self::$class_by_obj_id[$a_obj_id] = self::_getClassById($a_obj_id, $mode);
118  }
119  // fallthrough
120 
121  default:
122  echo "ilLPStatusFactory: unknown type ".$a_mode;
123  exit;
124  }
125  }
126 
127  function _getClassByIdAndType($a_obj_id,$a_type)
128  {
129  // id is ignored in the moment
130  switch($a_type)
131  {
132  case 'event':
133  include_once self::PATH.'class.ilLPStatusEvent.php';
134  return 'ilLPStatusEvent';
135 
136  default:
137  echo "ilLPStatusFactory: unknown type: ".$a_type;
138  exit;
139  }
140  }
141 
142  function _getInstance($a_obj_id, $a_mode = NULL)
143  {
144  if($a_mode === NULL)
145  {
146  include_once 'Services/Object/classes/class.ilObjectLP.php';
147  $olp = ilObjectLP::getInstance($a_obj_id);
148  $a_mode = $olp->getCurrentMode();
149  }
150 
151  switch($a_mode)
152  {
154  include_once self::PATH.'class.ilLPStatusVisits.php';
155  return new ilLPStatusVisits($a_obj_id);
156 
158  include_once self::PATH.'class.ilLPStatusCollection.php';
159  return new ilLPStatusCollection($a_obj_id);
160 
162  include_once self::PATH.'class.ilLPStatusTypicalLearningTime.php';
163  return new ilLPStatusTypicalLearningTime($a_obj_id);
164 
166  include_once self::PATH.'class.ilLPStatusSCORM.php';
167  return new ilLPStatusSCORM($a_obj_id);
168 
170  include_once self::PATH.'class.ilLPStatusTestFinished.php';
171  return new ilLPStatusTestFinished($a_obj_id);
172 
174  include_once self::PATH.'class.ilLPStatusTestPassed.php';
175  return new ilLPStatusTestPassed($a_obj_id);
176 
178  include_once self::PATH.'class.ilLPStatusManual.php';
179  return new ilLPStatusManual($a_obj_id);
180 
182  include_once self::PATH.'class.ilLPStatusManualByTutor.php';
183  return new ilLPStatusManualByTutor($a_obj_id);
184 
186  include_once self::PATH.'class.ilLPStatusExerciseReturned.php';
187  return new ilLPStatusExerciseReturned($a_obj_id);
188 
190  include_once self::PATH.'class.ilLPStatusObjectives.php';
191  return new ilLPStatusObjectives($a_obj_id);
192 
194  include_once self::PATH.'class.ilLPStatusSCORMPackage.php';
195  return new ilLPStatusSCORMPackage($a_obj_id);
196 
198  include_once self::PATH.'class.ilLPStatusEvent.php';
199  return new ilLPStatusEvent($a_obj_id);
200 
202  include_once self::PATH.'class.ilLPStatusPlugin.php';
203  return new ilLPStatusPlugin($a_obj_id);
204 
206  include_once self::PATH.'class.ilLPStatusCollectionTLT.php';
207  return new ilLPStatusCollectionTLT($a_obj_id);
208 
210  include_once self::PATH.'class.ilLPStatusCollectionManual.php';
211  return new ilLPStatusCollectionManual($a_obj_id);
212 
214  include_once self::PATH.'class.ilLPStatusQuestions.php';
215  return new ilLPStatusQuestions($a_obj_id);
216 
218  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
219  return new ilLPStatus($a_obj_id);
220 
222  include_once 'Services/Object/classes/class.ilObjectLP.php';
223  $olp = ilObjectLP::getInstance($a_obj_id);
224  $mode = $olp->getCurrentMode();
226  {
227  return self::_getInstance($a_obj_id, $mode);
228  }
229  // fallthrough
230 
231  default:
232  echo "ilLPStatusFactory: unknown type ".$a_mode;
233  exit;
234  }
235  }
236 }
237 
238 ?>
exit
Definition: login.php:54
Class ilLPStatusFactory Creates status class instances for learning progress modes of an object...
_getInstance($a_obj_id, $a_mode=NULL)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
_getClassByIdAndType($a_obj_id, $a_type)
static getInstance($a_obj_id)
_getClassById($a_obj_id, $a_mode=NULL)