ILIAS  release_4-4 Revision
class.ilAICCUnit.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 
7 class ilAICCUnit extends ilAICCObject
8 {
9 
17  var $au_type;
28 
35  function ilAICCUnit($a_id = 0)
36  {
37  parent::ilAICCObject($a_id);
38  $this->setType("sau");
39  }
40 
41  function getAUType()
42  {
43  return $this->au_type;
44  }
45 
46  function setAUType($a_au_type)
47  {
48  $this->au_type = $a_au_type;
49  }
50 
51  function getCommand_line()
52  {
53  return $this->command_line;
54  }
55 
56  function setCommand_line($a_command_line)
57  {
58  $this->command_line = $a_command_line;
59  }
60 
61  function getMaxTimeAllowed()
62  {
64  }
65 
66  function setMaxTimeAllowed($a_max_time_allowed)
67  {
68  $this->max_time_allowed = $a_max_time_allowed;
69  }
70 
71  function getTimeLimitAction()
72  {
74  }
75 
76  function setTimeLimitAction($a_time_limit_action)
77  {
78  $this->time_limit_action = $a_time_limit_action;
79  }
80 
81  function getMaxScore()
82  {
83  return $this->max_score;
84  }
85 
86  function setMaxScore($a_max_score)
87  {
88  $this->max_score = $a_max_score;
89  }
90 
91  function getCoreVendor()
92  {
93  return $this->core_vendor;
94  }
95 
96  function setCoreVendor($a_core_vendor)
97  {
98  $this->core_vendor = $a_core_vendor;
99  }
100 
101  function getSystemVendor()
102  {
103  return $this->system_vendor;
104  }
105 
106  function setSystemVendor($a_system_vendor)
107  {
108  $this->system_vendor = $a_system_vendor;
109  }
110 
111  function getFilename()
112  {
113  return $this->file_name;
114  }
115 
116  function setFilename($a_file_name)
117  {
118  $this->file_name = $a_file_name;
119  }
120 
121  function getMasteryScore()
122  {
123  return $this->mastery_score;
124  }
125 
126  function setMasteryScore($a_mastery_score)
127  {
128  $this->mastery_score = $a_mastery_score;
129  }
130 
131  function getWebLaunch()
132  {
133  return $this->web_launch;
134  }
135 
136  function setWebLaunch($a_web_launch)
137  {
138  $this->web_launch = $a_web_launch;
139  }
140 
141  function getAUPassword()
142  {
143  return $this->au_password;
144  }
145 
146  function setAUPassword($a_au_password)
147  {
148  $this->au_password = $a_au_password;
149  }
150 
151  function read()
152  {
153  global $ilDB;
154 
155  parent::read();
156 
157  $obj_set = $ilDB->queryF(
158  'SELECT * FROM aicc_units WHERE obj_id = %s',
159  array('integer'),
160  array($this->getId())
161  );
162  while($obj_rec = $ilDB->fetchAssoc($obj_set))
163  {
164  $this->setAUType($obj_rec["c_type"]);
165  $this->setCommand_line($obj_rec["command_line"]);
166  $this->setMaxTimeAllowed($obj_rec["max_time_allowed"]);
167  $this->setTimeLimitAction($obj_rec["time_limit_action"]);
168  $this->setMaxScore($obj_rec["max_score"]);
169  $this->setCoreVendor($obj_rec["core_vendor"]);
170  $this->setSystemVendor($obj_rec["system_vendor"]);
171  $this->setFilename($obj_rec["file_name"]);
172  $this->setMasteryScore($obj_rec["mastery_score"]);
173  $this->setWebLaunch($obj_rec["web_launch"]);
174  $this->setAUPassword($obj_rec["au_password"]);
175  }
176  }
177 
178  function create()
179  {
180  global $ilDB;
181 
182  parent::create();
183 
184  if($this->getMasteryScore() == NULL) $this->setMasteryScore(0);
185 
186  $ilDB->manipulateF('
187  INSERT INTO aicc_units
188  ( obj_id,
189  c_type,
190  command_line,
191  max_time_allowed,
192  time_limit_action,
193  max_score,
194  core_vendor,
195  system_vendor,
196  file_name,
197  mastery_score,
198  web_launch,
199  au_password
200  )
201  VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',
202  array('integer','text','text','time','text','float','text','text','text','integer','text','text'),
203  array( $this->getId(),
204  $this->getAUType(),
205  $this->getCommand_line(),
206  $this->getMaxTimeAllowed(),
207  $this->getTimeLimitAction(),
208  $this->getMaxScore(),
209  $this->getCoreVendor(),
210  $this->getSystemVendor(),
211  $this->getFilename(),
212  $this->getMasteryScore(),
213  $this->getWebLaunch(),
214  $this->getAUPassword())
215  );
216  }
217 
218  function update()
219  {
220  global $ilDB;
221 
222  parent::update();
223 
224  if($this->getMasteryScore() == NULL) $this->setMasteryScore(0);
225 
226  $ilDB->manipulateF('
227  UPDATE aicc_units
228  SET c_type = %s,
229  command_line = %s,
230  max_time_allowed = %s,
231  time_limit_action = %s,
232  max_score = %s,
233  core_vendor = %s,
234  system_vendor = %s,
235  file_name = %s,
236  mastery_score = %s,
237  web_launch = %s,
238  au_password = %s
239  WHERE obj_id = %s',
240  array('text','text','time','text','float','text','text','text','integer','text','text','integer'),
241  array( $this->getAUType(),
242  $this->getCommand_line(),
243  $this->getMaxTimeAllowed(),
244  $this->getTimeLimitAction(),
245  $this->getMaxScore(),
246  $this->getCoreVendor(),
247  $this->getSystemVendor(),
248  $this->getFilename(),
249  $this->getMasteryScore(),
250  $this->getWebLaunch(),
251  $this->getAUPassword(),
252  $this->getId())
253  );
254  }
255 
256  function delete()
257  {
258  global $ilDB, $ilLog;
259 
260  parent::delete();
261 
262  $q_log = "DELETE FROM aicc_units WHERE obj_id =".$ilDB->quote($this->getId());
263  $ilLog->write("SAHS Delete(Unit): ".$q_log);
264  $ilDB->manipulateF(
265  'DELETE FROM aicc_units WHERE obj_id = %s',
266  array('integer'),
267  array($this->getId()));
268 
269  $ilDB->manipulateF('
270  DELETE FROM scorm_tracking
271  WHERE sco_id = %s
272  AND obj_id =%s',
273  array('integer','integer'),
274  array($this->getId(),$this->getALMId())
275  );
276 
277  // update learning progress status
278  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
280 
281  }
282 
288  function getTrackingDataOfUser($a_user_id = 0)
289  {
290  global $ilDB, $ilUser;
291 
292  if ($a_user_id == 0)
293  {
294  $a_user_id = $ilUser->getId();
295  }
296 
297  $track_set = $ilDB->queryF('
298  SELECT lvalue, rvalue FROM scorm_tracking
299  WHERE sco_id = %s
300  AND user_id = %s
301  AND obj_id = %s',
302  array('integer','integer','integer'),
303  array($this->getId(), $a_user_id, $this->getALMId()));
304 
305  $trdata = array();
306  while ($track_rec = $ilDB->fetchAssoc($track_set))
307  {
308  $trdata[$track_rec["lvalue"]] = $track_rec["rvalue"];
309  }
310 
311 
312  return $trdata;
313  }
314 
315  function insertTrackData($a_lval, $a_rval, $a_obj_id)
316  {
317  require_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
318  ilObjSCORMTracking::_insertTrackData($this->getId(), $a_lval, $a_rval, $a_obj_id);
319  }
320 
321 }
322 ?>
Parent object for all AICC objects, that are stored in table aicc_object.
setCommand_line($a_command_line)
setMaxTimeAllowed($a_max_time_allowed)
setSystemVendor($a_system_vendor)
setAUType($a_au_type)
setAUPassword($a_au_password)
setFilename($a_file_name)
setMaxScore($a_max_score)
_insertTrackData($a_sahs_id, $a_lval, $a_rval, $a_obj_id)
setTimeLimitAction($a_time_limit_action)
setType($a_objType)
setWebLaunch($a_web_launch)
ilAICCUnit($a_id=0)
Constructor.
getTrackingDataOfUser($a_user_id=0)
get tracking data of specified or current user
$au_type
AICC Item.
setCoreVendor($a_core_vendor)
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
global $ilUser
Definition: imgupload.php:15
insertTrackData($a_lval, $a_rval, $a_obj_id)
setMasteryScore($a_mastery_score)