ILIAS  Release_3_10_x_branch Revision 61812
 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  $q = "SELECT * FROM aicc_units WHERE obj_id = ".$ilDB->quote($this->getId());
177 
178  $obj_set = $this->ilias->db->query($q);
179  $obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC);
180  $this->setAUType($obj_rec["type"]);
181  $this->setCommand_line($obj_rec["command_line"]);
182  $this->setMaxTimeAllowed($obj_rec["max_time_allowed"]);
183  $this->setTimeLimitAction($obj_rec["time_limit_action"]);
184  $this->setMaxScore($obj_rec["max_score"]);
185  $this->setCoreVendor($obj_rec["core_vendor"]);
186  $this->setSystemVendor($obj_rec["system_vendor"]);
187  $this->setFilename($obj_rec["file_name"]);
188  $this->setMasteryScore($obj_rec["mastery_score"]);
189  $this->setWebLaunch($obj_rec["web_launch"]);
190  $this->setAUPassword($obj_rec["au_password"]);
191  }
192 
193  function create()
194  {
195  global $ilDB;
196 
197  parent::create();
198 
199  $q = "INSERT INTO aicc_units (obj_id, type, command_line, max_time_allowed, time_limit_action,
200  max_score, core_vendor, system_vendor, file_name, mastery_score,
201  web_launch, au_password) VALUES (";
202  $q.=$ilDB->quote($this->getId()).", ";
203  $q.=$ilDB->quote($this->getAUType()).", ";
204  $q.=$ilDB->quote($this->getCommand_line()).", ";
205  $q.=$ilDB->quote($this->getMaxTimeAllowed()).", ";
206  $q.=$ilDB->quote($this->getTimeLimitAction()).", ";
207  $q.=$ilDB->quote($this->getMaxScore()).", ";
208  $q.=$ilDB->quote($this->getCoreVendor()).", ";
209  $q.=$ilDB->quote($this->getSystemVendor()).", ";
210  $q.=$ilDB->quote($this->getFilename()).", ";
211  $q.=$ilDB->quote($this->getMasteryScore()).", ";
212  $q.=$ilDB->quote($this->getWebLaunch()).", ";
213  $q.=$ilDB->quote($this->getAUPassword()).")";
214 
215  $this->ilias->db->query($q);
216  }
217 
218  function update()
219  {
220  global $ilDB;
221 
222  parent::update();
223 
224  $q = "UPDATE aicc_units SET ";
225  $q.="type=".$ilDB->quote($this->getAUType()).", ";
226  $q.="command_line=".$ilDB->quote($this->getCommand_line()).", ";
227  $q.="max_time_allowed=".$ilDB->quote($this->getMaxTimeAllowed()).", ";
228  $q.="time_limit_action=".$ilDB->quote($this->getTimeLimitAction()).", ";
229  $q.="max_score=".$ilDB->quote($this->getMaxScore()).", ";
230  $q.="core_vendor=".$ilDB->quote($this->getCoreVendor()).", ";
231  $q.="system_vendor=".$ilDB->quote($this->getSystemVendor()).", ";
232  $q.="file_name=".$ilDB->quote($this->getFilename()).", ";
233  $q.="mastery_score=".$ilDB->quote($this->getMasteryScore()).", ";
234  $q.="web_launch=".$ilDB->quote($this->getWebLaunch()).", ";
235  $q.="au_password=".$ilDB->quote($this->getAUPassword())." ";
236  $q.="WHERE obj_id = ".$ilDB->quote($this->getId());
237  $this->ilias->db->query($q);
238  }
239 
240  function delete()
241  {
242  global $ilDB, $ilLog;
243 
244  parent::delete();
245 
246  $q = "DELETE FROM aicc_units WHERE obj_id =".$ilDB->quote($this->getId());
247  $ilLog->write("SAHS Delete(Unit): ".$q);
248  $ilDB->query($q);
249 
250  $q = "DELETE FROM scorm_tracking WHERE ".
251  "sco_id = ".$ilDB->quote($this->getId()).
252  " AND obj_id = ".$ilDB->quote($this->getALMId());
253  $ilDB->query($q);
254 
255  }
256 
262  function getTrackingDataOfUser($a_user_id = 0)
263  {
264  global $ilDB, $ilUser;
265 
266  if ($a_user_id == 0)
267  {
268  $a_user_id = $ilUser->getId();
269  }
270 
271  $q = "SELECT * FROM scorm_tracking WHERE ".
272  "sco_id = ".$ilDB->quote($this->getId())." AND ".
273  "user_id = ".$ilDB->quote($a_user_id).
274  " AND obj_id = ".$ilDB->quote($this->getALMId());;
275 
276  $track_set = $ilDB->query($q);
277  $trdata = array();
278  while ($track_rec = $track_set->fetchRow(DB_FETCHMODE_ASSOC))
279  {
280  $trdata[$track_rec["lvalue"]] = $track_rec["rvalue"];
281  }
282 
283  return $trdata;
284  }
285 
286  function insertTrackData($a_lval, $a_rval, $a_obj_id)
287  {
288  require_once("./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php");
289  ilObjSCORMTracking::_insertTrackData($this->getId(), $a_lval, $a_rval, $a_obj_id);
290  }
291 
292 }
293 ?>