本文整理汇总了PHP中ilObjMediaObject::hasPurposeItem方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::hasPurposeItem方法的具体用法?PHP ilObjMediaObject::hasPurposeItem怎么用?PHP ilObjMediaObject::hasPurposeItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::hasPurposeItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFeedIconsHTML
/**
* Get feed icons HTML
*
* @param
* @return
*/
function getFeedIconsHTML()
{
global $lng;
$html = "";
include_once "./Services/Block/classes/class.ilBlockSetting.php";
$public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
// rss icon/link
if ($public_feed) {
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss) {
// create dummy object in db (we need an id)
$items = $this->object->getItemsArray();
include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
$html = "";
foreach (ilObjMediaCast::$purposes as $purpose) {
foreach ($items as $id => $item) {
$mob = new ilObjMediaObject($item["mob_id"]);
$mob->read();
if ($mob->hasPurposeItem($purpose)) {
if ($html == "") {
$html = " ";
}
$url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose={$purpose}";
$title = $lng->txt("news_feed_url");
$icon = ilUtil::getImagePath("rss_icon_" . strtolower($purpose) . ".png");
$target = "_blank";
$row1 .= "<A href='{$url}' target='{$target}'><img src='{$icon}' alt='{$title}'/></A>";
if ($this->object->getPublicFiles()) {
$url = preg_replace("/https?/i", "itpc", $url);
$title = $lng->txt("news_feed_url");
$icon = ilUtil::getImagePath("itunes_icon.png");
$row2 .= "<A href='{$url}' target='{$target}'><img src='{$icon}' alt='{$title}'/></A>";
}
break;
}
}
}
if ($html != "") {
$html .= $row1;
if ($row2 != "") {
$html .= " " . $row2;
}
}
}
}
return $html;
}
示例2: deliverMobFile
/**
* Deliver mob file
*
* @param
* @return
*/
function deliverMobFile($a_purpose = "Standard", $a_increase_download_cnt = false)
{
$mob = $this->getMobId();
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
$mob = new ilObjMediaObject($mob);
$mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
// check purpose
if (!$mob->hasPurposeItem($a_purpose)) {
return false;
}
$m_item = $mob->getMediaItem($a_purpose);
if ($m_item->getLocationType() != "Reference") {
$file = $mob_dir . "/" . $m_item->getLocation();
if (file_exists($file) && is_file($file)) {
if ($a_increase_download_cnt) {
$this->increaseDownloadCounter();
}
ilUtil::deliverFile($file, $m_item->getLocation());
} else {
ilUtil::sendFailure("File not found!", true);
return false;
}
} else {
if ($a_increase_download_cnt) {
$this->increaseDownloadCounter();
}
ilUtil::redirect($m_item->getLocation());
}
}
示例3: getFeedIconsHTML
/**
* Get feed icons HTML
*
* @param
* @return
*/
function getFeedIconsHTML()
{
global $lng;
$html = "";
include_once "./Services/Block/classes/class.ilBlockSetting.php";
$public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
// rss icon/link
if ($public_feed) {
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss) {
// create dummy object in db (we need an id)
$items = $this->object->getItemsArray();
include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
$html = "";
foreach (ilObjMediaCast::$purposes as $purpose) {
foreach ($items as $id => $item) {
$mob = new ilObjMediaObject($item["mob_id"]);
$mob->read();
if ($mob->hasPurposeItem($purpose)) {
if ($html == "") {
$html = " ";
}
$url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose={$purpose}";
$title = $lng->txt("news_feed_url");
include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
switch (strtolower($purpose)) {
case "audioportable":
$type1 = ilRSSButtonGUI::ICON_RSS_AUDIO;
$type2 = ilRSSButtonGUI::ICON_ITUNES_AUDIO;
break;
case "videoportable":
$type1 = ilRSSButtonGUI::ICON_RSS_VIDEO;
$type2 = ilRSSButtonGUI::ICON_ITUNES_VIDEO;
break;
default:
$type1 = ilRSSButtonGUI::ICON_RSS;
$type2 = ilRSSButtonGUI::ICON_ITUNES;
break;
}
$row1 .= " " . ilRSSButtonGUI::get($type1, $url);
if ($this->object->getPublicFiles()) {
$url = preg_replace("/https?/i", "itpc", $url);
$title = $lng->txt("news_feed_url");
include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
$row2 .= " " . ilRSSButtonGUI::get($type2, $url);
}
break;
}
}
}
if ($html != "") {
$html .= $row1;
if ($row2 != "") {
$html .= $row2;
}
}
}
}
return $html;
}