public function getNotificationAbstract() { include_once "Modules/Blog/classes/class.ilBlogPostingGUI.php"; $snippet = ilBlogPostingGUI::getSnippet($this->getId(), true); // making things more readable $snippet = str_replace('<br/>', "\n", $snippet); $snippet = str_replace('<br />', "\n", $snippet); $snippet = str_replace('</p>', "\n", $snippet); $snippet = str_replace('</div>', "\n", $snippet); return trim(strip_tags($snippet)); }
/** * Build posting month list * * @param array $items * @param string $a_month * @param string $a_cmd * @param bool $a_link_template * @param bool $a_show_inactive * @return string */ function renderList(array $items, $a_month, $a_cmd = "preview", $a_link_template = null, $a_show_inactive = false) { global $lng, $ilCtrl; include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $wtpl = new ilTemplate("tpl.blog_list.html", true, true, "Modules/Blog"); // title according to current "filter"/navigation if ($this->keyword) { $title = $lng->txt("blog_keyword") . ": " . $this->keyword; } else { if ($this->author) { include_once "Services/User/classes/class.ilUserUtil.php"; $title = $lng->txt("blog_author") . ": " . ilUserUtil::getNamePresentation($this->author); } else { include_once "Services/Calendar/classes/class.ilCalendarUtil.php"; $title = ilCalendarUtil::_numericMonthToString((int) substr($a_month, 5)) . " " . substr($a_month, 0, 4); } } $wtpl->setVariable("TXT_CURRENT_MONTH", $title); $can_approve = $this->object->hasApproval() && $this->checkPermissionBool("write"); $can_deactivate = $this->checkPermissionBool("write"); include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php"; foreach ($items as $item) { // only published items $is_active = ilBlogPosting::_lookupActive($item["id"], "blp"); if (!$is_active && !$a_show_inactive) { continue; } if (!$a_link_template) { $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month); $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $item["id"]); $preview = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_cmd); } else { $preview = $this->buildExportLink($a_link_template, "posting", $item["id"]); } // actions $item_contribute = $this->mayContribute($item["id"], $item["author"]); if (($item_contribute || $can_approve || $can_deactivate) && !$a_link_template && $a_cmd == "preview") { include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $alist = new ilAdvancedSelectionListGUI(); $alist->setId($item["id"]); $alist->setListTitle($lng->txt("actions")); if ($is_active && $this->object->hasApproval() && !$item["approved"]) { if ($can_approve) { $ilCtrl->setParameter($this, "apid", $item["id"]); $alist->addItem($lng->txt("blog_approve"), "approve", $ilCtrl->getLinkTarget($this, "approve")); $ilCtrl->setParameter($this, "apid", ""); } $wtpl->setVariable("APPROVAL", $lng->txt("blog_needs_approval")); } if ($item_contribute) { $alist->addItem($lng->txt("edit_content"), "edit", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit")); // #11858 if ($is_active) { $alist->addItem($lng->txt("blog_toggle_draft"), "deactivate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deactivatePageToList")); } else { $alist->addItem($lng->txt("blog_toggle_final"), "activate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "activatePageToList")); } $alist->addItem($lng->txt("rename"), "rename", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edittitle")); $alist->addItem($lng->txt("blog_edit_keywords"), "keywords", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords")); $alist->addItem($lng->txt("blog_edit_date"), "editdate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editdate")); $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen")); } else { if ($can_deactivate) { // #10513 if ($is_active) { $ilCtrl->setParameter($this, "apid", $item["id"]); $alist->addItem($lng->txt("blog_toggle_draft_admin"), "deactivate", $ilCtrl->getLinkTarget($this, "deactivateAdmin")); $ilCtrl->setParameter($this, "apid", ""); } $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen")); } } $wtpl->setCurrentBlock("actions"); $wtpl->setVariable("ACTION_SELECTOR", $alist->getHTML()); $wtpl->parseCurrentBlock(); } // comments if ($this->object->getNotesStatus() && !$a_link_template && !$this->disable_notes) { // count (public) notes include_once "Services/Notes/classes/class.ilNote.php"; $count = sizeof(ilNote::_getNotesOfObject($this->obj_id, $item["id"], "blp", IL_NOTE_PUBLIC)); if ($a_cmd != "preview") { $wtpl->setCurrentBlock("comments"); $wtpl->setVariable("TEXT_COMMENTS", $lng->txt("blog_comments")); $wtpl->setVariable("URL_COMMENTS", $preview); $wtpl->setVariable("COUNT_COMMENTS", $count); $wtpl->parseCurrentBlock(); } /* we disabled comments in edit mode (should always be done via pagegui) else { $hash = ilCommonActionDispatcherGUI::buildAjaxHash(ilCommonActionDispatcherGUI::TYPE_WORKSPACE, $this->node_id, "blog", $this->obj_id, "blp", $item["id"]); $notes_link = "#\" onclick=\"".ilNoteGUI::getListCommentsJSCall($hash); } */ } // permanent link if ($a_cmd != "preview" && $a_cmd != "previewEmbedded") { if ($this->id_type == self::WORKSPACE_NODE_ID) { $goto = $this->getAccessHandler()->getGotoLink($this->node_id, $this->obj_id, "_" . $item["id"]); } else { include_once "Services/Link/classes/class.ilLink.php"; $goto = ilLink::_getStaticLink($this->node_id, $this->getType(), true, "_" . $item["id"]); } $wtpl->setCurrentBlock("permalink"); $wtpl->setVariable("URL_PERMALINK", $goto); $wtpl->setVariable("TEXT_PERMALINK", $lng->txt("blog_permanent_link")); $wtpl->parseCurrentBlock(); } $snippet = ilBlogPostingGUI::getSnippet($item["id"]); if ($snippet) { $wtpl->setCurrentBlock("more"); $wtpl->setVariable("URL_MORE", $preview); $wtpl->setVariable("TEXT_MORE", $lng->txt("blog_list_more")); $wtpl->parseCurrentBlock(); } $wtpl->setCurrentBlock("posting"); if (!$is_active) { $wtpl->setVariable("DRAFT_CLASS", " ilBlogListItemDraft"); } $author = ""; if ($this->id_type == self::REPOSITORY_NODE_ID) { $author_id = $item["author"]; if ($author_id) { include_once "Services/User/classes/class.ilUserUtil.php"; $author = ilUserUtil::getNamePresentation($author_id) . " - "; } } // title $wtpl->setVariable("URL_TITLE", $preview); $wtpl->setVariable("TITLE", $item["title"]); $wtpl->setVariable("DATETIME", $author . ilDatePresentation::formatDate($item["created"], IL_CAL_DATE)); // content $wtpl->setVariable("CONTENT", $snippet); $wtpl->parseCurrentBlock(); } // notes /* if($a_cmd == "previewFullscreen" && $this->object->getNotesStatus()) { $wtpl->setVariable("NOTES", $this->getNotesHTML()); } */ // permalink if ($a_cmd == "previewFullscreen") { $wtpl->setVariable("PERMALINK", $this->getPermanentLinkWidget(null, true)); } return $wtpl->get(); }
/** * 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; }