ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilFeedWriter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilFeedWriter:
+ Collaboration diagram for ilFeedWriter:

Public Member Functions

 __construct ()
 
 setEncoding (string $a_enc)
 
 getEncoding ()
 
 setChannelAbout (string $a_ab)
 
 getChannelAbout ()
 
 setChannelTitle (string $a_title)
 
 getChannelTitle ()
 
 setChannelLink (string $a_link)
 
 getChannelLink ()
 
 setChannelDescription (string $a_desc)
 
 getChannelDescription ()
 
 addItem (ilFeedItem $a_item)
 
 getItems ()
 
 prepareStr (string $a_str)
 
 getFeed ()
 
 showFeed ()
 
 getContextPath (int $a_ref_id)
 

Data Fields

string $encoding = "UTF-8"
 
string $ch_about = ""
 
string $ch_title = ""
 
string $ch_link = ""
 
string $ch_description = ""
 
array $items = array()
 

Protected Attributes

ilTree $tree
 
ilLanguage $lng
 
ilTemplate $tpl
 

Private Attributes

string $ch_desc = ""
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Feed writer class. how to make it "secure" alternative 1:

  • hash for all objects
  • feature "mail me rss link"
  • link includes ref id, user id, combined hash (kind of password)
  • combined hash = hash(user hash + object hash)
  • ilias checks whether ref id / user id / combined hash match
    Author
    Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 30 of file class.ilFeedWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilFeedWriter::__construct ( )

Definition at line 43 of file class.ilFeedWriter.php.

References $DIC, and ILIAS\Repository\lng().

44  {
45  global $DIC;
46 
47  $this->tree = $DIC->repositoryTree();
48  $this->lng = $DIC->language();
49  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ addItem()

ilFeedWriter::addItem ( ilFeedItem  $a_item)

Definition at line 101 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

101  : void
102  {
103  $this->items[] = $a_item;
104  }
+ Here is the caller graph for this function:

◆ getChannelAbout()

ilFeedWriter::getChannelAbout ( )

Definition at line 66 of file class.ilFeedWriter.php.

References $ch_about.

Referenced by getFeed().

66  : string
67  {
68  return $this->ch_about;
69  }
+ Here is the caller graph for this function:

◆ getChannelDescription()

ilFeedWriter::getChannelDescription ( )

Definition at line 96 of file class.ilFeedWriter.php.

References $ch_desc.

Referenced by getFeed().

96  : string
97  {
98  return $this->ch_desc;
99  }
+ Here is the caller graph for this function:

◆ getChannelLink()

ilFeedWriter::getChannelLink ( )

Definition at line 86 of file class.ilFeedWriter.php.

References $ch_link.

Referenced by getFeed().

86  : string
87  {
88  return $this->ch_link;
89  }
+ Here is the caller graph for this function:

◆ getChannelTitle()

ilFeedWriter::getChannelTitle ( )

Definition at line 76 of file class.ilFeedWriter.php.

References $ch_title.

Referenced by getFeed().

76  : string
77  {
78  return $this->ch_title;
79  }
+ Here is the caller graph for this function:

◆ getContextPath()

ilFeedWriter::getContextPath ( int  $a_ref_id)

Definition at line 177 of file class.ilFeedWriter.php.

References $lng, $path, $tree, ilTree\getPathFull(), and ilLanguage\txt().

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

177  : string
178  {
179  $tree = $this->tree;
180  $lng = $this->lng;
181 
182  $items = array();
183 
184  if ($a_ref_id > 0) {
185  $path = $tree->getPathFull($a_ref_id);
186 
187  // we want to show the full path, from the major container to the item
188  // (folders are not! treated as containers here), at least one parent item
189  $r_path = array_reverse($path);
190  $first = "";
191  $omit = array();
192  $do_omit = false;
193  foreach ($r_path as $key => $row) {
194  if ($first == "") {
195  if (in_array($row["type"], array("root", "cat", "grp", "crs"))) {
196  $first = $row["child"];
197  }
198  }
199  $omit[$row["child"]] = $do_omit;
200  }
201 
202  $add_it = false;
203  foreach ($path as $key => $row) {
204  if ($first == $row["child"]) {
205  $add_it = true;
206  }
207 
208  if ($add_it && !$omit[$row["child"]] &&
209  (($row["child"] != $a_ref_id))) {
210  if ($row["title"] == "ILIAS" && $row["type"] == "root") {
211  $row["title"] = $lng->txt("repository");
212  }
213  $items[] = $row["title"];
214  }
215  }
216  }
217 
218  if (count($items) > 0) {
219  return "[" . implode(" > ", $items) . "]";
220  }
221  return "";
222  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEncoding()

ilFeedWriter::getEncoding ( )

Definition at line 56 of file class.ilFeedWriter.php.

References $encoding.

Referenced by getFeed().

56  : string
57  {
58  return $this->encoding;
59  }
+ Here is the caller graph for this function:

◆ getFeed()

ilFeedWriter::getFeed ( )

Definition at line 117 of file class.ilFeedWriter.php.

References Vendor\Package\$d, getChannelAbout(), getChannelDescription(), getChannelLink(), getChannelTitle(), and getEncoding().

Referenced by showFeed().

117  : string
118  {
119  $this->tpl = new ilTemplate("tpl.rss_2_0.xml", true, true, "components/ILIAS/Feeds");
120 
121  $this->tpl->setVariable("XML", "xml");
122  $this->tpl->setVariable("CONTENT_ENCODING", $this->getEncoding());
123  $this->tpl->setVariable("CHANNEL_ABOUT", $this->getChannelAbout());
124  $this->tpl->setVariable("CHANNEL_TITLE", $this->getChannelTitle());
125  $this->tpl->setVariable("CHANNEL_LINK", $this->getChannelLink());
126  $this->tpl->setVariable("CHANNEL_DESCRIPTION", $this->getChannelDescription());
127 
128  foreach ($this->items as $item) {
129  $this->tpl->setCurrentBlock("rdf_seq");
130  $this->tpl->setVariable("RESOURCE", $item->getAbout());
131  $this->tpl->parseCurrentBlock();
132 
133  // Date
134  if ($item->getDate() != "") {
135  $this->tpl->setCurrentBlock("date");
136  $d = $item->getDate();
137  $yyyy = substr($d, 0, 4);
138  $mm = substr($d, 5, 2);
139  $dd = substr($d, 8, 2);
140  $h = substr($d, 11, 2);
141  $m = substr($d, 14, 2);
142  $s = substr($d, 17, 2);
143  $this->tpl->setVariable(
144  "ITEM_DATE",
145  date("r", mktime($h, $m, $s, $mm, $dd, $yyyy))
146  );
147  $this->tpl->parseCurrentBlock();
148  }
149 
150  // Enclosure
151  if ($item->getEnclosureUrl() != "") {
152  $this->tpl->setCurrentBlock("enclosure");
153  $this->tpl->setVariable("ENC_URL", $item->getEnclosureUrl());
154  $this->tpl->setVariable("ENC_LENGTH", $item->getEnclosureLength());
155  $this->tpl->setVariable("ENC_TYPE", $item->getEnclosureType());
156  $this->tpl->parseCurrentBlock();
157  }
158 
159  $this->tpl->setCurrentBlock("item");
160  $this->tpl->setVariable("ITEM_ABOUT", $item->getAbout());
161  $this->tpl->setVariable("ITEM_TITLE", $item->getTitle());
162  $this->tpl->setVariable("ITEM_DESCRIPTION", $item->getDescription());
163  $this->tpl->setVariable("ITEM_LINK", $item->getLink());
164  $this->tpl->parseCurrentBlock();
165  }
166 
167  $this->tpl->parseCurrentBlock();
168  return $this->tpl->get();
169  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilFeedWriter::getItems ( )

Definition at line 106 of file class.ilFeedWriter.php.

References $items.

106  : array
107  {
108  return $this->items;
109  }

◆ prepareStr()

ilFeedWriter::prepareStr ( string  $a_str)

Definition at line 111 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

111  : string
112  {
113  $a_str = str_replace(["&", "<", ">"], ["&amp;", "&lt;", "&gt;"], $a_str);
114  return $a_str;
115  }
+ Here is the caller graph for this function:

◆ setChannelAbout()

ilFeedWriter::setChannelAbout ( string  $a_ab)

Definition at line 61 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

61  : void
62  {
63  $this->ch_about = $a_ab;
64  }
+ Here is the caller graph for this function:

◆ setChannelDescription()

ilFeedWriter::setChannelDescription ( string  $a_desc)

Definition at line 91 of file class.ilFeedWriter.php.

91  : void
92  {
93  $this->ch_desc = $a_desc;
94  }

◆ setChannelLink()

ilFeedWriter::setChannelLink ( string  $a_link)

Definition at line 81 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

81  : void
82  {
83  $this->ch_link = $a_link;
84  }
+ Here is the caller graph for this function:

◆ setChannelTitle()

ilFeedWriter::setChannelTitle ( string  $a_title)

Definition at line 71 of file class.ilFeedWriter.php.

Referenced by ilObjectFeedWriter\__construct(), and ilUserFeedWriter\__construct().

71  : void
72  {
73  $this->ch_title = $a_title;
74  }
+ Here is the caller graph for this function:

◆ setEncoding()

ilFeedWriter::setEncoding ( string  $a_enc)

Definition at line 51 of file class.ilFeedWriter.php.

51  : void
52  {
53  $this->encoding = $a_enc;
54  }

◆ showFeed()

ilFeedWriter::showFeed ( )

Definition at line 171 of file class.ilFeedWriter.php.

References getFeed(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

171  : void
172  {
173  header("Content-Type: text/xml; charset=UTF-8;");
174  echo $this->getFeed();
175  }
header()
expected output: > ILIAS shows the rendered Component.
Definition: header.php:29
+ Here is the call graph for this function:

Field Documentation

◆ $ch_about

string ilFeedWriter::$ch_about = ""

Definition at line 37 of file class.ilFeedWriter.php.

Referenced by getChannelAbout().

◆ $ch_desc

string ilFeedWriter::$ch_desc = ""
private

Definition at line 32 of file class.ilFeedWriter.php.

Referenced by getChannelDescription().

◆ $ch_description

string ilFeedWriter::$ch_description = ""

Definition at line 40 of file class.ilFeedWriter.php.

◆ $ch_link

string ilFeedWriter::$ch_link = ""

Definition at line 39 of file class.ilFeedWriter.php.

Referenced by getChannelLink().

◆ $ch_title

string ilFeedWriter::$ch_title = ""

Definition at line 38 of file class.ilFeedWriter.php.

Referenced by getChannelTitle().

◆ $encoding

string ilFeedWriter::$encoding = "UTF-8"

Definition at line 36 of file class.ilFeedWriter.php.

Referenced by getEncoding().

◆ $items

array ilFeedWriter::$items = array()

◆ $lng

ilLanguage ilFeedWriter::$lng
protected

Definition at line 34 of file class.ilFeedWriter.php.

Referenced by getContextPath().

◆ $tpl

ilTemplate ilFeedWriter::$tpl
protected

Definition at line 35 of file class.ilFeedWriter.php.

◆ $tree

ilTree ilFeedWriter::$tree
protected

Definition at line 33 of file class.ilFeedWriter.php.

Referenced by getContextPath().


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