ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilAICCObject.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
33 {
34  var $id;
35  var $title;
36  var $objType;
37  var $alm_id;
41 
42 
49  function __construct($a_id = 0)
50  {
51  global $ilias;
52 
53  $this->ilias = $ilias;
54  $this->id = $a_id;
55  if ($a_id > 0)
56  {
57  $this->read();
58  }
59  }
60 
61  function getId()
62  {
63  return $this->id;
64  }
65 
66  function setId($a_id)
67  {
68  $this->id = $a_id;
69  }
70 
71  function getType()
72  {
73  return $this->objType;
74  }
75 
76  function setType($a_objType)
77  {
78  $this->objType = $a_objType;
79  }
80 
81  function getTitle()
82  {
83  return $this->title;
84  }
85 
86  function setTitle($a_title)
87  {
88  $this->title = $a_title;
89  }
90 
91  function getDescription()
92  {
93  return $this->description;
94  }
95 
96  function setDescription($a_description)
97  {
98  $this->description = $a_description;
99  }
100 
101  function getDeveloperId()
102  {
103  return $this->developer_id;
104  }
105 
106  function setDeveloperId($a_developer_id)
107  {
108  $this->developer_id = $a_developer_id;
109  }
110 
111  function getSystemId()
112  {
113  return $this->system_id;
114  }
115 
116  function setSystemId($a_system_id)
117  {
118  $this->system_id = $a_system_id;
119  }
120 
121  function getALMId()
122  {
123  return $this->alm_id;
124  }
125 
126  function setALMId($a_alm_id)
127  {
128  $this->alm_id = $a_alm_id;
129  }
130 
131  function prepForStore($string) {
132  $string = addslashes($string);
133  return $string;
134  }
135 
136  function read()
137  {
138  global $ilDB;
139 
140  $obj_set = $ilDB->queryF('SELECT * FROM aicc_object WHERE obj_id = %s',
141  array('integer'),array($this->getId()));
142  while($obj_rec = $ilDB->fetchAssoc($obj_set))
143  {
144  $this->setTitle($obj_rec["title"]);
145  $this->setType($obj_rec["c_type"]);
146  $this->setALMId($obj_rec["alm_id"]);
147  $this->setDescription($obj_rec["description"]);
148  $this->setDeveloperId($obj_rec["developer_id"]);
149  $this->setSystemId($obj_rec["system_id"]);
150  }
151  }
152 
153  function create()
154  {
155  global $ilDB;
156 
157  $nextId = $ilDB->nextId('aicc_object');
158 
159  $ilDB->insert('aicc_object', array(
160  'obj_id' => array('integer', $nextId),
161  'title' => array('text', $this->getTitle()),
162  'c_type' => array('text', $this->getType()),
163  'slm_id' => array('integer', $this->getALMId()),
164  'description' => array('clob', $this->getDescription()),
165  'developer_id' => array('text',$this->getDeveloperId()),
166  'system_id' => array('integer', $this->getSystemId())
167  ));
168 
169  $this->setId($nextId);
170  }
171 
172  function update()
173  {
174  global $ilDB;
175 
176  $ilDB->update('aicc_object',
177  array(
178  'title' => array('text', $this->getTitle()),
179  'c_type' => array('text', $this->getType()),
180  'slm_id' => array('integer', $this->getALMId()),
181  'description' => array('clob', $this->getDescription()),
182  'developer_id' => array('text',$this->getDeveloperId()),
183  'system_id' => array('integer', $this->getSystemId())
184  ),
185  array(
186  'obj_id' => array('integer', $this->getId())
187  )
188  );
189  }
190 
191  function delete()
192  {
193  global $ilDB;
194 
195  $statement = $ilDB->manipulateF('DELETE FROM aicc_object WHERE obj_id = %s',
196  array('integer'),array($this->getId()));
197  }
198 
204  function &_getInstance($a_id, $a_slm_id)
205  {
206  global $ilDB;
207 
208  $sc_set = $ilDB->queryF('
209  SELECT c_type FROM aicc_object
210  WHERE obj_id = %s
211  AND slm_id = %s',
212  array('integer', 'integer'),
213  array($a_id,$a_slm_id)
214  );
215 
216  while($sc_rec = $ilDB->fetchAssoc($sc_set))
217  {
218  break;
219  }
220 
221  switch($sc_rec["c_type"])
222  {
223  case "sbl": // Block
224  include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCBlock.php");
225  $block = new ilAICCBlock($a_id);
226  return $block;
227  break;
228 
229  case "sau": // assignable unit
230  include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
231  $sau = new ilAICCUnit($a_id);
232  return $sau;
233  break;
234 
235  case "shd": // course
236  include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCCourse.php");
237  $shd = new ilAICCCourse($a_id);
238  return $shd;
239  break;
240  }
241 
242  }
243 
244 }
245 ?>
Parent object for all AICC objects, that are stored in table aicc_object.
setDeveloperId($a_developer_id)
& _getInstance($a_id, $a_slm_id)
get instance of specialized GUI class
AICC Block.
setType($a_objType)
__construct($a_id=0)
Constructor.
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
global $ilDB
setSystemId($a_system_id)
setDescription($a_description)