ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAICCUnit.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 
26 class ilAICCUnit extends ilAICCObject
27 {
28 
36  var $au_type;
47 
54  function ilAICCUnit($a_id = 0)
55  {
56  parent::ilAICCObject($a_id);
57  $this->setType("sau");
58  }
59 
60  function getAUType()
61  {
62  return $this->au_type;
63  }
64 
65  function setAUType($a_au_type)
66  {
67  $this->au_type = $a_au_type;
68  }
69 
70  function getCommand_line()
71  {
72  return $this->command_line;
73  }
74 
75  function setCommand_line($a_command_line)
76  {
77  $this->command_line = $a_command_line;
78  }
79 
80  function getMaxTimeAllowed()
81  {
83  }
84 
85  function setMaxTimeAllowed($a_max_time_allowed)
86  {
87  $this->max_time_allowed = $a_max_time_allowed;
88  }
89 
90  function getTimeLimitAction()
91  {
93  }
94 
95  function setTimeLimitAction($a_time_limit_action)
96  {
97  $this->time_limit_action = $a_time_limit_action;
98  }
99 
100  function getMaxScore()
101  {
102  return $this->max_score;
103  }
104 
105  function setMaxScore($a_max_score)
106  {
107  $this->max_score = $a_max_score;
108  }
109 
110  function getCoreVendor()
111  {
112  return $this->core_vendor;
113  }
114 
115  function setCoreVendor($a_core_vendor)
116  {
117  $this->core_vendor = $a_core_vendor;
118  }
119 
120  function getSystemVendor()
121  {
122  return $this->system_vendor;
123  }
124 
125  function setSystemVendor($a_system_vendor)
126  {
127  $this->system_vendor = $a_system_vendor;
128  }
129 
130  function getFilename()
131  {
132  return $this->file_name;
133  }
134 
135  function setFilename($a_file_name)
136  {
137  $this->file_name = $a_file_name;
138  }
139 
140  function getMasteryScore()
141  {
142  return $this->mastery_score;
143  }
144 
145  function setMasteryScore($a_mastery_score)
146  {
147  $this->mastery_score = $a_mastery_score;
148  }
149 
150  function getWebLaunch()
151  {
152  return $this->web_launch;
153  }
154 
155  function setWebLaunch($a_web_launch)
156  {
157  $this->web_launch = $a_web_launch;
158  }
159 
160  function getAUPassword()
161  {
162  return $this->au_password;
163  }
164 
165  function setAUPassword($a_au_password)
166  {
167  $this->au_password = $a_au_password;
168  }
169 
170  function read()
171  {
172  global $ilDB;
173 
174  parent::read();
175 
176  $obj_set = $ilDB->queryF(
177  'SELECT * FROM aicc_units WHERE obj_id = %s',
178  array('integer'),
179  array($this->getId())
180  );
181  while($obj_rec = $ilDB->fetchAssoc($obj_set))
182  {
183  $this->setAUType($obj_rec["c_type"]);
184  $this->setCommand_line($obj_rec["command_line"]);
185  $this->setMaxTimeAllowed($obj_rec["max_time_allowed"]);
186  $this->setTimeLimitAction($obj_rec["time_limit_action"]);
187  $this->setMaxScore($obj_rec["max_score"]);
188  $this->setCoreVendor($obj_rec["core_vendor"]);
189  $this->setSystemVendor($obj_rec["system_vendor"]);
190  $this->setFilename($obj_rec["file_name"]);
191  $this->setMasteryScore($obj_rec["mastery_score"]);
192  $this->setWebLaunch($obj_rec["web_launch"]);
193  $this->setAUPassword($obj_rec["au_password"]);
194  }
195  }
196 
197  function create()
198  {
199  global $ilDB;
200 
201  parent::create();
202 
203  if($this->getMasteryScore() == NULL) $this->setMasteryScore(0);
204 
205  $ilDB->manipulateF('
206  INSERT INTO aicc_units
207  ( obj_id,
208  c_type,
209  command_line,
210  max_time_allowed,
211  time_limit_action,
212  max_score,
213  core_vendor,
214  system_vendor,
215  file_name,
216  mastery_score,
217  web_launch,
218  au_password
219  )
220  VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',
221  array('integer','text','text','time','text','float','text','text','text','integer','text','text'),
222  array( $this->getId(),
223  $this->getAUType(),
224  $this->getCommand_line(),
225  $this->getMaxTimeAllowed(),
226  $this->getTimeLimitAction(),
227  $this->getMaxScore(),
228  $this->getCoreVendor(),
229  $this->getSystemVendor(),
230  $this->getFilename(),
231  $this->getMasteryScore(),
232  $this->getWebLaunch(),
233  $this->getAUPassword())
234  );
235  }
236 
237  function update()
238  {
239  global $ilDB;
240 
241  parent::update();
242 
243  if($this->getMasteryScore() == NULL) $this->setMasteryScore(0);
244 
245  $ilDB->manipulateF('
246  UPDATE aicc_units
247  SET c_type = %s,
248  command_line = %s,
249  max_time_allowed = %s,
250  time_limit_action = %s,
251  max_score = %s,
252  core_vendor = %s,
253  system_vendor = %s,
254  file_name = %s,
255  mastery_score = %s,
256  web_launch = %s,
257  au_password = %s
258  WHERE obj_id = %s',
259  array('text','text','time','text','float','text','text','text','integer','text','text','integer'),
260  array( $this->getAUType(),
261  $this->getCommand_line(),
262  $this->getMaxTimeAllowed(),
263  $this->getTimeLimitAction(),
264  $this->getMaxScore(),
265  $this->getCoreVendor(),
266  $this->getSystemVendor(),
267  $this->getFilename(),
268  $this->getMasteryScore(),
269  $this->getWebLaunch(),
270  $this->getAUPassword(),
271  $this->getId())
272  );
273  }
274 
275  function delete()
276  {
277  global $ilDB, $ilLog;
278 
279  parent::delete();
280 
281  $q_log = "DELETE FROM aicc_units WHERE obj_id =".$ilDB->quote($this->getId());
282  $ilLog->write("SAHS Delete(Unit): ".$q_log);
283  $ilDB->manipulateF(
284  'DELETE FROM aicc_units WHERE obj_id = %s',
285  array('integer'),
286  array($this->getId()));
287 
288  $ilDB->manipulateF('
289  DELETE FROM scorm_tracking
290  WHERE sco_id = %s
291  AND obj_id =%s',
292  array('integer','integer'),
293  array($this->getId(),$this->getALMId())
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 
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 ?>