ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Blog\RSS\RSSGUI Class Reference

GUI class for handling RSS feed delivery for blogs. More...

+ Collaboration diagram for ILIAS\Blog\RSS\RSSGUI:

Public Member Functions

 __construct (protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui)
 
 deliver (string $a_wsp_id)
 Deliver blog as rss feed, currently using permalink from the gui layer, might be moved. More...
 

Detailed Description

GUI class for handling RSS feed delivery for blogs.

Definition at line 30 of file RSSGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\RSS\RSSGUI::__construct ( protected InternalDataService  $data,
protected InternalDomainService  $domain,
protected InternalGUIService  $gui 
)

Definition at line 32 of file RSSGUI.php.

36 {
37 }

Member Function Documentation

◆ deliver()

ILIAS\Blog\RSS\RSSGUI::deliver ( string  $a_wsp_id)

Deliver blog as rss feed, currently using permalink from the gui layer, might be moved.

Definition at line 43 of file RSSGUI.php.

43 : void
44 {
45 $ilSetting = $this->domain->settings();
46
47 if (!$ilSetting->get('enable_global_profiles')) {
48 return;
49 }
50
51 // #10827
52 if (!str_ends_with($a_wsp_id, "_cll")) {
53 $wsp_id = new \ilWorkspaceTree(0);
54 $obj_id = $wsp_id->lookupObjectId((int) $a_wsp_id);
55 $pl = $this->gui->permanentLink(0, (int) $a_wsp_id);
56 } else {
57 $a_wsp_id = substr($a_wsp_id, 0, -4);
58 $obj_id = \ilObject::_lookupObjId((int) $a_wsp_id);
59 $pl = $this->gui->permanentLink((int) $a_wsp_id);
60 }
61 if (!$obj_id) {
62 return;
63 }
64
65 $blog_settings = $this->domain->blogSettings()
66 ->getByObjId($obj_id);
67 if (!$blog_settings?->getRSS()) {
68 return;
69 }
70
71 $blog = new \ilObjBlog($obj_id, false);
72 $feed = new \ilFeedWriter();
73
74 $url = $pl->getPermanentLink();
75 $url = str_replace("&", "&", $url);
76
77 // #11870
78 $feed->setChannelTitle(str_replace("&", "&", $blog->getTitle()));
79 $feed->setChannelDescription(str_replace("&", "&", $blog->getDescription()));
80 $feed->setChannelLink($url);
81
82 foreach ($this->domain->posting()->getAllPostings($obj_id) as $item) {
83 $id = $item->getId();
84
85 // only published items
86 $is_active = $this->domain->pageManager()->lookupActive($id, "blp");
87 if (!$is_active) {
88 continue;
89 }
90
91 // #16434
92 $snippet = strip_tags($this->gui->posting()->getSnippet($id), "<br><div><p>");
93 $snippet = str_replace("&", "&amp;", $snippet);
94 $snippet = "<![CDATA[" . $snippet . "]]>";
95
96 $url = $pl->getPermanentLink((int) $id);
97 $url = str_replace("&", "&amp;", $url);
98
99 $feed_item = new \ilFeedItem();
100 $feed_item->setTitle(str_replace("&", "&amp;", $item->getTitle())); // #16022
101 $feed_item->setDate($item->getCreated()->get(IL_CAL_DATETIME));
102 $feed_item->setDescription($snippet);
103 $feed_item->setLink($url);
104 $feed_item->setAbout($url);
105 $feed->addItem($feed_item);
106 }
107
108 $feed->showFeed();
109 exit();
110 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
const IL_CAL_DATETIME
static _lookupObjId(int $ref_id)
global $ilSetting
Definition: privfeed.php:26
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $id, $ilSetting, ilObject\_lookupObjId(), exit, and IL_CAL_DATETIME.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: