ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAICCCourse.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 require_once("./Modules/ScormAicc/classes/AICC/class.ilAICCObject.php");
6 
8 {
9 
22  var $level;
29  var $version;
32 
39  function ilAICCCourse($a_id = 0)
40  {
41  parent::ilAICCObject($a_id);
42  $this->setType("shd");
43  }
44 
45  function getCourseCreator()
46  {
47  return $this->course_creator;
48  }
49 
50  function setCourseCreator($a_course_creator)
51  {
52  $this->course_creator = $a_course_creator;
53  }
54 
55  function getCourseId()
56  {
57  return $this->course_id;
58  }
59 
60  function setCourseId($a_course_id)
61  {
62  $this->course_id = $a_course_id;
63  }
64 
65  function getCourseSystem()
66  {
67  return $this->course_system;
68  }
69 
70  function setCourseSystem($a_course_system)
71  {
72  $this->course_system = $a_course_system;
73  }
74 
75  function getCourseTitle()
76  {
77  return $this->course_title;
78  }
79 
80  function setCourseTitle($a_course_title)
81  {
82  $this->course_title = $a_course_title;
83  }
84 
85  function getLevel()
86  {
87  return $this->level;
88  }
89 
90  function setLevel($a_level)
91  {
92  $this->level = $a_level;
93  }
94 
95  function getMaxFieldsCst()
96  {
97  return $this->max_fields_cst;
98  }
99 
100  function setMaxFieldsCst($a_max_fields_cst)
101  {
102  if($a_max_fields_cst == NULL) $a_max_fields_cst=0;
103  $this->max_fields_cst = $a_max_fields_cst;
104  }
105 
106  function getMaxFieldsOrt()
107  {
108  return $this->max_fields_ort;
109  }
110 
111  function setMaxFieldsOrt($a_max_fields_ort)
112  {
113  if($a_max_fields_ort == NULL) $a_max_fields_ort=0;
114  $this->max_fields_ort = $a_max_fields_ort;
115  }
116 
117  function getTotalAUs()
118  {
119  return $this->total_aus;
120  }
121 
122  function setTotalAUs($a_total_aus)
123  {
124  $this->total_aus = $a_total_aus;
125  }
126 
127  function getTotalBlocks()
128  {
129  return $this->total_blocks;
130  }
131 
132  function setTotalBlocks($a_total_blocks)
133  {
134 
135  $this->total_blocks = $a_total_blocks;
136  }
137 
139  {
141  }
142 
143  function setTotalComplexObj($a_total_complex_obj)
144  {
145  if($a_total_complex_obj == NULL) $a_total_complex_obj=0;
146  $this->total_complex_obj = $a_total_complex_obj;
147  }
148 
150  {
152  }
153 
154  function setTotalObjectives($a_total_objectives)
155  {
156  $this->total_objectives = $a_total_objectives;
157  }
158 
159  function getVersion()
160  {
161  return $this->version;
162  }
163 
164  function setVersion($a_version)
165  {
166  $this->version = $a_version;
167  }
168 
169  function getMaxNormal()
170  {
171  return $this->max_normal;
172  }
173 
174  function setMaxNormal($a_max_normal)
175  {
176  $this->max_normal = $a_max_normal;
177  }
178 
179  function getDescription()
180  {
181  return $this->description;
182  }
183 
184  function setDescription($a_description)
185  {
186  $this->description = $a_description;
187  }
188 
189  function read()
190  {
191  global $ilDB;
192 
193  parent::read();
194 
195  $obj_set = $ilDB->queryF('SELECT * FROM aicc_course WHERE obj_id = %s',
196  array('integer'), array($this->id));
197 
198  while($obj_rec = $ilDB->fetchAssoc($obj_set))
199  {
200  $this->setCourseCreator($obj_rec["course_creator"]);
201  $this->setCourseId($obj_rec["course_id"]);
202  $this->setCourseSystem($obj_rec["course_system"]);
203  $this->setCourseTitle($obj_rec["course_title"]);
204  $this->setLevel($obj_rec["c_level"]);
205  $this->setMaxFieldsCst($obj_rec["max_fields_cst"]);
206  $this->setMaxFieldsOrt($obj_rec["max_fields_ort"]);
207  $this->setTotalAUs($obj_rec["total_aus"]);
208  $this->setTotalBlocks($obj_rec["total_blocks"]);
209  $this->setTotalComplexObj($obj_rec["total_complex_obj"]);
210  $this->setTotalObjectives($obj_rec["total_objectives"]);
211  $this->setVersion($obj_rec["version"]);
212  $this->setMaxNormal($obj_rec["max_normal"]);
213  $this->setDescription($obj_rec["description"]);
214  }
215  }
216 
217  function create()
218  {
219  global $ilDB;
220 
221  parent::create();
222 
223  $ilDB->insert('aicc_course', array(
224  'obj_id' => array('integer', $this->getId()),
225  'course_creator' => array('text', $this->getCourseCreator()),
226  'course_id' => array('text', $this->getCourseId()),
227  'course_system' => array('text', $this->getCourseSystem()),
228  'course_title' => array('text', $this->getCourseTitle()),
229  'c_level' => array('text', $this->getLevel()),
230  'max_fields_cst' => array('integer', $this->getMaxFieldsCst()),
231  'max_fields_ort' => array('integer', $this->getMaxFieldsOrt()),
232  'total_aus' => array('integer', $this->getTotalAUs()),
233  'total_blocks' => array('integer', $this->getTotalBlocks()),
234  'total_complex_obj' => array('integer', $this->getTotalComplexObj()),
235  'total_objectives' => array('integer', $this->getTotalObjectives()),
236  'version' => array('text', $this->getVersion()),
237  'max_normal' => array('integer', $this->getMaxNormal()),
238  'description' => array('clob', $this->getDescription())
239  ));
240  }
241 
242  function update()
243  {
244  global $ilDB;
245 
246  parent::update();
247 
248  $ilDB->update('aicc_course',
249  array(
250  'course_creator' => array('text', $this->getCourseCreator()),
251  'course_id' => array('text', $this->getCourseId()),
252  'course_system' => array('text', $this->getCourseSystem()),
253  'course_title' => array('text', $this->getCourseTitle()),
254  'c_level' => array('text', $this->getLevel()),
255  'max_fields_cst' => array('integer', $this->getMaxFieldsCst()),
256  'max_fields_ort' => array('integer', $this->getMaxFieldsOrt()),
257  'total_aus' => array('integer', $this->getTotalAUs()),
258  'total_blocks' => array('integer', $this->getTotalBlocks()),
259  'total_complex_obj' => array('integer', $this->getTotalComplexObj()),
260  'total_objectives' => array('integer', $this->getTotalObjectives()),
261  'version' => array('text', $this->getVersion()),
262  'max_normal' => array('integer', $this->getMaxNormal()),
263  'description' => array('clob', $this->getDescription())
264  ),
265  array(
266  'obj_id' => array('integer', $this->getId())
267  )
268  );
269  }
270 
271  function delete()
272  {
273  global $ilDB, $ilLog;
274 
275  parent::delete();
276 
277  $statement = $ilDB->manipulateF(
278  'DELETE FROM aicc_course WHERE obj_id = %s',
279  array('integer'),
280  array($this->getId())
281  );
282 
283  $statement = $ilDB->manipulateF('
284  DELETE FROM scorm_tracking
285  WHERE sco_id = %s
286  AND obj_id = %s',
287  array('integer', 'integer'),
288  array($this->getId(),$this->getALMId())
289  );
290 
291  // update learning progress status
292  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
294 
295  }
296 
302  function getTrackingDataOfUser($a_user_id = 0)
303  {
304  global $ilDB, $ilUser;
305 
306  if ($a_user_id == 0)
307  {
308  $a_user_id = $ilUser->getId();
309  }
310 
311  $track_set = $ilDB->queryF('
312  SELECT lvalue, rvalue FROM scorm_tracking
313  WHERE sco_id = %s
314  AND user_id = %s
315  AND obj_id = %s',
316  array('integer', 'integer', 'integer'),
317  array($this->getId(), $a_user_id, $this->getALMId())
318  );
319  $trdata = array();
320  while ($track_rec = $ilDB->fetchAssoc($track_set))
321  {
322  $trdata[$track_rec["lvalue"]] = $track_rec["rvalue"];
323  }
324 
325  return $trdata;
326  }
327 
328  function insertTrackData($a_lval, $a_rval, $a_obj_id)
329  {
330  require_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
331  ilObjSCORMTracking::_insertTrackData($this->getId(), $a_lval, $a_rval, $a_obj_id);
332  }
333 
334 }
335 ?>