/**
  * Get feed icons HTML
  *
  * @param
  * @return
  */
 function getFeedIconsHTML()
 {
     global $lng;
     $html = "";
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
     // rss icon/link
     if ($public_feed) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             // create dummy object in db (we need an id)
             $items = $this->object->getItemsArray();
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
             $html = "";
             foreach (ilObjMediaCast::$purposes as $purpose) {
                 foreach ($items as $id => $item) {
                     $mob = new ilObjMediaObject($item["mob_id"]);
                     $mob->read();
                     if ($mob->hasPurposeItem($purpose)) {
                         if ($html == "") {
                             $html = " ";
                         }
                         $url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose={$purpose}";
                         $title = $lng->txt("news_feed_url");
                         $icon = ilUtil::getImagePath("rss_icon_" . strtolower($purpose) . ".png");
                         $target = "_blank";
                         $row1 .= "<A href='{$url}' target='{$target}'><img src='{$icon}' alt='{$title}'/></A>";
                         if ($this->object->getPublicFiles()) {
                             $url = preg_replace("/https?/i", "itpc", $url);
                             $title = $lng->txt("news_feed_url");
                             $icon = ilUtil::getImagePath("itunes_icon.png");
                             $row2 .= "<A href='{$url}' target='{$target}'><img src='{$icon}' alt='{$title}'/></A>";
                         }
                         break;
                     }
                 }
             }
             if ($html != "") {
                 $html .= $row1;
                 if ($row2 != "") {
                     $html .= "&nbsp;&nbsp;" . $row2;
                 }
             }
         }
     }
     return $html;
 }
Exemplo n.º 2
0
 /**
  * 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());
     }
 }
Exemplo n.º 3
0
 /**
  * Get feed icons HTML
  *
  * @param
  * @return
  */
 function getFeedIconsHTML()
 {
     global $lng;
     $html = "";
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
     // rss icon/link
     if ($public_feed) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             // create dummy object in db (we need an id)
             $items = $this->object->getItemsArray();
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
             $html = "";
             foreach (ilObjMediaCast::$purposes as $purpose) {
                 foreach ($items as $id => $item) {
                     $mob = new ilObjMediaObject($item["mob_id"]);
                     $mob->read();
                     if ($mob->hasPurposeItem($purpose)) {
                         if ($html == "") {
                             $html = " ";
                         }
                         $url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose={$purpose}";
                         $title = $lng->txt("news_feed_url");
                         include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
                         switch (strtolower($purpose)) {
                             case "audioportable":
                                 $type1 = ilRSSButtonGUI::ICON_RSS_AUDIO;
                                 $type2 = ilRSSButtonGUI::ICON_ITUNES_AUDIO;
                                 break;
                             case "videoportable":
                                 $type1 = ilRSSButtonGUI::ICON_RSS_VIDEO;
                                 $type2 = ilRSSButtonGUI::ICON_ITUNES_VIDEO;
                                 break;
                             default:
                                 $type1 = ilRSSButtonGUI::ICON_RSS;
                                 $type2 = ilRSSButtonGUI::ICON_ITUNES;
                                 break;
                         }
                         $row1 .= "&nbsp;" . ilRSSButtonGUI::get($type1, $url);
                         if ($this->object->getPublicFiles()) {
                             $url = preg_replace("/https?/i", "itpc", $url);
                             $title = $lng->txt("news_feed_url");
                             include_once "./Services/News/classes/class.ilRSSButtonGUI.php";
                             $row2 .= "&nbsp;" . ilRSSButtonGUI::get($type2, $url);
                         }
                         break;
                     }
                 }
             }
             if ($html != "") {
                 $html .= $row1;
                 if ($row2 != "") {
                     $html .= $row2;
                 }
             }
         }
     }
     return $html;
 }