function getInternalLinks($a_cnt_multiple = false) { // get all internal links of the page $xpc = xpath_new_context($this->dom); $path = "//IntLink"; $res = xpath_eval($xpc, $path); $links = array(); $cnt_multiple = 1; for ($i = 0; $i < count($res->nodeset); $i++) { $add = ""; if ($a_cnt_multiple) { $add = ":" . $cnt_multiple; } $target = $res->nodeset[$i]->get_attribute("Target"); $type = $res->nodeset[$i]->get_attribute("Type"); $targetframe = $res->nodeset[$i]->get_attribute("TargetFrame"); $anchor = $res->nodeset[$i]->get_attribute("Anchor"); $links[$target . ":" . $type . ":" . $targetframe . ":" . $anchor . $add] = array("Target" => $target, "Type" => $type, "TargetFrame" => $targetframe, "Anchor" => $anchor); // get links (image map areas) for inline media objects if ($type == "MediaObject" && $targetframe == "") { if (substr($target, 0, 4) == "il__") { $id_arr = explode("_", $target); $id = $id_arr[count($id_arr) - 1]; $med_links = ilMediaItem::_getMapAreasIntLinks($id); foreach ($med_links as $key => $med_link) { $links[$key] = $med_link; } } } //echo "<br>-:".$target.":".$type.":".$targetframe.":-"; $cnt_multiple++; } unset($xpc); // get all media aliases $xpc = xpath_new_context($this->dom); $path = "//MediaAlias"; $res =& xpath_eval($xpc, $path); require_once "Services/MediaObjects/classes/class.ilMediaItem.php"; for ($i = 0; $i < count($res->nodeset); $i++) { $oid = $res->nodeset[$i]->get_attribute("OriginId"); if (substr($oid, 0, 4) == "il__") { $id_arr = explode("_", $oid); $id = $id_arr[count($id_arr) - 1]; $med_links = ilMediaItem::_getMapAreasIntLinks($id); foreach ($med_links as $key => $med_link) { $links[$key] = $med_link; } } } unset($xpc); return $links; }
/** * 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; } }
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); }
/** * 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); }
/** * 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; }
/** * 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); }