ILIAS  Release_3_10_x_branch Revision 61812
 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  $this->max_fields_cst = $a_max_fields_cst;
122  }
123 
124  function getMaxFieldsOrt()
125  {
126  return $this->max_fields_ort;
127  }
128 
129  function setMaxFieldsOrt($a_max_fields_ort)
130  {
131  $this->max_fields_ort = $a_max_fields_ort;
132  }
133 
134  function getTotalAUs()
135  {
136  return $this->total_aus;
137  }
138 
139  function setTotalAUs($a_total_aus)
140  {
141  $this->total_aus = $a_total_aus;
142  }
143 
144  function getTotalBlocks()
145  {
146  return $this->total_blocks;
147  }
148 
149  function setTotalBlocks($a_total_blocks)
150  {
151  $this->total_blocks = $a_total_blocks;
152  }
153 
155  {
157  }
158 
159  function setTotalComplexObj($a_total_complex_obj)
160  {
161  $this->total_complex_obj = $a_total_complex_obj;
162  }
163 
165  {
167  }
168 
169  function setTotalObjectives($a_total_objectives)
170  {
171  $this->total_objectives = $a_total_objectives;
172  }
173 
174  function getVersion()
175  {
176  return $this->version;
177  }
178 
179  function setVersion($a_version)
180  {
181  $this->version = $a_version;
182  }
183 
184  function getMaxNormal()
185  {
186  return $this->max_normal;
187  }
188 
189  function setMaxNormal($a_max_normal)
190  {
191  $this->max_normal = $a_max_normal;
192  }
193 
194  function getDescription()
195  {
196  return $this->description;
197  }
198 
199  function setDescription($a_description)
200  {
201  $this->description = $a_description;
202  }
203 
204  function read()
205  {
206  global $ilDB;
207 
208  parent::read();
209 
210  $q = "SELECT * FROM aicc_course WHERE obj_id = ".$ilDB->quote($this->getId());
211 
212  $obj_set = $this->ilias->db->query($q);
213  $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
214  $this->setCourseCreator($obj_rec["course_creator"]);
215  $this->setCourseId($obj_rec["course_id"]);
216  $this->setCourseSystem($obj_rec["course_system"]);
217  $this->setCourseTitle($obj_rec["course_title"]);
218  $this->setLevel($obj_rec["level"]);
219  $this->setMaxFieldsCst($obj_rec["max_fields_cst"]);
220  $this->setMaxFieldsOrt($obj_rec["max_fields_ort"]);
221  $this->setTotalAUs($obj_rec["total_aus"]);
222  $this->setTotalBlocks($obj_rec["total_blocks"]);
223  $this->setTotalComplexObj($obj_rec["total_complex_obj"]);
224  $this->setTotalObjectives($obj_rec["total_objectives"]);
225  $this->setVersion($obj_rec["_version"]);
226  $this->setMaxNormal($obj_rec["max_normal"]);
227  $this->setDescription($obj_rec["description"]);
228  }
229 
230  function create()
231  {
232  global $ilDB;
233 
234  parent::create();
235 
236  $q = "INSERT INTO aicc_course (obj_id, course_creator, course_id, course_system, course_title,
237  level, max_fields_cst, max_fields_ort, total_aus, total_blocks,
238  total_complex_obj, total_objectives, version, max_normal,
239  description) VALUES (";
240  $q.= $ilDB->quote($this->getId()).", ";
241  $q.= $ilDB->quote($this->getCourseCreator()).", ";
242  $q.= $ilDB->quote($this->getCourseId()).", ";
243  $q.= $ilDB->quote($this->getCourseSystem()).", ";
244  $q.= $ilDB->quote($this->getCourseTitle()).", ";
245  $q.= $ilDB->quote($this->getLevel()).", ";
246  $q.= $ilDB->quote($this->getMaxFieldsCst()).", ";
247  $q.= $ilDB->quote($this->getMaxFieldsOrt()).", ";
248  $q.= $ilDB->quote($this->getTotalAUs()).", ";
249  $q.= $ilDB->quote($this->getTotalBlocks()).", ";
250  $q.= $ilDB->quote($this->getTotalComplexObj()).", ";
251  $q.= $ilDB->quote($this->getTotalObjectives()).", ";
252  $q.= $ilDB->quote($this->getVersion()).", ";
253  $q.= $ilDB->quote($this->getMaxNormal()).", ";
254  $q.= $ilDB->quote($this->getDescription()).")";
255  $this->ilias->db->query($q);
256  }
257 
258  function update()
259  {
260  global $ilDB;
261 
262  parent::update();
263 
264  $q = "UPDATE aicc_course SET ";
265  $q.="course_creator=".$ilDB->quote($this->getCourseCreator()).", ";
266  $q.="course_id=".$ilDB->quote($this->getCourseId()).", ";
267  $q.="course_system=".$ilDB->quote($this->getCourseSystem()).", ";
268  $q.="course_title=".$ilDB->quote($this->getCourseTitle()).", ";
269  $q.="level=".$ilDB->quote($this->getLevel()).", ";
270  $q.="max_fields_cst=".$ilDB->quote($this->getMaxFieldsCst()).", ";
271  $q.="max_fields_ort=".$ilDB->quote($this->getMaxFieldsOrt()).", ";
272  $q.="total_aus=".$ilDB->quote($this->getTotalAUs()).", ";
273  $q.="total_blocks=".$ilDB->quote($this->getTotalBlocks()).", ";
274  $q.="total_complex_obj=".$ilDB->quote($this->getTotalComplexObj()).", ";
275  $q.="total_objectives=".$ilDB->quote($this->getTotalObjectives()).", ";
276  $q.="version=".$ilDB->quote($this->getVersion()).", ";
277  $q.="max_normal=".$ilDB->quote($this->getMaxNormal()).", ";
278  $q.="description=".$ilDB->quote($this->getDescription())." ";
279  $q.="WHERE obj_id = ".$ilDB->quote($this->getId());
280  $this->ilias->db->query($q);
281  }
282 
283  function delete()
284  {
285  global $ilDB, $ilLog;
286 
287  parent::delete();
288 
289  $q = "DELETE FROM aicc_course WHERE obj_id =".$ilDB->quote($this->getId());
290  $ilDB->query($q);
291 
292  $q = "DELETE FROM scorm_tracking WHERE ".
293  "sco_id = ".$ilDB->quote($this->getId()).
294  " AND obj_id = ".$ilDB->quote($this->getALMId());
295  $ilLog->write("SAHS Delete: ".$q);
296  $ilDB->query($q);
297 
298  }
299 
305  function getTrackingDataOfUser($a_user_id = 0)
306  {
307  global $ilDB, $ilUser;
308 
309  if ($a_user_id == 0)
310  {
311  $a_user_id = $ilUser->getId();
312  }
313 
314  $q = "SELECT * FROM scorm_tracking WHERE ".
315  "sco_id = ".$ilDB->quote($this->getId())." AND ".
316  "user_id = ".$ilDB->quote($a_user_id).
317  " AND obj_id = ".$ilDB->quote($this->getALMId());
318 
319  $track_set = $ilDB->query($q);
320  $trdata = array();
321  while ($track_rec = $track_set->fetchRow(DB_FETCHMODE_ASSOC))
322  {
323  $trdata[$track_rec["lvalue"]] = $track_rec["rvalue"];
324  }
325 
326  return $trdata;
327  }
328 
329  function insertTrackData($a_lval, $a_rval, $a_obj_id)
330  {
331  require_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
332  ilObjSCORMTracking::_insertTrackData($this->getId(), $a_lval, $a_rval, $a_obj_id);
333  }
334 
335 }
336 ?>