Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once "classes/class.ilObject.php";
00025
00026 require_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
00027
00036 class ilObjAICCLearningModule extends ilObjSCORMLearningModule
00037 {
00038
00039
00046 function ilObjAICCLearningModule($a_id = 0, $a_call_by_reference = true)
00047 {
00048 $this->type = "sahs";
00049 parent::ilObject($a_id,$a_call_by_reference);
00050 }
00051
00055 function readObject()
00056 {
00057 require_once("./Modules/ScormAicc/classes/class.ilObjAICCCourseInterchangeFiles.php");
00058 $cifModule = new ilObjAICCCourseInterchangeFiles();
00059 $cifModule->findFiles($this->getDataDirectory());
00060
00061 $cifModule->readFiles();
00062 if (!empty($cifModule->errorText))
00063 {
00064 $this->ilias->raiseError("<b>Error reading LM-File(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00065 }
00066
00067 if ($_POST["validate"] == "y")
00068 {
00069
00070 $cifModule->validate();
00071 if (!empty($cifModule->errorText))
00072 {
00073 $this->ilias->raiseError("<b>Validation Error(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00074 }
00075 }
00076
00077 $cifModule->writeToDatabase($this->getId());
00078 }
00079
00080
00092 function delete()
00093 {
00094 global $ilDB, $ilLog;
00095
00096
00097 if (!parent::delete())
00098 {
00099 return false;
00100 }
00101
00102
00103
00104
00105
00106
00107
00108 $this->deleteMetaData();
00109
00110
00111 ilUtil::delDir($this->getDataDirectory());
00112
00113
00114 $q = "DELETE FROM sahs_lm WHERE id = ".$ilDB->quote($this->getId());
00115 $this->ilias->db->query($q);
00116
00117
00118
00119 $q = "DELETE FROM aicc_units USING aicc_object, aicc_units WHERE aicc_object.obj_id=aicc_units.obj_id and aicc_object.slm_id=".$ilDB->quote($this->getId());
00120 $this->ilias->db->query($q);
00121
00122 $q = "DELETE FROM aicc_course USING aicc_object, aicc_course WHERE aicc_object.obj_id=aicc_course.obj_id and aicc_object.slm_id=".$ilDB->quote($this->getId());
00123 $this->ilias->db->query($q);
00124
00125 $q = "DELETE FROM scorm_tree WHERE slm_id = ".$ilDB->quote($this->getId());
00126 $this->ilias->db->query($q);
00127
00128 $q = "DELETE FROM aicc_object WHERE slm_id = ".$ilDB->quote($this->getId());
00129 $this->ilias->db->query($q);
00130
00131 $q = "DELETE FROM scorm_tracking WHERE obj_id = ".$ilDB->quote($this->getId());
00132 $ilLog->write("SAHS Delete (AICC LM): ".$q);
00133 $this->ilias->db->query($q);
00134
00135
00136 return true;
00137 }
00138
00139
00143 function getTrackingItems()
00144 {
00145 return ilObjAICCLearningModule::_getTrackingItems($this->getId());
00146 }
00147
00148
00152 function _getTrackingItems($a_obj_id)
00153 {
00154 global $ilDB;
00155
00156 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
00157
00158 $query = "SELECT obj_id,title FROM aicc_object ".
00159 "WHERE slm_id = ".$ilDB->quote($a_obj_id)." ".
00160 "AND type = 'sau'";
00161
00162 $res = $ilDB->query($query);
00163 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00164 {
00165 $items[$row->obj_id]['obj_id'] = $row->obj_id;
00166 $items[$row->obj_id]['title'] = $row->title;
00167
00168 }
00169 return $items ? $items : array();
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 }
00191
00195 function getTrackedItems()
00196 {
00197 global $ilUser, $ilDB, $ilUser;
00198
00199 $query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
00200 " obj_id = ".$ilDB->quote($this->getId());
00201
00202 $sco_set = $ilDB->query($query);
00203
00204 $items = array();
00205 while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
00206 {
00207 include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
00208 $ac_item =& new ilAICCUnit($sco_rec["sco_id"]);
00209 $items[count($items)] =& $ac_item;
00210
00211 }
00212
00213 return $items;
00214 }
00215
00216 function getTrackingData($a_sco_id)
00217 {
00218 global $ilDB;
00219
00220 $query = "SELECT * FROM scorm_tracking WHERE".
00221 " obj_id = ".$ilDB->quote($this->getId()).
00222 " AND sco_id = ".$ilDB->quote($a_sco_id).
00223 " ORDER BY user_id, lvalue";
00224 $data_set = $ilDB->query($query);
00225
00226 $data = array();
00227 while($data_rec = $data_set->fetchRow(DB_FETCHMODE_ASSOC))
00228 {
00229 $data[] = $data_rec;
00230 }
00231
00232 return $data;
00233 }
00234
00235 }
00236
00237 ?>