本文整理汇总了PHP中ilObjMediaObject::getVideoPreviewPic方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::getVideoPreviewPic方法的具体用法?PHP ilObjMediaObject::getVideoPreviewPic怎么用?PHP ilObjMediaObject::getVideoPreviewPic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::getVideoPreviewPic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilAccess;
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
// access
if ($enable_internal_rss && !$this->presentation_mode) {
$this->tpl->setCurrentBlock("access");
$this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
if ($a_set["visibility"] == NEWS_PUBLIC) {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
} else {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
}
$this->tpl->parseCurrentBlock();
}
$ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", "");
if (ilObject::_exists($a_set["mob_id"])) {
if ($a_set["update_date"] != "") {
$this->tpl->setCurrentBlock("last_update");
$this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
$this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
$this->tpl->parseCurrentBlock();
}
$mob = new ilObjMediaObject($a_set["mob_id"]);
$med = $mob->getMediaItem("Standard");
$this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
$this->tpl->setVariable("VAL_DESCRIPTION", $a_set["content"]);
$this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
$this->tpl->setVariable("VAL_CREATED", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
$this->tpl->setVariable("TXT_DURATION", $lng->txt("mcst_play_time"));
if ($a_set["playtime"] != "00:00:00") {
$this->tpl->setVariable("VAL_DURATION", $a_set["playtime"]);
} else {
$this->tpl->setVariable("VAL_DURATION", "-");
}
if (!$this->edit_order) {
if ($this->downloadable) {
$ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
// to keep always the order of the purposes
// iterate through purposes and display the according mediaitems
foreach (ilObjMediaCast::$purposes as $purpose) {
$a_mob = $mob->getMediaItem($purpose);
if (!is_object($a_mob)) {
continue;
}
$ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", $a_mob->getPurpose());
$file = ilObjMediaObject::_lookupItemPath($a_mob->getMobId(), false, false, $a_mob->getPurpose());
if (is_file($file)) {
$size = filesize($file);
$size = ", " . sprintf("%.1f MB", $size / 1024 / 1024);
}
$format = $a_mob->getFormat() != "" ? $a_mob->getFormat() : "audio/mpeg";
$this->tpl->setCurrentBlock("downloadable");
$this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("mcst_download_" . strtolower($a_mob->getPurpose())));
$this->tpl->setVariable("CMD_DOWNLOAD", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
$this->tpl->setVariable("TITLE_DOWNLOAD", "(" . $format . $size . ")");
$this->tpl->parseCurrentBlock();
}
}
include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
$mpl = new ilMediaPlayerGUI();
if (is_object($med)) {
if (strcasecmp("Reference", $med->getLocationType()) == 0) {
$mpl->setFile($med->getLocation());
} else {
$mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
}
$mpl->setMimeType($med->getFormat());
//$mpl->setDisplayHeight($med->getHeight());
$mpl->setDisplayWidth("640");
$mpl->setDisplayHeight("480");
$mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
$mpl->setTitle($a_set["title"]);
$mpl->setDescription($a_set["content"]);
$med_alt = $mob->getMediaItem("VideoAlternative");
if (is_object($med_alt)) {
$mpl->setAlternativeVideoFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med_alt->getLocation());
$mpl->setAlternativeVideoMimeType($med_alt->getFormat());
}
}
//$this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
$this->tpl->setVariable("PLAYER", $mpl->getPreviewHtml());
// edit link
$ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->presentation_mode) {
$this->tpl->setCurrentBlock("edit");
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "editCastItem"));
if (!is_int(strpos($med->getFormat(), "image/"))) {
$this->tpl->setVariable("TXT_DET_PLAYTIME", $lng->txt("mcst_det_playtime"));
$this->tpl->setVariable("CMD_DET_PLAYTIME", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "determinePlaytime"));
}
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("edit_checkbox");
//.........这里部分代码省略.........
示例2: extractPreviewImageObject
/**
* Extract preview image
*
* @param
* @return
*/
function extractPreviewImageObject()
{
global $ilCtrl;
$this->checkPermission("write");
$this->mcst_item = new ilNewsItem($_GET["item_id"]);
include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
$mob = new ilObjMediaObject($this->mcst_item->getMobId());
try {
$sec = (int) $_POST["sec"];
if ($sec < 0) {
$sec = 0;
}
if ($mob->getVideoPreviewPic() != "") {
$mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
}
include_once "./Services/MediaObjects/classes/class.ilFFmpeg.php";
$med = $mob->getMediaItem("Standard");
$mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation();
$new_file = ilFFmpeg::extractImage($mob_file, "mob_vpreview.png", ilObjMediaObject::_getDirectory($mob->getId()), $sec);
if ($new_file != "") {
ilUtil::sendInfo($this->lng->txt("mcst_image_extracted"), true);
} else {
ilUtil::sendFailure($this->lng->txt("mcst_no_extraction_possible"), true);
}
} catch (ilException $e) {
if (DEVMODE == 1) {
$ret = ilFFmpeg::getLastReturnValues();
$add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : "";
}
ilUtil::sendFailure($e->getMessage() . $add, true);
}
$ilCtrl->redirect($this, "editCastItem");
}
示例3: parseHTML
/**
* function parses stored value in database to a html output for eg. the record list gui.
*
* @param $value
* @param ilDataCollectionRecordField $record_field
*
* @return mixed
*/
public function parseHTML($value, ilDataCollectionRecordField $record_field, $link = true)
{
global $ilAccess, $ilCtrl, $lng;
switch ($this->id) {
case self::INPUTFORMAT_DATETIME:
$html = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATETIME));
break;
case self::INPUTFORMAT_FILE:
if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
$html = "";
break;
}
$file_obj = new ilObjFile($value, false);
$ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "record_id", $record_field->getRecord()->getId());
$ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "field_id", $record_field->getField()->getId());
$html = '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordlistgui", "sendFile") . '">' . $file_obj->getFileName() . '</a>';
if (ilPreview::hasPreview($file_obj->getId())) {
ilPreview::createPreview($file_obj);
// Create preview if not already existing
$preview = new ilPreviewGUI((int) $_GET['ref_id'], ilPreviewGUI::CONTEXT_REPOSITORY, $file_obj->getId(), $ilAccess);
$preview_status = ilPreview::lookupRenderStatus($file_obj->getId());
$preview_status_class = "";
$preview_text_topic = "preview_show";
if ($preview_status == ilPreview::RENDER_STATUS_NONE) {
$preview_status_class = "ilPreviewStatusNone";
$preview_text_topic = "preview_none";
}
$wrapper_html_id = 'record_field_' . $record_field->getId();
$script_preview_click = $preview->getJSCall($wrapper_html_id);
$preview_title = $lng->txt($preview_text_topic);
$preview_icon = ilUtil::getImagePath("preview.png", "Services/Preview");
$html = '<div id="' . $wrapper_html_id . '">' . $html;
$html .= '<span class="il_ContainerItemPreview ' . $preview_status_class . '"><a href="javascript:void(0);" onclick="' . $script_preview_click . '" title="' . $preview_title . '"><img src="' . $preview_icon . '" height="16" width="16"></a></span></div>';
}
break;
case self::INPUTFORMAT_MOB:
$mob = new ilObjMediaObject($value, false);
$med = $mob->getMediaItem('Standard');
if (!$med->location) {
$html = "";
break;
}
$arr_properties = $record_field->getField()->getProperties();
$is_linked_field = $arr_properties[ilDataCollectionField::PROPERTYID_LINK_DETAIL_PAGE_MOB];
$has_view = ilDataCollectionRecordViewViewdefinition::getIdByTableId($record_field->getRecord()->getTableId());
if (in_array($med->getSuffix(), array('jpg', 'jpeg', 'png', 'gif'))) {
// Image
$dir = ilObjMediaObject::_getDirectory($mob->getId());
$width = (int) $arr_properties[ilDataCollectionField::PROPERTYID_WIDTH];
$height = (int) $arr_properties[ilDataCollectionField::PROPERTYID_HEIGHT];
$html = ilUtil::img($dir . "/" . $med->location, '', $width, $height);
if ($is_linked_field and $has_view and $link) {
$ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $record_field->getRecord()->getId());
$html = '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord') . '">' . $html . '</a>';
}
} else {
// Video/Audio
$mpl = new ilMediaPlayerGUI($med->getId(), '');
$mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
$mpl->setMimeType($med->getFormat());
$mpl->setDisplayWidth((int) $arr_properties[ilDataCollectionField::PROPERTYID_WIDTH] . 'px');
$mpl->setDisplayHeight((int) $arr_properties[ilDataCollectionField::PROPERTYID_HEIGHT] . 'px');
$mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
$html = $mpl->getPreviewHtml();
if ($is_linked_field and $has_view) {
global $lng;
$ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $record_field->getRecord()->getId());
$html = $html . '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord') . '">' . $lng->txt('details') . '</a>';
}
}
break;
case self::INPUTFORMAT_BOOLEAN:
switch ($value) {
case 0:
$im = ilUtil::getImagePath('icon_not_ok.svg');
break;
case 1:
$im = ilUtil::getImagePath('icon_ok.svg');
break;
}
$html = "<img src='" . $im . "'>";
break;
case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
//Property URL
$arr_properties = $record_field->getField()->getProperties();
if ($arr_properties[ilDataCollectionField::PROPERTYID_URL]) {
$link = $value;
if (preg_match("/^[a-z0-9!#\$%&'*+=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\$/i", $value)) {
$value = "mailto:" . $value;
} elseif (!preg_match('~(^(news|(ht|f)tp(s?)\\://){1}\\S+)~i', $value)) {
return $link;
}
//.........这里部分代码省略.........