本文整理汇总了PHP中ilObjMediaObject::removeMediaItem方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::removeMediaItem方法的具体用法?PHP ilObjMediaObject::removeMediaItem怎么用?PHP ilObjMediaObject::removeMediaItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::removeMediaItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCastItemObject
/**
* Update cast item
*/
function updateCastItemObject()
{
global $tpl, $lng, $ilCtrl, $ilUser, $log;
$this->checkPermission("write");
$this->initAddCastItemForm("edit");
if ($this->form_gui->checkInput()) {
// create new media cast item
include_once "./Services/News/classes/class.ilNewsItem.php";
$mc_item = new ilNewsItem($_GET["item_id"]);
$mob_id = $mc_item->getMobId();
// create dummy object in db (we need an id)
include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
$mob = new ilObjMediaObject($mob_id);
foreach (ilObjMediaCast::$purposes as $purpose) {
if ($this->form_gui->getInput("delete_" . $purpose)) {
$mob->removeMediaItem($purpose);
$log->write("Mcst: deleting purpose {$purpose}");
continue;
}
$media_item = $mob->getMediaItem($purpose);
$url_gui = $this->form_gui->getInput("url_" . $purpose);
$file_gui = $this->form_gui->getInput("file_" . $purpose);
if ($media_item == null) {
if ($purpose != "Standard" && ($url_gui || $file_gui["size"] > 0)) {
// check if we added an additional purpose when updating
// either by url or by file
$file = $this->createMediaItemForPurpose($mob, $purpose);
}
} else {
$file = $this->updateMediaItem($mob, $media_item);
}
if ($purpose == "Standard") {
$duration = $this->getDuration($file);
$title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
$description = $this->form_gui->getInput("description");
$mob->setTitle($title);
$mob->setDescription($description);
$prevpic = $this->form_gui->getInput("preview_pic");
if ($prevpic["size"] > 0) {
$mob->uploadVideoPreviewPic($prevpic);
} else {
$prevpici = $this->form_gui->getItemByPostVar("preview_pic");
if ($prevpici->getDeletionFlag()) {
$mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
}
}
}
}
// set real meta and object data
$mob->update();
//
// @todo: save usage
//
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
$mc_item->setUserId($ilUser->getId());
if (isset($duration)) {
$mc_item->setPlaytime($duration);
}
$mc_item->setTitle($title);
$mc_item->setContent($description);
if ($enable_internal_rss) {
$mc_item->setVisibility($this->form_gui->getInput("visibility"));
}
$mc_item->update();
$ilCtrl->redirect($this, "listItems");
} else {
$this->populateFormFromPost();
}
}