/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; if ($a_set["type"] == "mob") { // output thumbnail $mob = new ilObjMediaObject($a_set["id"]); $med = $mob->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); if ($target != "") { $this->tpl->setCurrentBlock("thumbnail"); $this->tpl->setVariable("IMG_THUMB", $target); $this->tpl->parseCurrentBlock(); } } else { if ($a_set["type"] == "incl") { $this->tpl->setCurrentBlock("thumbnail"); $this->tpl->setVariable("IMG_THUMB", ilUtil::getImagePath("icon_pg.svg")); $this->tpl->parseCurrentBlock(); } } // allow editing of media objects if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob") { // output edit link $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]); $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]); $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilObjMediaObjectGUI", "edit", array("ilEditClipboardGUI"))); $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] . " [" . $a_set["id"] . "]"); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("show"); $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"] . " [" . $a_set["id"] . "]"); $this->tpl->parseCurrentBlock(); } include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; if ($a_set["type"] == "mob") { $this->tpl->setVariable("MEDIA_INFO", ilObjMediaObjectGUI::_getMediaInfoHTML($mob)); } $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; $this->tpl->setCurrentBlock("link"); switch ($a_set["type"]) { case "fold": $this->tpl->setVariable("TXT_TITLE", $a_set["title"]); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set["obj_id"]); $this->tpl->setVariable("LINK_VIEW", $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd)); $this->tpl->parseCurrentBlock(); if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set["obj_id"]); $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTarget($this->parent_obj, "editFolder")); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $_GET[$this->folder_par]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".svg"))); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder); break; case "pg": if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_SINGLE) { $this->tpl->setVariable("TXT_NO_LINK_TITLE", $a_set["title"]); } else { $this->tpl->setVariable("ONCLICK", "il.MediaPool.preview('" . $a_set["child"] . "'); return false;"); $this->tpl->setVariable("TXT_TITLE", $a_set["title"]); $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $a_set["child"]); } if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $a_set["child"]); $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilmediapoolpagegui", "edit")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_pg.svg"))); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder); break; case "mob": $this->tpl->setVariable("ONCLICK", "il.MediaPool.preview('" . $a_set["child"] . "'); return false;"); $this->tpl->setVariable("TXT_TITLE", $a_set["title"]); $ilCtrl->setParameterByClass("ilobjmediaobjectgui", "mepitem_id", $a_set["child"]); $ilCtrl->setParameter($this->parent_obj, "mob_id", $a_set["foreign_id"]); // edit link if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) { $this->tpl->setCurrentBlock("edit"); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("link"); $this->tpl->setCurrentBlock("tbl_content"); // output thumbnail (or mob icon) if (ilObject::_lookupType($a_set["foreign_id"]) == "mob") { $mob = new ilObjMediaObject($a_set["foreign_id"]); $med = $mob->getMediaItem("Standard"); $target = ""; if ($med) { $target = $med->getThumbnailTarget(); } if ($target != "") { $this->tpl->setVariable("IMG", ilUtil::img($target)); } else { $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".svg"))); } if ($med && ilUtil::deducibleSize($med->getFormat()) && $med->getLocationType() == "Reference") { $size = @getimagesize($med->getLocation()); if ($size[0] > 0 && $size[1] > 0) { $wr = $size[0] / 80; $hr = $size[1] / 80; $r = max($wr, hr); $w = (int) ($size[0] / $r); $h = (int) ($size[1] / $r); $this->tpl->setVariable("IMG", ilUtil::img($med->getLocation(), "", $w, $h)); } } // output media info include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; $this->tpl->setVariable("MEDIA_INFO", ilObjMediaObjectGUI::_getMediaInfoHTML($mob)); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder); } break; } if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId())) { if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT && $a_set["type"] == "mob" || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_CONTENT && $a_set["type"] == "pg") { $this->tpl->setCurrentBlock("chbox"); $this->tpl->setVariable("CHECKBOX_ID", $a_set["child"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_content"); } else { if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_SINGLE && $a_set["type"] == "mob") { $this->tpl->setCurrentBlock("radio"); $this->tpl->setVariable("RADIO_ID", $a_set["child"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_content"); } } } }
protected function getFirstMediaObjectAsTag($a_width = 144, $a_height = 144, $a_export_directory = null) { $this->obj->buildDom(); $mob_ids = $this->obj->collectMediaObjects(); if ($mob_ids) { require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; foreach ($mob_ids as $mob_id) { $mob_obj = new ilObjMediaObject($mob_id); $mob_item = $mob_obj->getMediaItem("Standard"); if (stristr($mob_item->getFormat(), "image")) { $mob_size = $mob_item->getOriginalSize(); if ($mob_size["width"] >= $a_width || $mob_size["height"] >= $a_height) { if (!$a_export_directory) { $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId()); } else { // see ilCOPageHTMLExport::exportHTMLMOB() $mob_dir = "./mobs/mm_" . $mob_obj->getId(); } $mob_res = self::parseImage($mob_size["width"], $mob_size["height"], $a_width, $a_height); return '<img' . ' src="' . $mob_dir . "/" . $mob_item->getLocation() . '"' . ' width="' . $mob_res[0] . '"' . ' height="' . $mob_res[1] . '"' . ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' . ' />'; } } } } }
/** * 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()); } }
/** * 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"); }
/** * show print view */ function showPrintView() { global $ilUser, $lng, $ilCtrl; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (!$this->lm->isActivePrintView()) { return; } $this->renderPageTitle(); $c_obj_id = $this->getCurrentPageId(); // set values according to selection if ($_POST["sel_type"] == "page") { if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) { $_POST["obj_id"][] = $c_obj_id; } } if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) { $path = $this->lm_tree->getPathFull($c_obj_id); $chap_id = $path[1]["child"]; if ($chap_id > 0) { $_POST["obj_id"][] = $chap_id; } } //var_dump($_GET); //var_dump($_POST); // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } // content style $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(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true); // set title header $this->tpl->setVariable("HEADER", $this->lm->getTitle()); $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId())); include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php"; include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; include_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; $act_level = 99999; $activated = false; $glossary_links = array(); $output_header = false; $media_links = array(); // get header and footer if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getFooterPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $footer_page_content = $page_object_gui->showPage(); } } if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getHeaderPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $header_page_content = $page_object_gui->showPage(); } } // add free selected pages if (is_array($_POST["obj_id"])) { foreach ($_POST["obj_id"] as $k) { if ($k > 0 && !$this->lm_tree->isInTree($k)) { if (ilLMObject::_lookupType($k) == "pg") { $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true); } } } } else { ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true); $ilCtrl->redirect($this, "showPrintViewSelection"); } foreach ($nodes as $node_key => $node) { // check page activation $active = ilLMPage::_lookupActive($node["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($node["type"] == "pg" && !$active) { continue; } // print all subchapters/subpages if higher chapter // has been selected if ($node["depth"] <= $act_level) { if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) { $act_level = $node["depth"]; $activated = true; } else { $act_level = 99999; $activated = false; } } if ($activated && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) { // output learning module header if ($node["type"] == "du") { $output_header = true; } // output chapter title if ($node["type"] == "st") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $chap = new ilStructureObject($this->lm, $node["obj_id"]); $this->tpl->setCurrentBlock("print_chapter"); $chapter_title = $chap->_getPresentationTitle($node["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang); $this->tpl->setVariable("CHAP_TITLE", $chapter_title); if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($nodes[$node_key + 1]["type"] == "pg") { $this->tpl->setVariable("CHAP_HEADER", $header_page_content); $did_chap_page_header = true; } } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); } // output page if ($node["type"] == "pg") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $this->tpl->setCurrentBlock("print_item"); // get page $page_id = $node["obj_id"]; $page_object_gui = $this->getLMPageGUI($page_id); $page_object = $page_object_gui->getPageObject(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // get lm page $lm_pg_obj = new ilLMPageObject($this->lm, $page_id); $lm_pg_obj->setLMId($this->lm->getId()); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) { $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); // prevent page title after chapter title // that have the same content if ($this->lm->isActiveNumbering()) { $chapter_title = trim(substr($chapter_title, strpos($chapter_title, " "))); } if ($page_title != $chapter_title) { $page_object_gui->setPresentationTitle($page_title); } } // handle header / footer $hcont = $header_page_content; $fcont = $footer_page_content; if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($did_chap_page_header) { $hcont = ""; } if ($nodes[$node_key + 1]["type"] == "pg" && !($nodes[$node_key + 1]["depth"] <= $act_level && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) { $fcont = ""; } } $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $page_content = $page_object_gui->showPage(); if ($this->lm->getPageHeader() != IL_PAGE_TITLE) { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont); } else { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont . "<br />"); } $chapter_title = ""; $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); // get internal links $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]); $got_mobs = false; foreach ($int_links as $key => $link) { if ($link["type"] == "git" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $glossary_links[$key] = $link; } if ($link["type"] == "mob" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $got_mobs = true; $mob_links[$key] = $link; } } // this is not cool because of performance reasons // unfortunately the int link table does not // store the target frame (we want to append all linked // images but not inline images (i.e. mobs with no target // frame)) if ($got_mobs) { $page_object->buildDom(); $links = $page_object->getInternalLinks(); foreach ($links as $link) { if ($link["Type"] == "MediaObject" && $link["TargetFrame"] != "" && $link["TargetFrame"] != "None") { $media_links[] = $link; } } } } } } $annex_cnt = 0; $annexes = array(); // glossary if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) { include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; // sort terms $terms = array(); foreach ($glossary_links as $key => $link) { $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]); $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term); } $terms = ilUtil::sortArray($terms, "term", "asc"); //ksort($terms); foreach ($terms as $t) { $link = $t["link"]; $key = $t["key"]; $defs = ilGlossaryDefinition::getDefinitionList($link["id"]); $def_cnt = 1; // output all definitions of term foreach ($defs as $def) { // definition + number, if more than 1 definition if (count($defs) > 1) { $this->tpl->setCurrentBlock("def_title"); $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . $def_cnt++); $this->tpl->parseCurrentBlock(); } include_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php"; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setTemplateOutput(false); $page_gui->setOutputMode("print"); $this->tpl->setCurrentBlock("definition"); $page_gui->setFileDownloadLink("#"); $page_gui->setFullscreenLink("#"); $page_gui->setSourceCodeDownloadScript("#"); $output = $page_gui->showPage(); $this->tpl->setVariable("VAL_DEFINITION", $output); $this->tpl->parseCurrentBlock(); } // output term $this->tpl->setCurrentBlock("term"); $this->tpl->setVariable("VAL_TERM", $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])); $this->tpl->parseCurrentBlock(); } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("glossary"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo"); $this->tpl->setVariable("TXT_GLOSSARY", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // referenced images if (count($media_links) > 0) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; foreach ($media_links as $media) { if (substr($media["Target"], 0, 4) == "il__") { $arr = explode("_", $media["Target"]); $id = $arr[count($arr) - 1]; $med_obj = new ilObjMediaObject($id); $med_item = $med_obj->getMediaItem("Standard"); if (is_object($med_item)) { if (is_int(strpos($med_item->getFormat(), "image"))) { $this->tpl->setCurrentBlock("ref_image"); // image source if ($med_item->getLocationType() == "LocalFile") { $this->tpl->setVariable("IMG_SOURCE", ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id . "/" . $med_item->getLocation()); } else { $this->tpl->setVariable("IMG_SOURCE", $med_item->getLocation()); } if ($med_item->getCaption() != "") { $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption()); } else { $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle()); } $this->tpl->parseCurrentBlock(); } } } } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("ref_images"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images"); $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // output learning module title and toc if ($output_header) { $this->tpl->setCurrentBlock("print_header"); $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle()); if ($this->lm->getDescription() != "none") { include_once "Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); $md_gen = $md->getGeneral(); foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); } $this->tpl->setVariable("LM_DESCRIPTION", $description); } $this->tpl->parseCurrentBlock(); // output toc $nodes2 = $nodes; foreach ($nodes2 as $node2) { if ($node2["type"] == "st" && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) { for ($j = 1; $j < $node2["depth"]; $j++) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", ilStructureObject::_getPresentationTitle($node2["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang)); $this->tpl->parseCurrentBlock(); } } // annexes foreach ($annexes as $annex) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", $annex); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc"); $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_start_block"); $this->tpl->parseCurrentBlock(); } // output author information include_once 'Services/MetaData/classes/class.ilMD.php'; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); if (is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach ($ids = $lifecycle->getContributeIds() as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author . $sep . $md_ent->getEntity(); $sep = ", "; } } } if ($author != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("author"); $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author")); $this->tpl->setVariable("LM_AUTHOR", $author); $this->tpl->parseCurrentBlock(); } } // output copyright information if (is_object($md_rights = $md->getRights())) { $copyright = $md_rights->getDescription(); include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($copyright); if ($copyright != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("copyright"); $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright")); $this->tpl->setVariable("LM_COPYRIGHT", $copyright); $this->tpl->parseCurrentBlock(); } } $this->tpl->show(false); }
/** * Populates the title and description in the row * * @param ilObjMediaObject $a_mediaObject the media object * @param string $a_title the title */ private function fillRowTitleAndDescription($a_mediaObject, $a_title) { $this->tpl->setVariable('TXT_TITLE', $a_title); $this->tpl->setVariable('TXT_DESCRIPTION', $a_mediaObject->getMediaItem("Standard")->getCaption()); }
function moveIntLinks($a_from_to) { $this->buildDom(); $changed = false; // 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"); $obj_id = ilInternalLink::_extractObjIdOfTarget($target); if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, "__"))) { if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") { $res->nodeset[$i]->set_attribute("Target", "il__pg_" . $a_from_to[$obj_id]); $changed = true; } if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") { $res->nodeset[$i]->set_attribute("Target", "il__st_" . $a_from_to[$obj_id]); $changed = true; } } } unset($xpc); // map areas $this->addHierIDs(); $xpc = xpath_new_context($this->dom); $path = "//MediaAlias"; $res =& xpath_eval($xpc, $path); require_once "Services/MediaObjects/classes/class.ilMediaItem.php"; require_once "Services/COPage/classes/class.ilMediaAliasItem.php"; for ($i = 0; $i < count($res->nodeset); $i++) { $media_object_node = $res->nodeset[$i]->parent_node(); $page_content_node = $media_object_node->parent_node(); $c_hier_id = $page_content_node->get_attribute("HierId"); // first check, wheter we got instance map areas -> take these $std_alias_item = new ilMediaAliasItem($this->dom, $c_hier_id, "Standard"); $areas = $std_alias_item->getMapAreas(); $correction_needed = false; if (count($areas) > 0) { // check if correction needed foreach ($areas as $area) { if ($area["Type"] == "PageObject" || $area["Type"] == "StructureObject") { $t = $area["Target"]; $tid = _extractObjIdOfTarget($t); if ($a_from_to[$tid] > 0) { $correction_needed = true; } } } } else { $areas = array(); // get object map areas and check whether at least one must // be corrected $oid = $res->nodeset[$i]->get_attribute("OriginId"); if (substr($oid, 0, 4) == "il__") { $id_arr = explode("_", $oid); $id = $id_arr[count($id_arr) - 1]; $mob = new ilObjMediaObject($id); $med_item = $mob->getMediaItem("Standard"); $med_areas = $med_item->getMapAreas(); foreach ($med_areas as $area) { $link_type = $area->getLinkType() == "int" ? "IntLink" : "ExtLink"; $areas[] = array("Nr" => $area->getNr(), "Shape" => $area->getShape(), "Coords" => $area->getCoords(), "Link" => array("LinkType" => $link_type, "Href" => $area->getHref(), "Title" => $area->getTitle(), "Target" => $area->getTarget(), "Type" => $area->getType(), "TargetFrame" => $area->getTargetFrame())); if ($area->getType() == "PageObject" || $area->getType() == "StructureObject") { $t = $area->getTarget(); $tid = ilInternalLink::_extractObjIdOfTarget($t); if ($a_from_to[$tid] > 0) { $correction_needed = true; } //var_dump($a_from_to); } } } } // correct map area links if ($correction_needed) { $changed = true; $std_alias_item->deleteAllMapAreas(); foreach ($areas as $area) { if ($area["Link"]["LinkType"] == "IntLink") { $target = $area["Link"]["Target"]; $type = $area["Link"]["Type"]; $obj_id = ilInternalLink::_extractObjIdOfTarget($target); if ($a_from_to[$obj_id] > 0) { if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") { $area["Link"]["Target"] = "il__pg_" . $a_from_to[$obj_id]; } if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") { $area["Link"]["Target"] = "il__st_" . $a_from_to[$obj_id]; } } } $std_alias_item->addMapArea($area["Shape"], $area["Coords"], $area["Link"]["Title"], array("Type" => $area["Link"]["Type"], "TargetFrame" => $area["Link"]["TargetFrame"], "Target" => $area["Link"]["Target"], "Href" => $area["Link"]["Href"], "LinkType" => $area["Link"]["LinkType"])); } } } unset($xpc); return $changed; }
/** * Initializes a form for either displaying a room, adding a new room or editing an existing * room. The difference between those three forms is subtle but important: the form for * displaying rooms displays the information of the room without the ability of editing them. * The form for creating a room allows the input of values but contains no values initially. The * form for editing a room contains information that have been set before. * The creation of either those forms is determined by the mode parameter. * * @param string $a_mode the mode this form is centered around * * @return ilPropertyFormGUI the form with the given mode */ private function initForm($a_mode = "show") { $form_gui =& new ilPropertyFormGUI(); $form_gui->setMultipart(true); $form_gui->setTitle($this->lng->txt("rep_robj_xrs_room_properties")); $form_gui->setDescription($this->lng->txt("rep_robj_xrs_room_prop_description")); $name = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_name"), "name"); $name->setDisabled(true); $form_gui->addItem($name); $type = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_type"), "type"); $type->setDisabled(true); $form_gui->addItem($type); $min_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_min_alloc"), "min_alloc"); $min_alloc->setDisabled(true); $form_gui->addItem($min_alloc); $max_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_max_alloc"), "max_alloc"); $max_alloc->setDisabled(true); $form_gui->addItem($max_alloc); $floor_plan = new ilSelectInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "file_id"); $floor_plan->setOptions($this->room_obj->getAllFloorplans()); $floor_plan->setDisabled(true); $form_gui->addItem($floor_plan); if (count($this->room_obj->getAllAvailableAttributes())) { $defined_attributes = $this->room_obj->getAttributes(); $show_mode_with_exist_attrs = $a_mode == "show" && count($defined_attributes) > 0; if ($a_mode == "edit" || $a_mode == "create" || $show_mode_with_exist_attrs) { $attributes_header = new ilFormSectionHeaderGUI(); $attribute_header_text = $this->createAttributeHeaderText(); $attributes_header->setTitle($this->lng->txt("rep_robj_xrs_room_attributes") . $attribute_header_text); $form_gui->addItem($attributes_header); } foreach ($this->room_obj->getAllAvailableAttributes() as $attr) { $attribute_amount_by_id = $this->room_obj->getAttributeAmountById($attr['id']); $amount_not_given = !ilRoomSharingNumericUtils::isPositiveNumber($attribute_amount_by_id, true); if ($a_mode == "show" && $amount_not_given) { continue; } else { $attr_field = new ilRoomSharingNumberInputGUI($attr['name'], self::ATTRIBUTE_ID_PREFIX . $attr['id']); $attr_field->setValue($attribute_amount_by_id); $attr_field->setMinValue(0); $attr_field->setDisabled($a_mode == "show"); $form_gui->addItem($attr_field); } } } if ($a_mode == "edit" || $a_mode == "create") { $name->setDisabled(false); $name->setRequired(true); $type->setDisabled(false); $min_alloc->setDisabled(false); $min_alloc->setMinValue(0); $max_alloc->setDisabled(false); $max_alloc->setRequired(true); $max_alloc->setMinValue(0); $floor_plan->setDisabled(false); if ($a_mode == "create") { $min_alloc->setValue("0"); $form_gui->addCommandButton($this->ctrl->getLinkTarget($this, "addRoom"), $this->lng->txt("rep_robj_xrs_add_room")); } else { $form_gui->addCommandButton("saveRoom", $this->lng->txt("save")); } } if ($a_mode == "edit" || $a_mode == "show") { $name->setValue($this->room_obj->getName()); $type->setValue($this->room_obj->getType()); $min_alloc->setValue($this->room_obj->getMinAlloc()); $max_alloc->setValue($this->room_obj->getMaxAlloc()); $floor_plan->setValue($this->room_obj->getFileId()); if ($a_mode == "show") { $floor_plan->setDisabled(true); $mobj = new ilObjMediaObject($this->room_obj->getFileId()); $mitems = $mobj->getMediaItems(); if (!empty($mitems)) { $med = $mobj->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); $image_with_link = "<br><a target='_blank' href='" . $mobj->getDataDirectory() . "/" . $med->getLocation() . "'>" . ilUtil::img($target) . "</a>"; $floor_plan->setInfo($image_with_link); } } } $form_gui->setFormAction($this->ctrl->getFormAction($this)); return $form_gui; }
/** * Before deleting a floor plan, the user has to confirm it via a * confirmation GUI which is created in this function. */ public function confirmDeleteObject() { if (!$this->permission->checkPrivilege(PRIVC::DELETE_FLOORPLANS)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action")); $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary'); return false; } $this->tabs->clearTargets(); $this->tabs->setBackTarget($this->lng->txt('rep_robj_xrs_back_to_floor_plans'), $this->ctrl->getLinkTarget($this, 'render')); $cgui = new ilConfirmationGUI(); $cgui->setFormAction($this->ctrl->getFormAction($this)); $fplan = $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id)); // check if floorplan is associated to a room $allRooms = $fplan->getRoomsWithFloorplan((int) $_GET['file_id']); foreach ($allRooms as $room) { $rooms[] = $room["name"]; } if (empty($rooms)) { $cgui->setHeaderText($this->lng->txt("info_delete_sure")); } else { $roomsWithPlan = implode(", ", $rooms); $cgui->setHeaderText($this->lng->txt("info_delete_sure") . '<br>' . $this->lng->txt("rep_robj_xrs_floor_plans_room_assoc") . ' ' . $roomsWithPlan); } // the buttons for confirming and cancelling the deletion $cgui->setCancel($this->lng->txt("cancel"), "render"); $cgui->setConfirm($this->lng->txt("delete"), "removeFloorplan"); // the table which includes the thumbnail picture and the title $mobj = new ilObjMediaObject((int) $_GET['file_id']); $med = $mobj->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); $cgui->addItem('file_id', (int) $_GET['file_id'], $mobj->getTitle(), $target); $this->tpl->setContent($cgui->getHTML()); }
/** * Updates the media object with the file informations for the updateFloorPlanInfosWithFile * and addFloorPlan function. * * @param ilObjMediaObject $a_mediaObj * @param array $a_fileinfo with format and filename */ private function updateMediaObject($a_mediaObj, $a_fileinfo) { $media_item = $a_mediaObj->getMediaItem("Standard"); $media_item->setFormat($a_fileinfo["format"]); $media_item->setLocation($a_fileinfo["filename"]); $media_item->setLocationType("LocalFile"); $a_mediaObj->update(); }
/** * 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"); $this->tpl->setVariable("VAL_ID", $a_set["id"]); $this->tpl->parseCurrentBlock(); // $this->tpl->touchBlock("contrl_col"); } } else { $this->tpl->setCurrentBlock("edit_order"); $this->tpl->setVariable("VAL_ID", $a_set["id"]); $this->tpl->setVariable("VAL_ORDER", $a_set["order"]); $this->tpl->parseCurrentBlock(); // $this->tpl->touchBlock("contrl_col"); } } }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl; $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); // context $obj_id = ilObject::_lookupObjId($a_set["ref_id"]); $obj_type = ilObject::_lookupType($obj_id); $obj_title = ilObject::_lookupTitle($obj_id); // user if ($a_set["user_id"] > 0) { $this->tpl->setCurrentBlock("user_info"); if ($obj_type == "frm") { include_once "./Modules/Forum/classes/class.ilForumProperties.php"; if (ilForumProperties::_isAnonymized($a_set["context_obj_id"])) { if ($a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) { include_once "./Modules/Forum/classes/class.ilForumPost.php"; $post = new ilForumPost($a_set["context_sub_obj_id"]); if ($post->getUserAlias() != "") { $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias())); } else { $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous")); } } else { $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous")); } } else { if (ilObject::_exists($a_set["user_id"])) { $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); } } } else { if (ilObject::_exists($a_set["user_id"])) { $user_obj = new ilObjUser($a_set["user_id"]); $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin()); } } $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author")); $this->tpl->parseCurrentBlock(); } // media player if ($a_set["content_type"] == NEWS_AUDIO && $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"])) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php"; $mob = new ilObjMediaObject($a_set["mob_id"]); $med = $mob->getMediaItem("Standard"); $mpl = new ilMediaPlayerGUI(); $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"]) . "/" . $med->getLocation()); $this->tpl->setCurrentBlock("player"); $this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml()); $this->tpl->parseCurrentBlock(); } // access if ($enable_internal_rss) { $this->tpl->setCurrentBlock("access"); include_once "./Services/Block/classes/class.ilBlockSetting.php"; $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility")); if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public")); } else { $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users")); } $this->tpl->parseCurrentBlock(); } // content if ($a_set["content"] != "") { $this->tpl->setCurrentBlock("content"); $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true)); $this->tpl->parseCurrentBlock(); } if ($a_set["content_long"] != "") { $this->tpl->setCurrentBlock("long"); $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true)); $this->tpl->parseCurrentBlock(); } if ($a_set["update_date"] != $a_set["creation_date"]) { $this->tpl->setCurrentBlock("ni_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(); } // forum hack, not nice $add = ""; if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) { include_once "./Modules/Forum/classes/class.ilObjForumAccess.php"; $pos = $a_set["context_sub_obj_id"]; $thread = ilObjForumAccess::_getThreadForPosting($pos); if ($thread > 0) { $add = "_" . $thread . "_" . $pos; } } $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $a_set["ref_id"] . $add; $this->tpl->setCurrentBlock("context"); $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($a_set["ref_id"], true); $this->tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML()); $this->tpl->setVariable("HREF_CONTEXT_TITLE", $url_target); $this->tpl->setVariable("CONTEXT_TITLE", $obj_title); $this->tpl->setVariable("ALT_CONTEXT_TITLE", $lng->txt("icon") . " " . $lng->txt("obj_" . $obj_type)); $this->tpl->setVariable("IMG_CONTEXT_TITLE", ilUtil::getImagePath("icon_" . $obj_type . "_b.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setVariable("HREF_TITLE", $url_target); // title if ($a_set["content_is_lang_var"]) { $this->tpl->setVariable("VAL_TITLE", $lng->txt($a_set["title"])); } else { $this->tpl->setVariable("VAL_TITLE", ilUtil::stripSlashes($a_set["title"])); // title } // creation date $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME))); $this->tpl->setVariable("TXT_CREATED", $lng->txt("created")); $this->tpl->parseCurrentBlock(); }
/** * 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; } $link = $this->shortenLink($link); $html = "<a target='_blank' href='" . $value . "'>" . $link . "</a>"; } elseif ($arr_properties[ilDataCollectionField::PROPERTYID_LINK_DETAIL_PAGE_TEXT] and $link and ilDataCollectionRecordViewViewdefinition::getIdByTableId($record_field->getRecord()->getTableId())) { $ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $record_field->getRecord()->getId()); $html = '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord') . '">' . $value . '</a>'; } else { $html = $value; } break; default: $html = $value; break; } return $html; }
/** * show news */ function showNews() { global $lng, $ilCtrl, $ilUser; // workaround for dynamic mode (if cache is disabled, showNews has no data) if (empty(self::$st_data)) { $this->setData($this->getNewsData()); } $news_set = new ilSetting("news"); $enable_internal_rss = $news_set->get("enable_rss_for_internal"); include_once "./Services/News/classes/class.ilNewsItem.php"; $news = new ilNewsItem($_GET["news_id"]); $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News"); // get current item in data set $previous = $next = ""; reset($this->data); $c = current($this->data); $curr_cnt = 1; while ($c["id"] > 0 && $c["id"] != $_GET["news_id"]) { $previous = $c; $c = next($this->data); $curr_cnt++; } // collect news items to show $news_list = array(); if (is_array($c["aggregation"])) { //$agg_obj_id = ilObject::_lookupObjId($c["agg_ref_id"]); //$agg_obj_type = ilObject::_lookupType($agg_obj_id); //$agg_obj_title = ilObject::_lookupObjId($agg_obj_id); $news_list[] = array("ref_id" => $c["agg_ref_id"], "agg_ref_id" => $c["agg_ref_id"], "aggregation" => $c["aggregation"], "user_id" => "", "content_type" => "text", "mob_id" => 0, "visibility" => "", "content" => "", "content_long" => "", "update_date" => $news->getUpdateDate(), "creation_date" => "", "content_is_lang_var" => false, "loc_context" => $_GET["news_context"], "context_obj_type" => $news->getContextObjType(), "title" => ""); foreach ($c["aggregation"] as $c_item) { ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]); $c_item["loc_context"] = $c_item["ref_id"]; $c_item["loc_stop"] = $_GET["news_context"]; $news_list[] = $c_item; } } else { $news_list[] = array("ref_id" => $_GET["news_context"], "user_id" => $news->getUserId(), "content_type" => $news->getContentType(), "mob_id" => $news->getMobId(), "visibility" => $news->getVisibility(), "priority" => $news->getPriority(), "content" => $news->getContent(), "content_long" => $news->getContentLong(), "update_date" => $news->getUpdateDate(), "creation_date" => $news->getCreationDate(), "context_sub_obj_type" => $news->getContextSubObjType(), "context_obj_type" => $news->getContextObjType(), "context_sub_obj_id" => $news->getContextSubObjId(), "content_is_lang_var" => $news->getContentIsLangVar(), "content_text_is_lang_var" => $news->getContentTextIsLangVar(), "loc_context" => $_GET["news_context"], "title" => $news->getTitle()); ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]); } foreach ($news_list as $item) { // user if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) { // get login if (ilObjUser::_exists($item["user_id"])) { $user = new ilObjUser($item["user_id"]); $displayname = $user->getLogin(); } else { // this should actually not happen, since news entries // should be deleted when the user is going to be removed $displayname = "<" . strtolower($lng->txt("deleted")) . ">"; } $tpl->setCurrentBlock("user_info"); $tpl->setVariable("VAL_AUTHOR", $displayname); $tpl->setVariable("TXT_AUTHOR", $lng->txt("author")); $tpl->parseCurrentBlock(); } // media player if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php"; $mob = new ilObjMediaObject($item["mob_id"]); $med = $mob->getMediaItem("Standard"); $mpl = new ilMediaPlayerGUI(); if (strcasecmp("Reference", $med->getLocationType()) == 0) { $mpl->setFile($med->getLocation()); } else { $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation()); } $mpl->setDisplayHeight($med->getHeight()); $tpl->setCurrentBlock("player"); $tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml()); $tpl->parseCurrentBlock(); } // access if ($enable_internal_rss && $item["visibility"] != "") { $obj_id = ilObject::_lookupObjId($item["ref_id"]); $tpl->setCurrentBlock("access"); $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility")); if ($item["visibility"] == NEWS_PUBLIC || $item["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) { $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public")); } else { $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users")); } $tpl->parseCurrentBlock(); } // content if (trim($item["content"]) != "") { $tpl->setCurrentBlock("content"); $tpl->setVariable("VAL_CONTENT", nl2br($this->makeClickable(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"])))); //$tpl->setVariable("VAL_CONTENT", nl2br($item["content"])); $tpl->parseCurrentBlock(); } if (trim($item["content_long"]) != "") { $tpl->setCurrentBlock("long"); $tpl->setVariable("VAL_LONG_CONTENT", $this->makeClickable($item["content_long"])); $tpl->parseCurrentBlock(); } if ($item["update_date"] != $item["creation_date"]) { $tpl->setCurrentBlock("ni_update"); $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update")); $tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME))); $tpl->parseCurrentBlock(); } // creation date if ($item["creation_date"] != "") { $tpl->setCurrentBlock("ni_update"); $tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME))); $tpl->setVariable("TXT_CREATED", $lng->txt("created")); $tpl->parseCurrentBlock(); } // context / title if ($_GET["news_context"] > 0) { //$obj_id = ilObject::_lookupObjId($_GET["news_context"]); $obj_id = ilObject::_lookupObjId($item["ref_id"]); $obj_type = ilObject::_lookupType($obj_id); $obj_title = ilObject::_lookupTitle($obj_id); // file hack, not nice if ($obj_type == "file") { $tpl->setCurrentBlock("download"); $tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download")); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]); $tpl->setVariable("HREF_DOWNLOAD", $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile")); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]); $tpl->parseCurrentBlock(); } // forum hack, not nice $add = ""; if ($obj_type == "frm" && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) { include_once "./Modules/Forum/classes/class.ilObjForumAccess.php"; $pos = $item["context_sub_obj_id"]; $thread = ilObjForumAccess::_getThreadForPosting($pos); if ($thread > 0) { $add = "_" . $thread . "_" . $pos; } } // wiki hack, not nice if ($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"]); if ($wptitle != "") { $add = "_" . ilWikiUtil::makeUrlTitle($wptitle); } } $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $item["ref_id"] . $add; // lm page hack, not nice if (in_array($obj_type, array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) { $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"]; } $context_opened = false; if ($item["loc_context"] != null && $item["loc_context"] != $item["loc_stop"]) { $tpl->setCurrentBlock("context"); $context_opened = true; $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($item["loc_context"], true, $item["loc_stop"]); $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML()); } //var_dump($item); if ($item["no_context_title"] !== true) { if (!$context_opened) { $tpl->setCurrentBlock("context"); } $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target); $tpl->setVariable("CONTEXT_TITLE", $obj_title); $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type)); } if ($context_opened) { $tpl->parseCurrentBlock(); } $tpl->setVariable("HREF_TITLE", $url_target); } // title $tpl->setVariable("VAL_TITLE", ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"])); $row_css = $row_css != "tblrow1" ? "tblrow1" : "tblrow2"; $tpl->setCurrentBlock("item"); $tpl->setVariable("ITEM_ROW_CSS", $row_css); $tpl->parseCurrentBlock(); } include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php"; $content_block = new ilPDContentBlockGUI(); $content_block->setContent($tpl->get()); if ($this->getProperty("title") != "") { $content_block->setTitle($this->getProperty("title")); } else { $content_block->setTitle($lng->txt("news_internal_news")); } //$content_block->setColSpan(2); $content_block->setImage(ilUtil::getImagePath("icon_news.png")); $this->addCloseCommand($content_block); // previous if ($previous != "") { if ($previous["ref_id"] > 0) { $ilCtrl->setParameter($this, "news_context", $previous["ref_id"]); } $ilCtrl->setParameter($this, "news_id", $previous["id"]); $content_block->addFooterLink($lng->txt("previous"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true); $ilCtrl->setParameter($this, "news_context", ""); } // next if ($c = next($this->data)) { if ($c["ref_id"] > 0) { $ilCtrl->setParameter($this, "news_context", $c["ref_id"]); } $ilCtrl->setParameter($this, "news_id", $c["id"]); $content_block->addFooterLink($lng->txt("next"), $ilCtrl->getLinkTarget($this, "showNews"), "", "", true); } $ilCtrl->setParameter($this, "news_context", ""); $ilCtrl->setParameter($this, "news_id", ""); $content_block->setCurrentItemNumber($curr_cnt); $content_block->setEnableNumInfo(true); $content_block->setData($this->getData()); return $content_block->getHTML(); }
/** * Generate the link to the room agreement. * * @param integer $a_file_id * * @return string */ private function getFileLinkForUserAgreementId($a_file_id) { $agreement_file = new ilObjMediaObject($a_file_id); $media = $agreement_file->getMediaItem("Standard"); $source = $agreement_file->getDataDirectory() . "/" . $media->getLocation(); $link = "<p> <a target=\"_blank\" href=\"" . $source . "\">" . $this->lng->txt('rep_robj_xrs_current_rooms_user_agreement') . "</a></p>"; return $link; }
/** * function parses stored value in database to a html output for eg. the record list gui. * @param $value * @return mixed */ public function parseHTML($value, ilDataCollectionRecordField $record_field) { switch ($this->id) { case self::INPUTFORMAT_DATETIME: $html = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATETIME)); break; case self::INPUTFORMAT_FILE: global $ilCtrl; 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>"; break; case self::INPUTFORMAT_MOB: $mob = new ilObjMediaObject($value, false); $dir = ilObjMediaObject::_getDirectory($mob->getId()); $media_item = $mob->getMediaItem('Standard'); if (!$media_item->location) { $html = ""; break; } $html = '<img src="' . $dir . "/" . $media_item->location . '" />'; break; case self::INPUTFORMAT_BOOLEAN: switch ($value) { case 0: $im = ilUtil::getImagePath('icon_not_ok.png'); break; case 1: $im = ilUtil::getImagePath('icon_ok.png'); 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; } if (strlen($link) > self::LINK_MAX_LENGTH) { $link = substr($value, 0, (self::LINK_MAX_LENGTH - 3) / 2); $link .= "..."; $link .= substr($value, -(self::LINK_MAX_LENGTH - 3) / 2); } $html = "<a target='_blank' href='" . $value . "'>" . $link . "</a>"; } else { $html = $value; } // BEGIN EASTEREGG /*if(strtolower($value) == "nyan it plx!"){ $link = ilLink::_getLink($_GET['ref_id']); $html = "<a href='http://nyanit.com/".$link."'>Data Collections rock!</a>"; }*/ // END EASTEREGG break; default: $html = $value; break; } return $html; }
/** * Creates link for an room agreement file if such exists. * * @return string link */ private function getRoomAgreementLink() { $linkPresentation = ""; $fileId = $this->object->getRoomsAgreementFileId(); if (!empty($fileId) && $fileId != "0") { $agreementFile = new ilObjMediaObject($fileId); $media = $agreementFile->getMediaItem("Standard"); $source = $agreementFile->getDataDirectory() . "/" . $media->getLocation(); $linkPresentation = "<p> <a target=\"_blank\" href=\"" . $source . "\">" . $this->lng->txt('rep_robj_xrs_current_rooms_user_agreement') . "</a></p>"; } return $linkPresentation; }
protected function parseImage($a_sub_id) { include_once './Modules/MediaPool/classes/class.ilMediaPoolItem.php'; $sub_id = ilMediaPoolItem::lookupForeignId($a_sub_id); // output thumbnail (or mob icon) if (ilObject::_lookupType($sub_id) == "mob") { include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; $mob = new ilObjMediaObject($sub_id); $med = $mob->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); if ($target != "") { // begin-patch mime_filter $this->tpl->setVariable('LINKED_LINK', ilLink::_getLink($this->getRefId(), 'mep', array('action' => 'showMedia', 'mob_id' => $sub_id, 'mepitem_id' => $a_sub_id))); $this->tpl->setVariable('LINKED_TARGET', '_blank'); $this->tpl->setVariable("LINKED_IMAGE", ilUtil::img($target)); // end-patch mime_filter } else { $this->tpl->setVariable("SUB_ITEM_IMAGE", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".gif"))); } if (ilUtil::deducibleSize($med->getFormat()) && $med->getLocationType() == "Reference") { $size = @getimagesize($med->getLocation()); if ($size[0] > 0 && $size[1] > 0) { $wr = $size[0] / 80; $hr = $size[1] / 80; $r = max($wr, hr); $w = (int) ($size[0] / $r); $h = (int) ($size[1] / $r); $this->tpl->setVariable("SUB_ITEM_IMAGE", ilUtil::img($med->getLocation(), "", $w, $h)); return true; } } } return false; }