ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjAICCLearningModule.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
5require_once "./Services/Object/classes/class.ilObject.php";
6//require_once "Services/MetaData/classes/class.ilMDLanguageItem.php";
7require_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
8
18{
19 //var $meta_data;
20
27 function __construct($a_id = 0, $a_call_by_reference = true)
28 {
29 $this->type = "sahs";
30 parent::__construct($a_id,$a_call_by_reference);
31 }
32
36 function readObject()
37 {
38 require_once("./Modules/ScormAicc/classes/class.ilObjAICCCourseInterchangeFiles.php");
39 $cifModule = new ilObjAICCCourseInterchangeFiles();
40 $cifModule->findFiles($this->getDataDirectory());
41
42 $cifModule->readFiles();
43 if (!empty($cifModule->errorText))
44 {
45 $this->ilias->raiseError("<b>Error reading LM-File(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
46 }
47
48 if ($_POST["validate"] == "y")
49 {
50
51 $cifModule->validate();
52 if (!empty($cifModule->errorText))
53 {
54 $this->ilias->raiseError("<b>Validation Error(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
55 }
56 }
57
58 $cifModule->writeToDatabase($this->getId());
59 }
60
61
73 function delete()
74 {
75 global $ilDB, $ilLog;
76
77 // always call parent delete function first!!
78 if (!parent::delete())
79 {
80 return false;
81 }
82
83 // delete meta data of scorm content object
84 $this->deleteMetaData();
85
86 // delete data directory
88
89 // delete scorm learning module record
90 $ilDB->manipulateF('DELETE FROM sahs_lm WHERE id = %s',
91 array('integer'), array($this->getId()));
92
93 // delete aicc data
94 $res = $ilDB->queryF('
95 SELECT * FROM aicc_object, aicc_units
96 WHERE aicc_object.obj_id = aicc_units.obj_id
97 AND aicc_object.slm_id = %s',
98 array('integer'), array($this->getId()));
99
100 while($row = $ilDB->fetchAssoc($res))
101 {
102 $obj_id = $row['obj_id'];
103 $ilDB->manipulateF('
104 DELETE FROM aicc_units WHERE obj_id = %s',
105 array('integer'), array($obj_id));
106 }
107
108 $res = $ilDB->queryF('
109 SELECT * FROM aicc_object, aicc_course
110 WHERE aicc_object.obj_id = aicc_course.obj_id
111 AND aicc_object.slm_id = %s',
112 array('integer'), array($this->getId()));
113
114 while($row = $ilDB->fetchAssoc($res))
115 {
116 $obj_id = $row['obj_id'];
117 $ilDB->manipulateF('
118 DELETE FROM aicc_course WHERE obj_id = %s',
119 array('integer'), array($obj_id));
120 }
121
122 $ilDB->manipulateF('DELETE FROM scorm_tree WHERE slm_id = %s',
123 array('integer'), array($this->getId()));
124
125 $ilDB->manipulateF('DELETE FROM aicc_object WHERE slm_id = %s',
126 array('integer'), array($this->getId()));
127
128 $q_log = "DELETE FROM scorm_tracking WHERE obj_id = ".$ilDB->quote($this->getId());
129 $ilLog->write("SAHS Delete (AICC LM): ".$q_log);
130 $ilDB->manipulateF('DELETE FROM scorm_tracking WHERE obj_id = %s',
131 array('integer'), array($this->getId()));
132
133 $q_log = "DELETE FROM sahs_user WHERE obj_id = ".$ilDB->quote($this->getId());
134 $ilLog->write("SAHS Delete (AICC LM): ".$q_log);
135 $ilDB->manipulateF('DELETE FROM sahs_user WHERE obj_id = %s',
136 array('integer'), array($this->getId()));
137
138 // update learning progress status
139 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
141
142 // always call parent delete function at the end!!
143 return true;
144 }
145
146
151 {
153 }
154
155
159 static function _getTrackingItems($a_obj_id)
160 {
161 global $ilDB;
162
163 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
164
165 $statement = $ilDB->queryF('
166 SELECT obj_id,title FROM aicc_object
167 WHERE slm_id = %s
168 AND c_type = %s ',
169 array('integer', 'text'),
170 array($a_obj_id,'sau')
171 );
172
173 while($row = $ilDB->fetchObject($statement))
174 {
175 $items[$row->obj_id]['obj_id'] = $row->obj_id;
176 $items[$row->obj_id]['title'] = $row->title;
177
178 }
179
180 return $items ? $items : array();
181
182 /*
183 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
184 $tree = new ilSCORMTree($a_obj_id);
185 $root_id = $tree->readRootId();
186
187 $items = array();
188 $childs = $tree->getSubTree($tree->getNodeData($root_id));
189 foreach($childs as $child)
190 {
191 if($child["c_type"] == "sau")
192 {
193 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
194 $ac_item = new ilAICCUnit($child["obj_id"]);
195 $items[count($items)] =& $ac_item;
196 }
197 }
198
199 return $items;
200 */
201 }
202
207 {
208 global $ilUser, $ilDB, $ilUser;
209
210 $sco_set = $ilDB->queryF('
211 SELECT DISTINCT sco_id FROM scorm_tracking WHERE obj_id = %s',
212 array('integer'), array($this->getId()));
213
214 $items = array();
215 while($sco_rec = $ilDB->fetchAssoc($sco_set))
216 {
217 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
218 $ac_item = new ilAICCUnit($sco_rec["sco_id"]);
219 $items[count($items)] =& $ac_item;
220
221 }
222
223 return $items;
224 }
225
226 function getTrackingData($a_sco_id)
227 {
228 global $ilDB;
229
230 $data_set = $ilDB->queryF('
231 SELECT * FROM scorm_tracking
232 WHERE obj_id = %s
233 AND sco_id = %s
234 ORDER BY user_id, lvalue',
235 array('integer', 'integer'),
236 array($this->getId(), $a_sco_id));
237
238 $data = array();
239 while($data_rec = $ilDB->fetchAssoc($data_set))
240 {
241 $data[] = $data_rec;
242 }
243 return $data;
244 }
245
246} // END class.ilObjAICCLearningModule
247
248?>
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Class ilObjAICCLearningModule.
static _getTrackingItems($a_obj_id)
get all tracking items of scorm object
getTrackingItems()
get all tracking items of scorm object
getTrackedItems()
get all tracked items of current user
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
getDataDirectory($mode="filesystem")
get data directory of lm
Class ilObjSCORMLearningModule.
deleteMetaData()
delete meta data entry
getId()
get object id @access public
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
redirection script todo: (a better solution should control the processing via a xml file)
global $ilDB
$ilUser
Definition: imgupload.php:18