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 require_once "classes/class.ilMetaData.php";
00026 require_once "content/classes/class.ilObjSCORMLearningModule.php";
00027
00037 class ilObjAICCLearningModule extends ilObjSCORMLearningModule
00038 {
00039 var $meta_data;
00040
00047 function ilObjAICCLearningModule($a_id = 0, $a_call_by_reference = true)
00048 {
00049 $this->type = "sahs";
00050 parent::ilObject($a_id,$a_call_by_reference);
00051 if ($a_id == 0)
00052 {
00053 $new_meta =& new ilMetaData();
00054 $this->assignMetaData($new_meta);
00055 }
00056 }
00057
00061 function readObject()
00062 {
00063 require_once("content/classes/class.ilObjAICCCourseInterchangeFiles.php");
00064 $cifModule = new ilObjAICCCourseInterchangeFiles();
00065 $cifModule->findFiles($this->getDataDirectory());
00066
00067 $cifModule->readFiles();
00068 if (!empty($cifModule->errorText))
00069 {
00070 $this->ilias->raiseError("<b>Error reading LM-File(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00071 }
00072
00073 if ($_POST["validate"] == "y")
00074 {
00075
00076 $cifModule->validate();
00077 if (!empty($cifModule->errorText))
00078 {
00079 $this->ilias->raiseError("<b>Validation Error(s):</b><br>".implode("<br>", $cifModule->errorText), $this->ilias->error_obj->WARNING);
00080 }
00081 }
00082
00083 $cifModule->writeToDatabase($this->getId());
00084 }
00085
00086
00098 function delete()
00099 {
00100 global $ilDB;
00101
00102
00103 if (!parent::delete())
00104 {
00105 return false;
00106 }
00107
00108
00109 $nested = new ilNestedSetXML();
00110 $nested->init($this->getId(), $this->getType());
00111 $nested->deleteAllDBData();
00112
00113
00114 ilUtil::delDir($this->getDataDirectory());
00115
00116
00117 $q = "DELETE FROM sahs_lm WHERE id = ".$ilDB->quote($this->getId());
00118 $this->ilias->db->query($q);
00119
00120
00121
00122 $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());
00123 $this->ilias->db->query($q);
00124
00125 $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());
00126 $this->ilias->db->query($q);
00127
00128 $q = "DELETE FROM scorm_tree WHERE slm_id = ".$ilDB->quote($this->getId());
00129 $this->ilias->db->query($q);
00130
00131 $q = "DELETE FROM aicc_object WHERE slm_id = ".$ilDB->quote($this->getId());
00132 $this->ilias->db->query($q);
00133
00134
00135
00136 return true;
00137 }
00138
00139
00143 function getTrackingItems()
00144 {
00145 include_once("content/classes/SCORM/class.ilSCORMTree.php");
00146 $tree = new ilSCORMTree($this->getId());
00147 $root_id = $tree->readRootId();
00148
00149 $items = array();
00150 $childs = $tree->getSubTree($tree->getNodeData($root_id));
00151 foreach($childs as $child)
00152 {
00153 if($child["type"] == "sau")
00154 {
00155 include_once("content/classes/AICC/class.ilAICCUnit.php");
00156 $ac_item =& new ilAICCUnit($child["obj_id"]);
00157 $items[count($items)] =& $ac_item;
00158 }
00159 }
00160
00161 return $items;
00162 }
00163
00167 function getTrackedItems()
00168 {
00169 global $ilUser, $ilDB, $ilUser;
00170
00171 $query = "SELECT DISTINCT sco_id FROM scorm_tracking WHERE".
00172 " ref_id = ".$ilDB->quote($this->getRefId());
00173
00174 $sco_set = $ilDB->query($query);
00175
00176 $items = array();
00177 while($sco_rec = $sco_set->fetchRow(DB_FETCHMODE_ASSOC))
00178 {
00179 include_once("content/classes/AICC/class.ilAICCUnit.php");
00180 $ac_item =& new ilAICCUnit($sco_rec["sco_id"]);
00181 $items[count($items)] =& $ac_item;
00182
00183 }
00184
00185 return $items;
00186 }
00187
00188 function getTrackingData($a_sco_id)
00189 {
00190 global $ilDB;
00191
00192 $query = "SELECT * FROM scorm_tracking WHERE".
00193 " ref_id = ".$ilDB->quote($this->getRefId()).
00194 " AND sco_id = ".$ilDB->quote($a_sco_id).
00195 " ORDER BY user_id, lvalue";
00196 $data_set = $ilDB->query($query);
00197
00198 $data = array();
00199 while($data_rec = $data_set->fetchRow(DB_FETCHMODE_ASSOC))
00200 {
00201 $data[] = $data_rec;
00202 }
00203
00204 return $data;
00205 }
00206
00207 }
00208
00209 ?>