function deleteAll() { return ilLPCollections::_deleteAll($this->getObjId()); }
/** * delete object or referenced object * (in the case of a referenced object, object data is only deleted * if last reference is deleted) * This function removes an object entirely from system!! * * @access public * @return boolean true if object was removed completely; false if only a references was removed */ function delete() { global $rbacadmin, $log, $ilDB; $remove = false; // delete object_data entry if (!$this->referenced || $this->countReferences() == 1) { // check type match $db_type = ilObject::_lookupType($this->getId()); if ($this->type != $db_type) { $message = "ilObject::delete(): Type mismatch. Object with obj_id: " . $this->id . " " . "was instantiated by type '" . $this->type . "'. DB type is: " . $db_type; // write log entry $log->write($message); // raise error $this->ilias->raiseError("ilObject::delete(): Type mismatch. (" . $this->type . "/" . $this->id . ")", $this->ilias->error_obj->WARNING); } // delete entry in object_data $q = "DELETE FROM object_data " . "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($q); // delete long description $query = "DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($query); // write log entry $log->write("ilObject::delete(), deleted object, obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); // remove news include_once "./Services/News/classes/class.ilNewsItem.php"; $news_item = new ilNewsItem(); $news_item->deleteNewsOfContext($this->getId(), $this->getType()); include_once "./Services/Block/classes/class.ilBlockSetting.php"; ilBlockSetting::_deleteSettingsOfBlock($this->getId(), "news"); include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; ilDidacticTemplateObjSettings::deleteByObjId($this->getId()); /* remove notes (see infoscreen gui) as they can be seen as personal data we are keeping them for now include_once("Services/Notes/classes/class.ilNote.php"); foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type) { foreach(ilNote::_getNotesOfObject($this->id, 0, $this->type, $note_type) as $note) { $note->delete(); } } */ // BEGIN WebDAV: Delete WebDAV properties $query = "DELETE FROM dav_property " . "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer'); $res = $ilDB->manipulate($query); // END WebDAV: Delete WebDAV properties include_once './Services/Tracking/classes/class.ilChangeEvent.php'; ilChangeEvent::_delete($this->getId()); include_once './Services/Tracking/classes/class.ilLPCollections.php'; ilLPCollections::_deleteAll($this->getId()); include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; ilECSImport::_deleteByObjId($this->getId()); $remove = true; } else { // write log entry $log->write("ilObject::delete(), object not deleted, number of references: " . $this->countReferences() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); } // delete object_reference entry if ($this->referenced) { include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::deleteAllEntries($this->getRefId()); // delete entry in object_reference $query = "DELETE FROM object_reference " . "WHERE ref_id = " . $ilDB->quote($this->getRefId(), 'integer'); $res = $ilDB->manipulate($query); // write log entry $log->write("ilObject::delete(), reference deleted, ref_id: " . $this->getRefId() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); // DELETE PERMISSION ENTRIES IN RBAC_PA // DONE: method overwritten in ilObjRole & ilObjUser. // this call only applies for objects in rbac (not usr,role,rolt) // TODO: Do this for role templates too $rbacadmin->revokePermission($this->getRefId(), 0, false); include_once "Services/AccessControl/classes/class.ilRbacLog.php"; ilRbacLog::delete($this->getRefId()); // Remove applied didactic template setting include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; ilDidacticTemplateObjSettings::deleteByRefId($this->getRefId()); // Remove desktop items ilUtil::removeItemFromDesktops($this->getRefId()); } // remove conditions if ($this->referenced) { $ch =& new ilConditionHandler(); $ch->delete($this->getRefId()); unset($ch); } return $remove; }
/** * Test LP collections * @return */ public function testLPCollections() { include_once './Services/Tracking/classes/class.ilLPCollections.php'; $coll = new ilLPCollections(999); $coll->add(888); $coll->delete(888); $coll->add(777); ilLPCollections::_deleteAll(999); }