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