function showGallery() { global $tpl, $ilTabs; $tpl->addJavascript("./Modules/MediaCast/js/MediaCast.js"); $ilTabs->activateTab("content"); $this->addContentSubTabs("content"); $ctpl = new ilTemplate("tpl.mcst_content.html", true, true, "Modules/MediaCast"); include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; foreach ($this->object->getSortedItemsArray() as $item) { $mob = new ilObjMediaObject($item["mob_id"]); $med = $mob->getMediaItem("Standard"); $ctpl->setCurrentBlock("item"); $ctpl->setVariable("TITLE", $item["title"]); $ctpl->setVariable("TIME", $item["playtime"]); $ctpl->setVariable("ID", $item["id"]); if ($mob->getVideoPreviewPic() != "") { $ctpl->setVariable("PREVIEW_PIC", ilUtil::img($mob->getVideoPreviewPic(), $item["title"], 320, 240)); } else { $ctpl->setVariable("PREVIEW_PIC", ilUtil::img(ilUtil::getImagePath("mcst_preview.png"), $item["title"], 320, 240)); } // player if (is_object($med)) { include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php"; $mpl = new ilMediaPlayerGUI(); 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->setDisplayHeight("480"); $mpl->setDisplayWidth("640"); $mpl->setVideoPreviewPic($mob->getVideoPreviewPic()); $mpl->setTitle($item["title"]); $mpl->setDescription($item["content"]); $mpl->setForceAudioPreview(true); $med_alt = $mob->getMediaItem("VideoAlternative"); if (is_object($med_alt)) { $mpl->setAlternativeVideoFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med_alt->getLocation()); $mpl->setAlternativeVideoMimeType($med_alt->getFormat()); } $ctpl->setVariable("PLAYER", $mpl->getPreviewHtml()); } $ctpl->parseCurrentBlock(); } $feed_icon_html = $this->getFeedIconsHTML(); if ($feed_icon_html != "") { $feed_icon_html = '<p>' . $feed_icon_html . '</p>'; } $tpl->setContent($feed_icon_html . $ctpl->get()); }
/** * 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"); } } }