ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilFeedWriter Class Reference

Feed writer class. More...

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

Public Member Functions

 __construct ()
 ilFeedWriter constructor. More...
 
 setEncoding ($a_enc)
 Set feed encoding. More...
 
 getEncoding ()
 
 setChannelAbout ($a_ab)
 Unique URI that defines the channel. More...
 
 getChannelAbout ()
 
 setChannelTitle ($a_title)
 Channel Title. More...
 
 getChannelTitle ()
 
 setChannelLink ($a_link)
 Channel Link URL to which an HTML rendering of the channel title will link. More...
 
 getChannelLink ()
 
 setChannelDescription ($a_desc)
 Channel Description. More...
 
 getChannelDescription ()
 
 addItem ($a_item)
 Add Item Item is an object of type ilFeedItem. More...
 
 getItems ()
 
 prepareStr ($a_str)
 
 getFeed ()
 get feed xml More...
 
 showFeed ()
 
 getContextPath ($a_ref_id)
 

Data Fields

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

Detailed Description

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
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilFeedWriter::__construct ( )

ilFeedWriter constructor.

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

38  {
39 
40  }

Member Function Documentation

◆ addItem()

ilFeedWriter::addItem (   $a_item)

Add Item Item is an object of type ilFeedItem.

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

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

113  {
114  $this->items[] = $a_item;
115  }
+ Here is the caller graph for this function:

◆ getChannelAbout()

ilFeedWriter::getChannelAbout ( )

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

References $ch_about.

Referenced by getFeed().

64  {
65  return $this->ch_about;
66  }
+ Here is the caller graph for this function:

◆ getChannelDescription()

ilFeedWriter::getChannelDescription ( )

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

Referenced by getFeed().

104  {
105  return $this->ch_desc;
106  }
+ Here is the caller graph for this function:

◆ getChannelLink()

ilFeedWriter::getChannelLink ( )

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

References $ch_link.

Referenced by getFeed().

91  {
92  return $this->ch_link;
93  }
+ 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().

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

◆ getContextPath()

ilFeedWriter::getContextPath (   $a_ref_id)

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

References $lng, $path, $row, and array.

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

197  {
198  global $tree, $lng;
199 
200  $items = array();
201 
202  if ($a_ref_id > 0)
203  {
204  $path = $tree->getPathFull($a_ref_id);
205 
206  // we want to show the full path, from the major container to the item
207  // (folders are not! treated as containers here), at least one parent item
208  $r_path = array_reverse($path);
209  $first = "";
210  $omit = array();
211  $do_omit = false;
212  foreach ($r_path as $key => $row)
213  {
214  if ($first == "")
215  {
216  if (in_array($row["type"], array("root", "cat", "grp", "crs")) )
217  {
218  $first = $row["child"];
219  }
220  }
221  $omit[$row["child"]] = $do_omit;
222  }
223 
224  $add_it = false;
225  foreach ($path as $key => $row)
226  {
227  if ($first == $row["child"])
228  {
229  $add_it = true;
230  }
231 
232  if ($add_it && !$omit[$row["child"]] &&
233  (($row["child"] != $a_ref_id)))
234  {
235  if ($row["title"] == "ILIAS" && $row["type"] == "root")
236  {
237  $row["title"] = $lng->txt("repository");
238  }
239  $items[] = $row["title"];
240  }
241  }
242  }
243 
244  if (count($items) > 0)
245  {
246  return "[".implode(" > ", $items)."]";
247  }
248  return "";
249  }
$path
Definition: aliased.php:25
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getEncoding()

ilFeedWriter::getEncoding ( )

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

References $encoding.

Referenced by getFeed().

51  {
52  return $this->encoding;
53  }
+ Here is the caller graph for this function:

◆ getFeed()

ilFeedWriter::getFeed ( )

get feed xml

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

References $d, $h, date, getChannelAbout(), getChannelDescription(), getChannelLink(), getChannelTitle(), and getEncoding().

Referenced by showFeed().

134  {
135  include_once("./Services/UICore/classes/class.ilTemplate.php");
136  $this->tpl = new ilTemplate("tpl.rss_2_0.xml", true, true, "Services/Feeds");
137 
138  $this->tpl->setVariable("XML", "xml");
139  $this->tpl->setVariable("CONTENT_ENCODING", $this->getEncoding());
140  $this->tpl->setVariable("CHANNEL_ABOUT", $this->getChannelAbout());
141  $this->tpl->setVariable("CHANNEL_TITLE", $this->getChannelTitle());
142  $this->tpl->setVariable("CHANNEL_LINK", $this->getChannelLink());
143  $this->tpl->setVariable("CHANNEL_DESCRIPTION", $this->getChannelDescription());
144 
145  foreach($this->items as $item)
146  {
147  $this->tpl->setCurrentBlock("rdf_seq");
148  $this->tpl->setVariable("RESOURCE", $item->getAbout());
149  $this->tpl->parseCurrentBlock();
150 
151  // Date
152  if ($item->getDate() != "")
153  {
154  $this->tpl->setCurrentBlock("date");
155  $d = $item->getDate();
156  $yyyy = substr($d, 0, 4);
157  $mm = substr($d, 5, 2);
158  $dd = substr($d, 8, 2);
159  $h = substr($d, 11, 2);
160  $m = substr($d, 14, 2);
161  $s = substr($d, 17, 2);
162  $this->tpl->setVariable("ITEM_DATE",
163  date("r", mktime($h, $m, $s, $mm, $dd, $yyyy)));
164  $this->tpl->parseCurrentBlock();
165  }
166 
167  // Enclosure
168  if ($item->getEnclosureUrl() != "")
169  {
170  $this->tpl->setCurrentBlock("enclosure");
171  $this->tpl->setVariable("ENC_URL", $item->getEnclosureUrl());
172  $this->tpl->setVariable("ENC_LENGTH", $item->getEnclosureLength());
173  $this->tpl->setVariable("ENC_TYPE", $item->getEnclosureType());
174  $this->tpl->parseCurrentBlock();
175  }
176 
177  $this->tpl->setCurrentBlock("item");
178  $this->tpl->setVariable("ITEM_ABOUT", $item->getAbout());
179  $this->tpl->setVariable("ITEM_TITLE", $item->getTitle());
180  $this->tpl->setVariable("ITEM_DESCRIPTION", $item->getDescription());
181  $this->tpl->setVariable("ITEM_LINK", $item->getLink());
182  $this->tpl->parseCurrentBlock();
183 
184  }
185 
186  $this->tpl->parseCurrentBlock();
187  return $this->tpl->get();
188  }
$h
for($col=0; $col< 50; $col++) $d
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilFeedWriter::getItems ( )

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

References $items.

118  {
119  return $this->items;
120  }

◆ prepareStr()

ilFeedWriter::prepareStr (   $a_str)

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

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

123  {
124  $a_str = str_replace("&", "&amp;", $a_str);
125  $a_str = str_replace("<", "&lt;", $a_str);
126  $a_str = str_replace(">", "&gt;", $a_str);
127  return $a_str;
128  }
+ Here is the caller graph for this function:

◆ setChannelAbout()

ilFeedWriter::setChannelAbout (   $a_ab)

Unique URI that defines the channel.

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

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

59  {
60  $this->ch_about = $a_ab;
61  }
+ Here is the caller graph for this function:

◆ setChannelDescription()

ilFeedWriter::setChannelDescription (   $a_desc)

Channel Description.

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

99  {
100  $this->ch_desc = $a_desc;
101  }

◆ setChannelLink()

ilFeedWriter::setChannelLink (   $a_link)

Channel Link URL to which an HTML rendering of the channel title will link.

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

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

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

◆ setChannelTitle()

ilFeedWriter::setChannelTitle (   $a_title)

Channel Title.

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

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

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

◆ setEncoding()

ilFeedWriter::setEncoding (   $a_enc)

Set feed encoding.

Default is UTF-8.

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

46  {
47  $this->encoding = $a_enc;
48  }

◆ showFeed()

ilFeedWriter::showFeed ( )

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

References getFeed(), and header.

191  {
192  header("Content-Type: text/xml; charset=UTF-8;");
193  echo $this->getFeed();
194  }
getFeed()
get feed xml
Add a drawing to the header
Definition: 04printing.php:69
+ Here is the call graph for this function:

Field Documentation

◆ $ch_about

ilFeedWriter::$ch_about = ""

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

Referenced by getChannelAbout().

◆ $ch_description

ilFeedWriter::$ch_description = ""

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

◆ $ch_link

ilFeedWriter::$ch_link = ""

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

Referenced by getChannelLink().

◆ $ch_title

ilFeedWriter::$ch_title = ""

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

Referenced by getChannelTitle().

◆ $encoding

ilFeedWriter::$encoding = "UTF-8"

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

Referenced by getEncoding().

◆ $items

ilFeedWriter::$items = array()

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