本文整理汇总了PHP中ilObjMediaObject::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::delete方法的具体用法?PHP ilObjMediaObject::delete怎么用?PHP ilObjMediaObject::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deletePool
/**
* Deletes all data of a room sharing pool.
*
* @param ilObjRoomSharing $a_pool
*
* @return bool true if deletion was successful
*/
public static function deletePool(ilObjRoomSharing $a_pool)
{
$db = new ilRoomSharingDatabase($a_pool->getPoolId());
// Calendar
$calendar_id = $db->getCalendarId();
$db->deleteCalendar($calendar_id);
// Bookings
$all_bookings_ids = $db->getAllBookingsIds();
// Calendar-Entries
$db->deleteCalendarEntriesOfBookings($all_bookings_ids);
foreach ($all_bookings_ids as $booking_id) {
$db->deleteBooking($booking_id);
}
// Booking attributes
$all_booking_attributes = $db->getAllBookingAttributes();
foreach ($all_booking_attributes as $booking_attribute) {
$db->deleteBookingAttribute($booking_attribute['id']);
$db->deleteAttributeBookingAssign($booking_attribute['id']);
}
// Rooms
$all_room_ids = $db->getAllRoomIds();
foreach ($all_room_ids as $room_id) {
$db->deleteRoom($room_id);
}
// Room attributes
$all_room_attributes = $db->getAllRoomAttributes();
foreach ($all_room_attributes as $room_attribute) {
$db->deleteRoomAttribute($room_attribute['id']);
$db->deleteAttributeRoomAssign($room_attribute['id']);
}
// Privileges
$classes = $db->getClasses();
foreach ($classes as $class) {
$db->deleteClass($class['id']);
// Takes also care of assignments
}
// Floorplans
$all_floorplans_ids = $db->getAllFloorplanIds();
foreach ($all_floorplans_ids as $floor_plan_id) {
$db->deleteFloorplan($floor_plan_id);
}
// Files of floorplans and rooms user agreement
foreach ($all_floorplans_ids as $floor_plan_file_id) {
if (!empty($floor_plan_file_id) && $floor_plan_file_id != "0") {
$floor_plan_file = new ilObjMediaObject($floor_plan_file_id);
$floor_plan_file->delete();
}
}
$rooms_agreement_file_id = $a_pool->getRoomsAgreementFileId();
if (ilRoomSharingNumericUtils::isPositiveNumber($rooms_agreement_file_id)) {
$rooms_agreement_file = new ilObjMediaObject($rooms_agreement_file_id);
$rooms_agreement_file->delete();
}
// Pool itself
$db->deletePoolEntry("SURE");
}
示例2: saveStatutoryRegulationsObject
public function saveStatutoryRegulationsObject()
{
require_once 'Services/RTE/classes/class.ilRTE.php';
if (isset($_POST['statutory_regulations']) && $_POST['statutory_regulations'] != NULL) {
$this->genSetData->set('statutory_regulations', ilRTE::_replaceMediaObjectImageSrc($_POST['statutory_regulations'], 0), 'regulations');
// copy temporary media objects (frm~)
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mediaObjects = ilRTE::_getMediaObjects($_POST['statutory_regulations'], 0);
$myMediaObjects = ilObjMediaObject::_getMobsOfObject('pays~:html', ilObject::_lookupObjId($this->ref_id));
foreach ($mediaObjects as $mob) {
foreach ($myMediaObjects as $myMob) {
if ($mob == $myMob) {
// change usage
ilObjMediaObject::_removeUsage($mob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
break;
}
}
ilObjMediaObject::_saveUsage($mob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
}
} else {
$this->genSetData->set('statutory_regulations', NULL, 'regulations');
}
// remove usage of deleted media objects
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$oldMediaObjects = ilObjMediaObject::_getMobsOfObject('pays~:html', ilObject::_lookupObjId($this->ref_id));
$curMediaObjects = ilRTE::_getMediaObjects($_POST['statutory_regulations'], 0);
foreach ($oldMediaObjects as $oldMob) {
$found = false;
foreach ($curMediaObjects as $curMob) {
if ($oldMob == $curMob) {
$found = true;
break;
}
}
if (!$found) {
if (ilObjMediaObject::_exists($oldMob)) {
ilObjMediaObject::_removeUsage($oldMob, 'pays~:html', ilObject::_lookupObjId($this->ref_id));
$mob_obj = new ilObjMediaObject($oldMob);
$mob_obj->delete();
}
}
}
$this->genSetData->set('show_sr_shoppingcart', isset($_POST['show_sr_shoppingcart']) ? 1 : 0, 'regulations');
$this->genSetData->set('attach_sr_invoice', isset($_POST['attach_sr_invoice']) ? 1 : 0, 'regulations');
$this->StatutoryRegulationsObject();
ilUtil::sendSuccess($this->lng->txt('pays_updated_general_settings'));
return true;
}
示例3: delete
/**
* Delete news item
*
*/
public function delete()
{
global $ilDB;
// delete il_news_read entries
$ilDB->manipulate("DELETE FROM il_news_read " . " WHERE news_id = " . $ilDB->quote($this->getId(), "integer"));
// delete multimedia object
$mob = $this->getMobId();
// delete
parent::delete();
// delete mob after news, to have a "mob usage" of 0
if ($mob > 0 and ilObject::_exists($mob)) {
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob = new ilObjMediaObject($mob);
$mob->delete();
}
}
示例4: uploadRoomsAgreement
/**
* Uploads a new rooms agreement by using the ILIAS MediaObject Service.
* If the old file id is given, the old file will be deleted.
*
* @param array $a_newfile an array containing the input values of the form
* @param string $a_oldFileId to delete trash
*
* @return string uploaded file id
*/
public function uploadRoomsAgreement($a_newfile, $a_oldFileId = "0")
{
if (!empty($a_oldFileId) && $a_oldFileId != "0") {
$agreementFile = new ilObjMediaObject($a_oldFileId);
$agreementFile->delete();
}
$mediaObj = new ilObjMediaObject();
$mediaObj->setTitle("RoomSharingRoomsAgreement");
$mediaObj->setDescription("RoomSharingRoomsAgreement");
$mediaObj->create();
$mob_dir = ilObjMediaObject::_getDirectory($mediaObj->getId());
if (!is_dir($mob_dir)) {
$mediaObj->createDirectory();
}
$file_name = ilUtil::getASCIIFilename($a_newfile["name"]);
$file_name_mod = str_replace(" ", "_", $file_name);
$file = $mob_dir . "/" . $file_name_mod;
ilUtil::moveUploadedFile($a_newfile["tmp_name"], $file_name_mod, $file);
ilUtil::renameExecutables($mob_dir);
$format = ilObjMediaObject::getMimeType($file);
$media_item = new ilMediaItem();
$mediaObj->addMediaItem($media_item);
$media_item->setPurpose("Standard");
$media_item->setFormat($format);
$media_item->setLocation($file_name_mod);
$media_item->setLocationType("LocalFile");
$mediaObj->update();
return $mediaObj->getId();
}
示例5: delete
/**
* delete object and all related data
*
* this method has been tested on may 9th 2004
* media pool tree, media objects and folders
* 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()
{
// always call parent delete function first!!
if (!parent::delete()) {
return false;
}
// get childs
$childs = $this->tree->getSubTree($this->tree->getNodeData($this->tree->readRootId()));
// delete tree
$this->tree->removeTree($this->tree->getTreeId());
// delete childs
foreach ($childs as $child) {
$fid = ilMediaPoolItem::lookupForeignId($child["obj_id"]);
switch ($child["type"]) {
case "mob":
if (ilObject::_lookupType($fid) == "mob") {
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob = new ilObjMediaObject($fid);
$mob->delete();
}
break;
/* case "fold":
if (ilObject::_lookupType($fid) == "fold")
{
include_once("./Modules/Folder/classes/class.ilObjFolder.php");
$fold = new ilObjFolder($fid, false);
$fold->delete();
}
break;*/
}
}
return true;
}
示例6: beforePageDelete
/**
* Before page is being deleted
*
* @param object $a_page page object
*/
static function beforePageDelete($a_page)
{
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_ids = ilObjMediaObject::_getMobsOfObject($a_page->getParentType() . ":pg", $a_page->getId(), 0, $a_page->getLanguage());
ilObjMediaObject::_deleteAllUsages($a_page->getParentType() . ":pg", $a_page->getId(), false, $a_page->getLanguage());
foreach ($mob_ids as $mob) {
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
$mob_obj = new ilObjMediaObject($mob);
$usages = $mob_obj->getUsages(false);
if (count($usages) == 0) {
$mob_obj->delete();
}
}
}
}
示例7: deleteMob
public function deleteMob($obj_id)
{
if (ilObject2::_lookupObjId($obj_id)) {
$mob = new ilObjMediaObject($obj_id);
$mob->delete();
}
}
示例8: remove
/**
* remove item from clipboard
*/
function remove()
{
global $ilias, $ilUser, $lng, $ilCtrl;
// check number of objects
if (!isset($_POST["id"])) {
$ilias->raiseError($lng->txt("no_checkbox"), $ilias->error_obj->MESSAGE);
}
foreach ($_POST["id"] as $obj_id) {
$id = explode(":", $obj_id);
if ($id[0] == "mob") {
$ilUser->removeObjectFromClipboard($id[1], "mob");
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob = new ilObjMediaObject($id[1]);
$mob->delete();
// this method don't delete, if mob is used elsewhere
}
if ($id[0] == "incl") {
$ilUser->removeObjectFromClipboard($id[1], "incl");
}
}
$ilCtrl->redirect($this, "view");
}
示例9: viewThreadObject
public function viewThreadObject()
{
/**
* @var $tpl ilTemplate
* @var $lng ilLanguage
* @var $ilUser ilObjUser
* @var $ilAccess ilAccessHandler
* @var $rbacreview ilRbacReview
* @var $ilNavigationHistory ilNavigationHistory
* @var $ilCtrl ilCtrl
* @var $ilToolbar ilToolbarGUI
*/
global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator;
$tpl->addCss('./Modules/Forum/css/forum_tree.css');
if (!isset($_SESSION['viewmode'])) {
$_SESSION['viewmode'] = $this->objProperties->getDefaultView();
}
// quick and dirty: check for treeview
if (!isset($_SESSION['thread_control']['old'])) {
$_SESSION['thread_control']['old'] = $_GET['thr_pk'];
$_SESSION['thread_control']['new'] = $_GET['thr_pk'];
} else {
if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) {
$_SESSION['thread_control']['new'] = $_GET['thr_pk'];
}
}
if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) {
$_SESSION['viewmode'] = $_GET['viewmode'];
}
if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
$_SESSION['viewmode'] = ilForumProperties::VIEW_TREE;
} else {
$_SESSION['viewmode'] = ilForumProperties::VIEW_DATE;
}
if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
$this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
}
// init objects
$oForumObjects = $this->getForumObjects();
/**
* @var $forumObj ilObjForum
*/
$forumObj = $oForumObjects['forumObj'];
/**
* @var $frm ilForum
*/
$frm = $oForumObjects['frm'];
/**
* @var $file_obj ilFileDataForum
*/
$file_obj = $oForumObjects['file_obj'];
// download file
if ($_GET['file']) {
if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) {
ilUtil::sendFailure($this->lng->txt('error_reading_file'));
} else {
ilUtil::deliverFile($path['path'], $path['clean_filename']);
}
}
if (!$this->objCurrentTopic->getId()) {
$ilCtrl->redirect($this, 'showThreads');
}
// Set context for login
$append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : '');
$tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append);
// delete temporary media object (not in case a user adds media objects and wants to save an invalid form)
if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') {
try {
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
$mob_obj = new ilObjMediaObject($mob);
$mob_obj->delete();
}
}
} catch (Exception $e) {
}
}
require_once './Modules/Forum/classes/class.ilObjForum.php';
require_once './Modules/Forum/classes/class.ilFileDataForum.php';
$lng->loadLanguageModule('forum');
// add entry to navigation history
if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) {
$ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
$ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm');
}
// save last access
$forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
$this->prepareThreadScreen($forumObj);
$tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum');
if (isset($_GET['anchor'])) {
$tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']);
}
if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) {
$orderField = 'frm_posts_tree.fpt_date';
$this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC');
} else {
$orderField = 'frm_posts_tree.rgt';
//.........这里部分代码省略.........
示例10: deleteFloorPlan
/**
* Deletes a floor plan by file id.
*
* @param type $a_file_id the file id of the floor plan
*
* @return the result of the manipulation
*/
public function deleteFloorPlan($a_file_id)
{
if (!$this->permission->checkPrivilege(PRIVC::DELETE_FLOORPLANS)) {
ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action"), true);
$this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary');
return false;
}
$res = NULL;
if ($a_file_id) {
$mediaObj = new ilObjMediaObject($a_file_id);
$mediaObj->removeAllMediaItems();
$mediaObj->delete();
if ($res = $this->ilRoomsharingDatabase->deleteFloorplan($a_file_id)) {
$this->ilRoomsharingDatabase->deleteFloorplanRoomAssociation($a_file_id);
}
}
return $res;
}
示例11: update
//.........这里部分代码省略.........
if ($last_c == "") {
$last_c = ilUtil::now();
}
$ilDB->insert("page_history", array("page_id" => array("integer", $old_rec["page_id"]), "parent_type" => array("text", $old_rec["parent_type"]), "hdate" => array("timestamp", $last_c), "parent_id" => array("integer", $old_rec["parent_id"]), "content" => array("clob", $old_rec["content"]), "user_id" => array("integer", $old_rec["last_change_user"]), "ilias_version" => array("text", ILIAS_VERSION_NUMERIC), "nr" => array("integer", (int) $last_nr["mnr"] + 1)));
/*$h_query = "REPLACE INTO page_history ".
"(page_id, parent_type, hdate, parent_id, content, user_id, ilias_version, nr) VALUES (".
$ilDB->quote($old_rec["page_id"]).",".
$ilDB->quote($old_rec["parent_type"]).",".
$ilDB->quote($old_rec["last_change"]).",".
$ilDB->quote($old_rec["parent_id"]).",".
$ilDB->quote($old_rec["content"]).",".
$ilDB->quote($old_rec["last_change_user"]).",".
$ilDB->quote(ILIAS_VERSION_NUMERIC).",".
$ilDB->quote($last_nr["mnr"] + 1).")";
//echo "<br><br>+$a_no_history+$h_query";
$ilDB->query($h_query);*/
$this->saveMobUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveStyleUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveFileUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveContentIncludeUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveSkillUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->history_saved = true;
// only save one time
} else {
$this->history_saved = true;
// do not save on first change
}
}
}
//echo htmlentities($content);
$em = trim($content) == "<PageObject/>" ? 1 : 0;
$iel = $this->containsDeactivatedElements($content);
$inl = $this->containsIntLinks($content);
/*$query = "UPDATE page_object ".
"SET content = ".$ilDB->quote($content)." ".
", parent_id= ".$ilDB->quote($this->getParentId())." ".
", last_change_user= ".$ilDB->quote($ilUser->getId())." ".
", last_change = now() ".
", is_empty = ".$ilDB->quote($em, "integer")." ".
", active = ".$ilDB->quote($this->getActive())." ".
", activation_start = ".$ilDB->quote($this->getActivationStart())." ".
", activation_end = ".$ilDB->quote($this->getActivationEnd())." ".
", inactive_elements = ".$ilDB->quote($iel, "integer")." ".
", int_links = ".$ilDB->quote($inl, "integer")." ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type= ".$ilDB->quote($this->getParentType());*/
$ilDB->update("page_object", array("content" => array("clob", $content), "parent_id" => array("integer", $this->getParentId()), "last_change_user" => array("integer", $ilUser->getId()), "last_change" => array("timestamp", ilUtil::now()), "is_empty" => array("integer", $em), "active" => array("integer", $this->getActive()), "activation_start" => array("timestamp", $this->getActivationStart()), "activation_end" => array("timestamp", $this->getActivationEnd()), "show_activation_info" => array("integer", $this->getShowActivationInfo()), "inactive_elements" => array("integer", $iel), "int_links" => array("integer", $inl)), array("page_id" => array("integer", $this->getId()), "parent_type" => array("text", $this->getParentType())));
// todo put this into update function
/* if(!$this->ilias->db->checkQuerySize($query))
{
$this->ilias->raiseError($lng->txt("check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
return false;
}*/
// $this->ilias->db->query($query);
if (!$skip_handle_usages) {
// handle media object usage
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob_ids = ilObjMediaObject::_getMobsOfObject($this->getParentType() . ":pg", $this->getId());
$this->saveMobUsage($this->getXMLFromDom());
$this->saveMetaKeywords($this->getXMLFromDom());
foreach ($mob_ids as $mob) {
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob") {
$mob_obj = new ilObjMediaObject($mob);
$usages = $mob_obj->getUsages(false);
if (count($usages) == 0) {
$mob_obj->delete();
}
}
}
// handle file usages
include_once "./Modules/File/classes/class.ilObjFile.php";
$file_ids = ilObjFile::_getFilesOfObject($this->getParentType() . ":pg", $this->getId());
$this->saveFileUsage();
foreach ($file_ids as $file) {
if (ilObject::_exists($file)) {
$file_obj = new ilObjFile($file, false);
$usages = $file_obj->getUsages();
if (count($usages) == 0) {
if ($file_obj->getMode() == "filelist") {
$file_obj->delete();
}
}
}
}
// save style usage
$this->saveStyleUsage($this->getXMLFromDom());
// save content include usage
$this->saveContentIncludeUsage($this->getXMLFromDom());
$this->saveSkillUsage($this->getXMLFromDom());
}
// save internal link information
$this->saveInternalLinks($this->getXMLFromDom());
$this->saveAnchors($this->getXMLFromDom());
$this->callUpdateListeners();
//echo "<br>PageObject::update:".htmlentities($this->getXMLContent()).":";
return true;
} else {
return $errors;
}
}
示例12: deletePost
/**
* delete post and sub-posts
* @param integer $post: ID
* @access public
* @return integer 0 or thread-ID
*/
public function deletePost($post)
{
global $ilDB;
include_once "./Modules/Forum/classes/class.ilObjForum.php";
// delete tree and get id's of all posts to delete
$p_node = $this->getPostNode($post);
$del_id = $this->deletePostTree($p_node);
// Delete User read entries
foreach ($del_id as $post_id) {
ilObjForum::_deleteReadEntries($post_id);
}
// DELETE ATTACHMENTS ASSIGNED TO POST
$this->__deletePostFiles($del_id);
$dead_pos = count($del_id);
$dead_thr = 0;
// if deletePost is thread opener ...
if ($p_node["parent"] == 0) {
// delete thread access data
include_once './Modules/Forum/classes/class.ilObjForum.php';
ilObjForum::_deleteAccessEntries($p_node['tree']);
// delete thread
$dead_thr = $p_node["tree"];
$statement = $ilDB->manipulateF('
DELETE FROM frm_threads
WHERE thr_pk = %s', array('integer'), array($p_node['tree']));
// update num_threads
$statement = $ilDB->manipulateF('
UPDATE frm_data
SET top_num_threads = top_num_threads - 1
WHERE top_frm_fk = %s', array('integer'), array($this->id));
// delete all related news
$posset = $ilDB->queryf('
SELECT * FROM frm_posts
WHERE pos_thr_fk = %s', array('integer'), array($p_node['tree']));
while ($posrec = $ilDB->fetchAssoc($posset)) {
include_once "./Services/News/classes/class.ilNewsItem.php";
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id, "frm", $posrec["pos_pk"], "pos");
if ($news_id > 0) {
$news_item = new ilNewsItem($news_id);
$news_item->delete();
}
try {
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $posrec['pos_pk']);
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
ilObjMediaObject::_removeUsage($mob, 'frm:html', $posrec['pos_pk']);
$mob_obj = new ilObjMediaObject($mob);
$mob_obj->delete();
}
}
} catch (Exception $e) {
}
}
// delete all posts of this thread
$statement = $ilDB->manipulateF('
DELETE FROM frm_posts
WHERE pos_thr_fk = %s', array('integer'), array($p_node['tree']));
} else {
// delete this post and its sub-posts
for ($i = 0; $i < $dead_pos; $i++) {
$statement = $ilDB->manipulateF('
DELETE FROM frm_posts
WHERE pos_pk = %s', array('integer'), array($del_id[$i]));
// delete related news item
include_once "./Services/News/classes/class.ilNewsItem.php";
$news_id = ilNewsItem::getFirstNewsIdForContext($this->id, "frm", $del_id[$i], "pos");
if ($news_id > 0) {
$news_item = new ilNewsItem($news_id);
$news_item->delete();
}
try {
include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
$mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $del_id[$i]);
foreach ($mobs as $mob) {
if (ilObjMediaObject::_exists($mob)) {
ilObjMediaObject::_removeUsage($mob, 'frm:html', $del_id[$i]);
$mob_obj = new ilObjMediaObject($mob);
$mob_obj->delete();
}
}
} catch (Exception $e) {
}
}
// update num_posts in frm_threads
$statement = $ilDB->manipulateF('
UPDATE frm_threads
SET thr_num_posts = thr_num_posts - %s
WHERE thr_pk = %s', array('integer', 'integer'), array($dead_pos, $p_node['tree']));
// get latest post of thread and update last_post
$res1 = $ilDB->queryf('
SELECT * FROM frm_posts
WHERE pos_thr_fk = %s
ORDER BY pos_date DESC', array('integer'), array($p_node['tree']));
//.........这里部分代码省略.........