function resolveIntLinks() { // resolve normal internal links $xpc = xpath_new_context($this->dom); $path = "//IntLink"; $res =& xpath_eval($xpc, $path); for ($i = 0; $i < count($res->nodeset); $i++) { $target = $res->nodeset[$i]->get_attribute("Target"); $type = $res->nodeset[$i]->get_attribute("Type"); $new_target = ilInternalLink::_getIdForImportId($type, $target); if ($new_target !== false) { $res->nodeset[$i]->set_attribute("Target", $new_target); } else { if (ilInternalLink::_extractInstOfTarget($target) == IL_INST_ID && IL_INST_ID > 0 && $type != "RepositoryItem") { $new_target = ilInternalLink::_removeInstFromTarget($target); if (ilInternalLink::_exists($type, $new_target)) { $res->nodeset[$i]->set_attribute("Target", $new_target); } } } } unset($xpc); // resolve internal links in map areas $xpc = xpath_new_context($this->dom); $path = "//MediaAlias"; $res =& xpath_eval($xpc, $path); //echo "<br><b>page::resolve</b><br>"; //echo "Content:".htmlentities($this->getXMLFromDOM()).":<br>"; for ($i = 0; $i < count($res->nodeset); $i++) { $orig_id = $res->nodeset[$i]->get_attribute("OriginId"); $id_arr = explode("_", $orig_id); $mob_id = $id_arr[count($id_arr) - 1]; ilMediaItem::_resolveMapAreaLinks($mob_id); } }
function exportMediaFullscreen($a_target_dir, $pg_obj) { $subdir = "il_" . IL_INST_ID . "_mob_" . $this->getId(); $a_target_dir = $a_target_dir . "/objects/" . $subdir; ilUtil::makeDir($a_target_dir); $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule"); $tpl->setCurrentBlock("ilMedia"); //$int_links = $page_object->getInternalLinks(); $med_links = ilMediaItem::_getMapAreasIntLinks($this->getId()); // @todo //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets()); require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; //$media_obj = new ilObjMediaObject($_GET["mob_id"]); require_once "./Services/COPage/classes/class.ilPageObject.php"; $xml = "<dummy>"; // todo: we get always the first alias now (problem if mob is used multiple // times in page) $xml .= $pg_obj->getMediaAliasElement($this->getId()); $xml .= $this->getXML(IL_MODE_OUTPUT); //$xml.= $link_xml; $xml .= "</dummy>"; //die(htmlspecialchars($xml)); $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $xml, '/_xsl' => $xsl); $xh = xslt_create(); //echo "<b>XML:</b>".htmlentities($xml); // determine target frames for internal links $wb_path = ""; $enlarge_path = ""; $params = array('mode' => "fullscreen", 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => "", 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); //echo xslt_error($xh); xslt_free($xh); // unmask user html include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php"; $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "../../css/style.css"); $tpl->setVariable("LOCATION_STYLESHEET", "../../css/system.css"); $tpl->setVariable("MEDIA_CONTENT", $output); $output = $tpl->get(); //$output = preg_replace("/\/mobs\/mm_(\d+)\/([^\"]+)/i","$2",$output); $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "\$2", $output); $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "../../players", $output); $output = preg_replace("/\\.\\/" . str_replace("/", "\\/", ilPlayerUtil::getFlashVideoPlayerDirectory()) . "/i", "../../players", $output); $output = preg_replace("/file=..\\/..\\/..\\//i", "file=../objects/" . $subdir . "/", $output); //die(htmlspecialchars($output)); fwrite(fopen($a_target_dir . '/fullscreen.html', 'w'), $output); }
/** * show media object */ function media($a_mode = "media") { $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage"); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId())); //$int_links = $page_object->getInternalLinks(); $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]); // later //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets()); $link_xlm = ""; require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $media_obj =& new ilObjMediaObject($_GET["mob_id"]); $xml = "<dummy>"; // todo: we get always the first alias now (problem if mob is used multiple // times in page) $xml .= $media_obj->getXML(IL_MODE_ALIAS); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $xml, '/_xsl' => $xsl); $xh = xslt_create(); if (!$this->offlineMode()) { $enlarge_path = ilUtil::getImagePath("enlarge.png", false, "output"); $wb_path = ilUtil::getWebspaceDir("output") . "/"; } else { $enlarge_path = "images/enlarge.png"; $wb_path = ""; } $mode = $a_mode; $this->ctrl->setParameter($this, "obj_type", "MediaObject"); $fullscreen_link = $this->getLink($_GET["ref_id"], "fullscreen"); $this->ctrl->clearParameters($this); $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => $fullscreen_link, 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); echo xslt_error($xh); xslt_free($xh); // unmask user html $this->tpl->setVariable("MEDIA_CONTENT", $output); $this->tpl->parseCurrentBlock(); if ($this->offlineMode()) { $html = $this->tpl->get(); return $html; } }
/** * output media */ function ilMedia() { global $ilUser; $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); $this->renderPageTitle(); // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } $this->tpl->setCurrentBlock("ilMedia"); //$int_links = $page_object->getInternalLinks(); $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]); $link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets()); $link_xml .= $this->getLinkTargetsXML(); //echo "<br><br>".htmlentities($link_xml); require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $media_obj = new ilObjMediaObject($_GET["mob_id"]); if (!empty($_GET["pg_id"])) { require_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $pg_obj = $this->getLMPage($_GET["pg_id"]); $pg_obj->buildDom(); $xml = "<dummy>"; // todo: we get always the first alias now (problem if mob is used multiple // times in page) $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; } else { $xml = "<dummy>"; // todo: we get always the first alias now (problem if mob is used multiple // times in page) $xml .= $media_obj->getXML(IL_MODE_ALIAS); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; } //echo htmlentities($xml); exit; // todo: utf-header should be set globally //header('Content-type: text/html; charset=UTF-8'); $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $xml, '/_xsl' => $xsl); $xh = xslt_create(); //echo "<b>XML:</b>".htmlentities($xml); // determine target frames for internal links //$pg_frame = $_GET["frame"]; if (!$this->offlineMode()) { $wb_path = ilUtil::getWebspaceDir("output") . "/"; } else { $wb_path = ""; } $mode = $_GET["cmd"] == "fullscreen" ? "fullscreen" : "media"; $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output", $this->offlineMode()); $fullscreen_link = $this->getLink($this->lm->getRefId(), "fullscreen"); $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $this->lm->getRefId(), 'fullscreen_link' => $fullscreen_link, 'ref_id' => $this->lm->getRefId(), 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); echo xslt_error($xh); xslt_free($xh); // unmask user html $this->tpl->setVariable("MEDIA_CONTENT", $output); // add js include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; ilObjMediaObjectGUI::includePresentationJS($this->tpl); }
/** * Convert file object * * @param * @return */ function convertFileObject() { 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()); $target_purpose = ilUtil::stripSlashes($_POST["target_purpose"]); $target_format = ilUtil::stripSlashes($_POST["target_format"]); try { include_once "./Services/MediaObjects/classes/class.ilFFmpeg.php"; $med = $mob->getMediaItem("Standard"); $mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation(); $new_file = ilFFmpeg::convert($mob_file, $target_format); $ret = ilFFmpeg::getLastReturnValues(); $pi = pathinfo($new_file); $med = $mob->getMediaItem($target_purpose); if (!is_object($med)) { $med = new ilMediaItem(); $med->setMobId($mob->getId()); $mob->addMediaItem($med); $mob->update(); $med->setPurpose($target_purpose); } $med->setFormat($target_format); $med->setLocation($pi["basename"]); $med->setLocationType("LocalFile"); $med->update(); $add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : ""; ilUtil::sendInfo($this->lng->txt("mcst_converted_file") . $add, true); } catch (ilException $e) { $ret = ilFFmpeg::getLastReturnValues(); $add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : ""; ilUtil::sendFailure($e->getMessage() . $add, true); } $ilCtrl->redirect($this, "editCastItem"); }
function ilObjectFeedWriter($a_ref_id, $a_userid = false, $a_purpose = false) { global $ilSetting, $lng; parent::ilFeedWriter(); if ($a_ref_id <= 0) { return; } include_once "./Services/Block/classes/class.ilBlockSetting.php"; $news_set = new ilSetting("news"); if (!$news_set->get("enable_rss_for_internal")) { return; } $obj_id = ilObject::_lookupObjId($a_ref_id); $obj_type = ilObject::_lookupType($obj_id); $obj_title = ilObject::_lookupTitle($obj_id); if (!ilBlockSetting::_lookup("news", "public_feed", 0, $obj_id)) { return; } if ($ilSetting->get('short_inst_name') != "") { $this->setChannelTitle($ilSetting->get('short_inst_name') . " - " . $this->prepareStr($loc . $obj_title)); } else { $this->setChannelTitle("ILIAS" . " - " . $this->prepareStr($loc . $obj_title . ($a_purpose ? " - " . $a_purpose : ""))); } $this->setChannelAbout(ILIAS_HTTP_PATH); $this->setChannelLink(ILIAS_HTTP_PATH); // not nice, to do: general solution if ($obj_type == "mcst") { include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php"; if (!ilObjMediaCastAccess::_lookupOnline($obj_id)) { $lng->loadLanguageModule("mcst"); $feed_item = new ilFeedItem(); $feed_item->setTitle($lng->txt("mcst_media_cast_not_online")); $feed_item->setDescription($lng->txt("mcst_media_cast_not_online_text")); $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"]); $this->addItem($feed_item); return; } } include_once "./Services/Locator/classes/class.ilLocatorGUI.php"; $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($a_ref_id, true); $cont_loc->setTextOnly(true); $loc = $cont_loc->getTextVersion(); if (trim($loc) != "") { $loc = " [" . $loc . "] "; } $rss_period = ilNewsItem::_lookupRSSPeriod(); ilNewsItem::setPrivateFeedId($a_userid); $news_item = new ilNewsItem(); $news_item->setContextObjId($obj_id); $news_item->setContextObjType($obj_type); $items = $news_item->getNewsForRefId($a_ref_id, true, false, $rss_period, true); if ($a_purpose) { include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; } $i = 0; foreach ($items as $item) { $i++; if ($a_purpose != false && $obj_type == "mcst") { $mob = ilMediaItem::_getMediaItemsOfMObId($item[mob_id], $a_purpose); if ($mob == false) { continue; } } $obj_title = ilObject::_lookupTitle($item["context_obj_id"]); $feed_item = new ilFeedItem(); $title = ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]); // path $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($item["ref_id"], true, $a_ref_id); $cont_loc->setTextOnly(true); $loc = $cont_loc->getHTML(); if (trim($loc) != "") { $loc = "[" . $loc . "]"; } if ($news_set->get("rss_title_format") == "news_obj") { $sep = trim($this->prepareStr($loc)) == "" ? "" : " "; $feed_item->setTitle($this->prepareStr($title) . " (" . $this->prepareStr($loc) . $sep . $this->prepareStr($obj_title) . ")"); } else { $feed_item->setTitle($this->prepareStr($loc) . " " . $this->prepareStr($obj_title) . ": " . $this->prepareStr($title)); } $feed_item->setDescription($this->prepareStr(nl2br(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"])))); // lm hack, not nice if (in_array($item["context_obj_type"], array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) { $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"]); } else { if ($item["context_obj_type"] == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) { include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]); $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $wptitle); } else { if (in_array($item["context_obj_type"], array("frm")) && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) { // frm hack, not nice include_once "./Modules/Forum/classes/class.ilObjForumAccess.php"; $thread_id = ilObjForumAccess::_getThreadForPosting($item["context_sub_obj_id"]); if ($thread_id > 0) { $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $thread_id . "_" . $item["context_sub_obj_id"]); } else { $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"]); } } else { $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&target=" . $item["context_obj_type"] . "_" . $item["ref_id"]); //echo "<br>".ILIAS_HTTP_PATH."/goto.php?client_id=".CLIENT_ID. // "&target=".$item["context_obj_type"]."_".$item["ref_id"]; } } } $feed_item->setAbout($feed_item->getLink() . "&il_about_feed=" . $item["id"]); $feed_item->setDate($item["creation_date"]); // Enclosure if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) { $go_on = true; if ($obj_type == "mcst") { include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php"; if (!ilObjMediaCastAccess::_lookupPublicFiles($obj_id)) { $go_on = false; } } if ($go_on) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $url = ilObjMediaObject::_lookupItemPath($item["mob_id"], true, true, $mob["purpose"]); $file = ilObjMediaObject::_lookupItemPath($item["mob_id"], false, false, $mob["purpose"]); if (is_file($file)) { $size = filesize($file); } $feed_item->setEnclosureUrl($url); $feed_item->setEnclosureType(isset($mob["format"]) ? $mob["format"] : "audio/mpeg"); $feed_item->setEnclosureLength($size); } } $this->addItem($feed_item); } }
/** * Display media */ function displayMedia($a_fullscreen = false) { $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule"); $tpl->setCurrentBlock("ilMedia"); //$int_links = $page_object->getInternalLinks(); $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]); // @todo //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets()); require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $media_obj = new ilObjMediaObject($_GET["mob_id"]); require_once "./Services/COPage/classes/class.ilPageObject.php"; $pg_obj = $this->getPageObject(); $pg_obj->buildDom(); if (!empty($_GET["pg_id"])) { $xml = "<dummy>"; $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; } else { $xml = "<dummy>"; $xml .= $media_obj->getXML(IL_MODE_ALIAS); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; } $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $xml, '/_xsl' => $xsl); $xh = xslt_create(); $mode = "media"; if ($a_fullscreen) { $mode = "fullscreen"; } //echo "<b>XML:</b>".htmlentities($xml); // determine target frames for internal links $wb_path = ilUtil::getWebspaceDir("output") . "/"; $enlarge_path = ilUtil::getImagePath("enlarge.svg"); $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => "", 'ref_id' => $_GET["ref_id"], 'webspace_path' => $wb_path); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); //echo "<br><br>".htmlentities($output); //echo xslt_error($xh); xslt_free($xh); // unmask user html $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $tpl->setVariable("MEDIA_CONTENT", $output); echo $tpl->get(); exit; }
/** * parse pages that contain files, mobs and/or internal links */ function processPagesToParse() { /* $pg_mapping = array(); foreach($this->pg_mapping as $key => $value) { $pg_mapping[$key] = "il__pg_".$value; }*/ //echo "<br><b>processIntLinks</b>"; flush(); // outgoin internal links foreach ($this->pages_to_parse as $page_id) { $page_arr = explode(":", $page_id); //echo "<br>resolve:".$this->content_object->getType().":".$page_id; flush(); switch ($page_arr[0]) { case "lm": $page_obj =& new ilPageObject($this->content_object->getType(), $page_arr[1]); break; case "gdf": $page_obj =& new ilPageObject("gdf", $page_arr[1]); break; } $page_obj->buildDom(); $page_obj->resolveIntLinks(); $page_obj->resolveIIMMediaAliases($this->mob_mapping); if (in_array($this->coType, array("lm", "dbk"))) { $page_obj->resolveQuestionReferences($this->qst_mapping); } $page_obj->update(false); if ($page_arr[0] == "gdf") { $def =& new ilGlossaryDefinition($page_arr[1]); $def->updateShortText(); } unset($page_obj); } //echo "<br><b>map area internal links</b>"; flush(); // outgoins map area (mob) internal links foreach ($this->mobs_with_int_links as $mob_id) { ilMediaItem::_resolveMapAreaLinks($mob_id); } //echo "<br><b>incoming interna links</b>"; flush(); // incoming internal links $done = array(); foreach ($this->link_targets as $link_target) { //echo "doin link target:".$link_target.":<br>"; $link_arr = explode("_", $link_target); $target_inst = $link_arr[1]; $target_type = $link_arr[2]; $target_id = $link_arr[3]; $sources = ilInternalLink::_getSourcesOfTarget($target_type, $target_id, $target_inst); foreach ($sources as $key => $source) { //echo "got source:".$key.":<br>"; if (in_array($key, $done)) { continue; } $type_arr = explode(":", $source["type"]); // content object pages if ($type_arr[1] == "pg") { $page_object = new ilPageObject($type_arr[0], $source["id"]); $page_object->buildDom(); $page_object->resolveIntLinks(); $page_object->update(); unset($page_object); } // eventually correct links in questions to learning modules if ($type_arr[0] == "qst") { require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; assQuestion::_resolveIntLinks($source["id"]); } // eventually correct links in survey questions to learning modules if ($type_arr[0] == "sqst") { require_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; SurveyQuestion::_resolveIntLinks($source["id"]); } $done[$key] = $key; } } }
/** * show media object */ function showMedia() { global $ilAccess; if (!$ilAccess->checkAccess("read", "", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage"); include_once "Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); //$int_links = $page_object->getInternalLinks(); $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]); // later //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets()); $link_xlm = ""; require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; require_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; ilObjMediaObjectGUI::includePresentationJS($this->tpl); $media_obj =& new ilObjMediaObject($_GET["mob_id"]); $xml = "<dummy>"; // todo: we get always the first alias now (problem if mob is used multiple // times in page) $xml .= $media_obj->getXML(IL_MODE_ALIAS); $xml .= $media_obj->getXML(IL_MODE_OUTPUT); $xml .= $link_xml; $xml .= "</dummy>"; $xsl = file_get_contents("./Services/COPage/xsl/page.xsl"); $args = array('/_xml' => $xml, '/_xsl' => $xsl); $xh = xslt_create(); $wb_path = ilUtil::getWebspaceDir("output") . "/"; $mode = $_GET["cmd"] != "showMedia" ? "fullscreen" : "media"; $enlarge_path = ilUtil::getImagePath("enlarge.png", false, "output"); $fullscreen_link = $this->ctrl->getLinkTarget($this, "showFullscreen", "", false, false); $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => $fullscreen_link, 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); echo xslt_error($xh); xslt_free($xh); // unmask user html $this->tpl->setVariable("MEDIA_CONTENT", $output); }
/** * Creates the media object for the updateFloorPlanInfosWithFile and addFloorPlan function. * * @param string $a_title * @param string $a_desc * @param string $a_file_id * * @return ilObjMediaObject */ private function createMediaObject($a_title, $a_desc, $a_file_id = NULL) { if (is_null($a_file_id)) { $mediaObj = $this->getMediaObjectInstance(); $mediaObj->create(); } else { $mediaObj = $this->getMediaObjectInstance($a_file_id); } $mediaObj->setTitle($a_title); $mediaObj->removeAllMediaItems(); $media_item = new ilMediaItem(); $media_item->setPurpose("Standard"); $media_item->setCaption($a_desc); $mediaObj->addMediaItem($media_item); return $mediaObj; }
/** * Get areas for a certain target */ static function _getMobsForTarget($a_type, $a_target) { global $ilDB; $q = "SELECT * FROM map_area WHERE " . " link_type = " . $ilDB->quote($a_type, "text") . " AND target = " . $ilDB->quote($a_target, "text"); $set = $ilDB->query($q); $mobs = array(); while ($rec = $ilDB->fetchAssoc($set)) { $mob_id = ilMediaItem::_lookupMobId($rec["item_id"]); $mobs[$mob_id] = $mob_id; } return $mobs; }
/** * Import record * * @param * @return */ function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version) { //echo $a_entity; //var_dump($a_rec); switch ($a_entity) { case "mob": //var_dump($a_rec); include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $newObj = new ilObjMediaObject(); $newObj->setType("mob"); $newObj->setTitle($a_rec["Title"]); $newObj->setDescription($a_rec["Description"]); $newObj->create(); $newObj->createDirectory(); ilObjMediaObject::_createThumbnailDirectory($newObj->getId()); $this->current_mob = $newObj; $dir = str_replace("..", "", $a_rec["Dir"]); if ($dir != "" && $this->getImportDirectory() != "") { $source_dir = $this->getImportDirectory() . "/" . $dir; $target_dir = $dir = ilObjMediaObject::_getDirectory($newObj->getId()); ilUtil::rCopy($source_dir, $target_dir); } $a_mapping->addMapping("Services/MediaObjects", "mob", $a_rec["Id"], $newObj->getId()); //echo "<br>++add++"."0:".$a_rec["Id"].":mob+0:".$newObj->getId().":mob"."+"; $a_mapping->addMapping("Services/MetaData", "md", "0:" . $a_rec["Id"] . ":mob", "0:" . $newObj->getId() . ":mob"); break; case "mob_media_item": // determine parent mob include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; $mob_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]); if (is_object($this->current_mob) && $this->current_mob->getId() == $mob_id) { $mob = $this->current_mob; } else { $mob = new ilObjMediaObject($mob_id); } include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; $newObj = new ilMediaItem(); $newObj->setMobId($mob_id); $newObj->setWidth($a_rec["Width"]); $newObj->setHeight($a_rec["Height"]); $newObj->setCaption($a_rec["Caption"]); $newObj->setNr($a_rec["Nr"]); $newObj->setPurpose($a_rec["Purpose"]); $newObj->setLocation($a_rec["Location"]); $newObj->setLocationType($a_rec["LocationType"]); $newObj->setFormat($a_rec["Format"]); $newObj->setTextRepresentation($a_rec["TextRepresentation"]); $newObj->create(); $this->current_media_item = $newObj; $a_mapping->addMapping("Services/MediaObjects", "mob_media_item", $a_rec["Id"], $newObj->getId()); break; case "mob_mi_parameter": // get media item include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; $med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]); if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) { $med = $this->current_media_item; } else { $med = new ilMediaItem($med_id); } $med->writeParameter($a_rec["Name"], $a_rec["Value"]); break; case "mob_mi_map_area": // get media item include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; $med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]); if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) { $med = $this->current_media_item; } else { $med = new ilMediaItem($med_id); } include_once "./Services/MediaObjects/classes/class.ilMapArea.php"; $map_area = new ilMapArea(); $map_area->setItemId($med_id); $map_area->setNr($a_rec["Nr"]); $map_area->setShape($a_rec["Shape"]); $map_area->setCoords($a_rec["Coords"]); $map_area->setLinkType($a_rec["LinkType"]); $map_area->setTitle($a_rec["Title"]); $map_area->setHref($a_rec["Href"]); $map_area->setTarget($a_rec["Target"]); $map_area->setType($a_rec["Type"]); $map_area->setTargetFrame($a_rec["TargetFrame"]); $map_area->setHighlightMode($a_rec["HighlightMode"]); $map_area->setHighlightClass($a_rec["HighlightClass"]); $map_area->create(); break; } }