/** * Filter inactive items from items list * * @return array */ protected function filterInactivePostings() { foreach ($this->items as $month => $postings) { foreach ($postings as $id => $item) { if (!ilBlogPosting::_lookupActive($id, "blp")) { unset($this->items[$month][$id]); } else { if ($this->object->hasApproval() && !$item["approved"]) { unset($this->items[$month][$id]); } } } if (!sizeof($this->items[$month])) { unset($this->items[$month]); } } if ($this->items && !isset($this->items[$this->month])) { $this->month = array_shift(array_keys($this->items)); } }
/** * Deliver blog as rss feed * * @param int $a_wsp_id */ static function deliverRSS($a_wsp_id) { global $tpl, $ilSetting; if (!$ilSetting->get('enable_global_profiles')) { return; } // #10827 if (substr($a_wsp_id, -4) != "_cll") { include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $wsp_id = new ilWorkspaceTree(0); $obj_id = $wsp_id->lookupObjectId($a_wsp_id); $is_wsp = "_wsp"; } else { $a_wsp_id = substr($a_wsp_id, 0, -4); $obj_id = ilObject::_lookupObjId($a_wsp_id); $is_wsp = null; } if (!$obj_id) { return; } $blog = new self($obj_id, false); if (!$blog->hasRSS()) { return; } include_once "Services/Feeds/classes/class.ilFeedWriter.php"; $feed = new ilFeedWriter(); include_once "Services/Link/classes/class.ilLink.php"; $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp); $url = str_replace("&", "&", $url); $feed->setChannelTitle($blog->getTitle()); $feed->setChannelDescription($blog->getDescription()); $feed->setChannelLink($url); // needed for blogpostinggui / pagegui $tpl = new ilTemplate("tpl.main.html", true, true); include_once "./Modules/Blog/classes/class.ilBlogPosting.php"; include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php"; foreach (ilBlogPosting::getAllPostings($obj_id) as $item) { $id = $item["id"]; // only published items $is_active = ilBlogPosting::_lookupActive($id, "blp"); if (!$is_active) { continue; } $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id)); $snippet = str_replace("&", "&", $snippet); $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_" . $id . $is_wsp); $url = str_replace("&", "&", $url); $feed_item = new ilFeedItem(); $feed_item->setTitle($item["title"]); $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME)); $feed_item->setDescription($snippet); $feed_item->setLink($url); $feed_item->setAbout($url); $feed->addItem($feed_item); } $feed->showFeed(); exit; }