/** * get media info as html */ function _getMediaInfoHTML(&$a_mob) { global $lng; $tpl =& new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects"); $types = array("Standard", "Fullscreen"); foreach ($types as $type) { if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) { continue; } $med = $a_mob->getMediaItem($type); if (!$med) { return ""; } $tpl->setCurrentBlock("media_info"); if ($type == "Standard") { $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view")); } else { $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen")); } $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType()))); $tpl->setVariable("VAL_LOCATION", $med->getLocation()); if ($med->getLocationType() == "LocalFile") { $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation(); if (is_file($file)) { $size = filesize($file); } else { $size = 0; } $tpl->setVariable("VAL_FILE_SIZE", " ({$size} " . $lng->txt("bytes") . ")"); } $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format")); $tpl->setVariable("VAL_FORMAT", $med->getFormat()); if ($med->getWidth() != "" && $med->getHeight() != "") { $tpl->setCurrentBlock("size"); $tpl->setVariable("TXT_SIZE", $lng->txt("size")); $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight()); $tpl->parseCurrentBlock(); } // original size if ($orig_size = $med->getOriginalSize()) { if ($orig_size["width"] != $med->getWidth() || $orig_size["height"] != $med->getHeight()) { $tpl->setCurrentBlock("orig_size"); $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size")); $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]); $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]); $tpl->parseCurrentBlock(); } } // output caption if ($med && strlen($med->getCaption())) { $tpl->setCurrentBlock('additional_info'); $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption()); $tpl->parseCurrentBlock(); } // output keywords if ($type == "Standard") { include_once './Services/MetaData/classes/class.ilMDKeyword.php'; if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) { $tpl->setCurrentBlock('additional_info'); $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws)); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock("media_info"); $tpl->parseCurrentBlock(); } return $tpl->get(); }
public static function getKeywords($a_obj_id, $a_posting_id) { include_once "./Services/MetaData/classes/class.ilMDKeyword.php"; return ilMDKeyword::lookupKeywords($a_obj_id, $a_posting_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"] . ".png"))); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder); break; case "pg": $this->tpl->setVariable("TXT_NO_LINK_TITLE", $a_set["title"]); 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.png"))); $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder); break; case "mob": 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("TXT_TITLE", $a_set["title"]); $this->tpl->touchBlock("nf"); $ilCtrl->setParameterByClass("ilobjmediaobjectgui", "mepitem_id", $a_set["child"]); $ilCtrl->setParameter($this->parent_obj, "mob_id", $a_set["foreign_id"]); $this->tpl->setVariable("LINK_VIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showMedia")); } // 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 = $med->getThumbnailTarget(); if ($target != "") { $this->tpl->setVariable("IMG", ilUtil::img($target)); } else { $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".png"))); } 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("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); // output keywords include_once './Services/MetaData/classes/class.ilMDKeyword.php'; if (count($kws = ilMDKeyword::lookupKeywords(0, $a_set['foreign_id']))) { $this->tpl->setCurrentBlock('additional_info'); $this->tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(' ', $kws)); $this->tpl->parseCurrentBlock(); } // output caption if (strlen($med->getCaption())) { $this->tpl->setCurrentBlock('additional_info'); $this->tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption()); $this->tpl->parseCurrentBlock(); } } 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"); } } } }