ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilFeedWriter Class Reference

Feed writer class. More...

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

Public Member Functions

 ilFeedWriter ()
 
 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.

Member Function Documentation

◆ addItem()

ilFeedWriter::addItem (   $a_item)

Add Item Item is an object of type ilFeedItem.

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

109 {
110 $this->items[] = $a_item;
111 }

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

+ Here is the caller graph for this function:

◆ getChannelAbout()

ilFeedWriter::getChannelAbout ( )

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

60 {
61 return $this->ch_about;
62 }

References $ch_about.

Referenced by getFeed().

+ Here is the caller graph for this function:

◆ getChannelDescription()

ilFeedWriter::getChannelDescription ( )

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

100 {
101 return $this->ch_desc;
102 }

Referenced by getFeed().

+ Here is the caller graph for this function:

◆ getChannelLink()

ilFeedWriter::getChannelLink ( )

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

87 {
88 return $this->ch_link;
89 }

References $ch_link.

Referenced by getFeed().

+ Here is the caller graph for this function:

◆ getChannelTitle()

ilFeedWriter::getChannelTitle ( )

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

73 {
74 return $this->ch_title;
75 }

References $ch_title.

Referenced by getFeed().

+ Here is the caller graph for this function:

◆ getContextPath()

ilFeedWriter::getContextPath (   $a_ref_id)

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

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

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

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

+ Here is the caller graph for this function:

◆ getEncoding()

ilFeedWriter::getEncoding ( )

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

47 {
48 return $this->encoding;
49 }

References $encoding.

Referenced by getFeed().

+ Here is the caller graph for this function:

◆ getFeed()

ilFeedWriter::getFeed ( )

get feed xml

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

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

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

Referenced by showFeed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItems()

ilFeedWriter::getItems ( )

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

114 {
115 return $this->items;
116 }

References $items.

◆ ilFeedWriter()

ilFeedWriter::ilFeedWriter ( )

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

35 {
36 }

◆ prepareStr()

ilFeedWriter::prepareStr (   $a_str)

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

119 {
120 $a_str = str_replace("&", "&", $a_str);
121 $a_str = str_replace("<", "&lt;", $a_str);
122 $a_str = str_replace(">", "&gt;", $a_str);
123 return $a_str;
124 }

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

+ Here is the caller graph for this function:

◆ setChannelAbout()

ilFeedWriter::setChannelAbout (   $a_ab)

Unique URI that defines the channel.

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

55 {
56 $this->ch_about = $a_ab;
57 }

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

+ Here is the caller graph for this function:

◆ setChannelDescription()

ilFeedWriter::setChannelDescription (   $a_desc)

Channel Description.

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

95 {
96 $this->ch_desc = $a_desc;
97 }

◆ setChannelLink()

ilFeedWriter::setChannelLink (   $a_link)

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

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

82 {
83 $this->ch_link = $a_link;
84 }

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

+ Here is the caller graph for this function:

◆ setChannelTitle()

ilFeedWriter::setChannelTitle (   $a_title)

Channel Title.

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

68 {
69 $this->ch_title = $a_title;
70 }

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

+ Here is the caller graph for this function:

◆ setEncoding()

ilFeedWriter::setEncoding (   $a_enc)

Set feed encoding.

Default is UTF-8.

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

42 {
43 $this->encoding = $a_enc;
44 }

◆ showFeed()

ilFeedWriter::showFeed ( )

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

187 {
188 header("Content-Type: text/xml; charset=UTF-8;");
189 echo $this->getFeed();
190 }
getFeed()
get feed xml

References getFeed().

+ 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: