ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups 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 
18 {
19  function _getClassById($a_obj_id, $a_mode = NULL)
20  {
21  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
22 
23  if($a_mode === NULL)
24  {
25  $a_mode = ilLPObjSettings::_lookupMode($a_obj_id);
26  }
27 
28  switch($a_mode)
29  {
30  case LP_MODE_VISITS:
31  include_once 'Services/Tracking/classes/class.ilLPStatusVisits.php';
32  return 'ilLPStatusVisits';
33 
34  case LP_MODE_COLLECTION:
35  include_once 'Services/Tracking/classes/class.ilLPStatusCollection.php';
36  return 'ilLPStatusCollection';
37 
38  case LP_MODE_TLT:
39  include_once 'Services/Tracking/classes/class.ilLPStatusTypicalLearningTime.php';
40  return 'ilLPStatusTypicalLearningTime';
41 
42  case LP_MODE_SCORM:
43  include_once 'Services/Tracking/classes/class.ilLPStatusSCORM.php';
44  return 'ilLPStatusSCORM';
45 
47  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
48  return 'ilLPStatus';
49 
51  include_once 'Services/Tracking/classes/class.ilLPStatusTestFinished.php';
52  return 'ilLPStatusTestFinished';
53 
55  include_once 'Services/Tracking/classes/class.ilLPStatusTestPassed.php';
56  return 'ilLPStatusTestPassed';
57 
58  case LP_MODE_MANUAL:
59  include_once 'Services/Tracking/classes/class.ilLPStatusManual.php';
60  return 'ilLPStatusManual';
61 
63  include_once 'Services/Tracking/classes/class.ilLPStatusManualByTutor.php';
64  return 'ilLPStatusManualByTutor';
65 
67  include_once 'Services/Tracking/classes/class.ilLPStatusExerciseReturned.php';
68  return 'ilLPStatusExerciseReturned';
69 
70  case LP_MODE_OBJECTIVES:
71  include_once 'Services/Tracking/classes/class.ilLPStatusObjectives.php';
72  return 'ilLPStatusObjectives';
73 
75  include_once 'Services/Tracking/classes/class.ilLPStatusSCORMPackage.php';
76  return 'ilLPStatusSCORMPackage';
77 
78  case LP_MODE_EVENT:
79  include_once('./Services/Tracking/classes/class.ilLPStatusEvent.php');
80  return 'ilLPStatusEvent';
81 
82  case LP_MODE_UNDEFINED:
83  $type = ilObject::_lookupType($a_obj_id);
84  $mode = ilLPObjSettings::__getDefaultMode($a_obj_id, $type);
85  return self::_getClassById($a_obj_id, $mode);
86 
87  default:
88  echo "ilLPStatusFactory: unknown type ".ilLPObjSettings::_lookupMode($a_obj_id);
89  exit;
90  }
91  }
92 
93  function _getClassByIdAndType($a_obj_id,$a_type)
94  {
95  // id is ignored in the moment
96  switch($a_type)
97  {
98  case 'event':
99  include_once 'Services/Tracking/classes/class.ilLPStatusEvent.php';
100  return 'ilLPStatusEvent';
101 
102  default:
103  echo "ilLPStatusFactory: unknown type: ".$a_type;
104  exit;
105  }
106  }
107 
108  function &_getInstance($a_obj_id, $a_mode = NULL)
109  {
110  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
111 
112  if($a_mode === NULL)
113  {
114  $a_mode = ilLPObjSettings::_lookupMode($a_obj_id);
115  }
116 
117  switch($a_mode)
118  {
119  case LP_MODE_VISITS:
120  include_once 'Services/Tracking/classes/class.ilLPStatusVisits.php';
121  return new ilLPStatusVisits($a_obj_id);
122 
123  case LP_MODE_COLLECTION:
124  include_once 'Services/Tracking/classes/class.ilLPStatusCollection.php';
125  return new ilLPStatusCollection($a_obj_id);
126 
127  case LP_MODE_TLT:
128  include_once 'Services/Tracking/classes/class.ilLPStatusTypicalLearningTime.php';
129  return new ilLPStatusTypicalLearningTime($a_obj_id);
130 
131  case LP_MODE_SCORM:
132  include_once 'Services/Tracking/classes/class.ilLPStatusSCORM.php';
133  return new ilLPStatusSCORM($a_obj_id);
134 
136  include_once 'Services/Tracking/classes/class.ilLPStatusTestFinished.php';
137  return new ilLPStatusTestFinished($a_obj_id);
138 
139  case LP_MODE_TEST_PASSED:
140  include_once 'Services/Tracking/classes/class.ilLPStatusTestPassed.php';
141  return new ilLPStatusTestPassed($a_obj_id);
142 
143  case LP_MODE_MANUAL:
144  include_once 'Services/Tracking/classes/class.ilLPStatusManual.php';
145  return new ilLPStatusManual($a_obj_id);
146 
148  include_once 'Services/Tracking/classes/class.ilLPStatusManualByTutor.php';
149  return new ilLPStatusManualByTutor($a_obj_id);
150 
152  include_once 'Services/Tracking/classes/class.ilLPStatusExerciseReturned.php';
153  return new ilLPStatusExerciseReturned($a_obj_id);
154 
155  case LP_MODE_OBJECTIVES:
156  include_once 'Services/Tracking/classes/class.ilLPStatusObjectives.php';
157  return new ilLPStatusObjectives($a_obj_id);
158 
159  case LP_MODE_EVENT:
160  include_once 'Services/Tracking/classes/class.ilLPStatusEvent.php';
161  return new ilLPStatusEvent($a_obj_id);
162 
163  case LP_MODE_UNDEFINED:
164  $type = ilObject::_lookupType($a_obj_id);
165  $mode = ilLPObjSettings::__getDefaultMode($a_obj_id, $type);
166  return self::_getInstance($a_obj_id, $mode);
167 
168  default:
169  echo "ilLPStatusFactory: unknown type ".ilLPObjSettings::_lookupMode($a_obj_id);
170  exit;
171  }
172  }
173 }
174 ?>