/** * delete SCORM learning module and all related data * * this method has been tested on may 9th 2004 * meta data, scorm lm data, scorm tree, scorm objects (organization(s), * manifest, resources and items), tracking data and data directory * have been deleted correctly as desired * * @access public * @return boolean true if all object data were removed; false if only a references were removed */ function delete() { global $ilDB, $ilLog; // always call parent delete function first!! if (!parent::delete()) { return false; } // delete meta data of scorm content object /* $nested = new ilNestedSetXML(); $nested->init($this->getId(), $this->getType()); $nested->deleteAllDBData(); */ $this->deleteMetaData(); // delete data directory ilUtil::delDir($this->getDataDirectory()); // delete scorm learning module record $ilDB->manipulateF('DELETE FROM sahs_lm WHERE id = %s', array('integer'), array($this->getId())); // delete aicc data $res = $ilDB->queryF(' SELECT * FROM aicc_object, aicc_units WHERE aicc_object.obj_id = aicc_units.obj_id AND aicc_object.slm_id = %s', array('integer'), array($this->getId())); while ($row = $ilDB->fetchAssoc($res)) { $obj_id = $row['obj_id']; $ilDB->manipulateF(' DELETE FROM aicc_units WHERE obj_id = %s', array('integer'), array($obj_id)); } $res = $ilDB->queryF(' SELECT * FROM aicc_object, aicc_course WHERE aicc_object.obj_id = aicc_course.obj_id AND aicc_object.slm_id = %s', array('integer'), array($this->getId())); while ($row = $ilDB->fetchAssoc($res)) { $obj_id = $row['obj_id']; $ilDB->manipulateF(' DELETE FROM aicc_course WHERE obj_id = %s', array('integer'), array($obj_id)); } $ilDB->manipulateF('DELETE FROM scorm_tree WHERE slm_id = %s', array('integer'), array($this->getId())); $ilDB->manipulateF('DELETE FROM aicc_object WHERE slm_id = %s', array('integer'), array($this->getId())); $q_log = "DELETE FROM scorm_tracking WHERE obj_id = " . $ilDB->quote($this->getId()); $ilLog->write("SAHS Delete (AICC LM): " . $q_log); $ilDB->manipulateF('DELETE FROM scorm_tracking WHERE obj_id = %s', array('integer'), array($this->getId())); $q_log = "DELETE FROM sahs_user WHERE obj_id = " . $ilDB->quote($this->getId()); $ilLog->write("SAHS Delete (AICC LM): " . $q_log); $ilDB->manipulateF('DELETE FROM sahs_user WHERE obj_id = %s', array('integer'), array($this->getId())); // update learning progress status include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; ilLPStatusWrapper::_refreshStatus($this->getId()); // always call parent delete function at the end!! return true; }