ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 getEncoding ()
 setChannelAbout ($a_ab)
 Unique URI that defines the channel.
 getChannelAbout ()
 setChannelTitle ($a_title)
 Channel Title.
 getChannelTitle ()
 setChannelLink ($a_link)
 Channel Link URL to which an HTML rendering of the channel title will link.
 getChannelLink ()
 setChannelDescription ($a_desc)
 Channel Description.
 getChannelDescription ()
 addItem ($a_item)
 Add Item Item is an object of type ilFeedItem.
 getItems ()
 prepareStr ($a_str)
 getFeed ()
 get feed xml
 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:
class.ilFeedWriter.php 54057 2014-10-07 07:58:42Z akill

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

Member Function Documentation

ilFeedWriter::addItem (   $a_item)

Add Item Item is an object of type ilFeedItem.

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

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

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

+ Here is the caller graph for this function:

ilFeedWriter::getChannelAbout ( )

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

References $ch_about.

Referenced by getFeed().

{
}

+ Here is the caller graph for this function:

ilFeedWriter::getChannelDescription ( )

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

Referenced by getFeed().

{
return $this->ch_desc;
}

+ Here is the caller graph for this function:

ilFeedWriter::getChannelLink ( )

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

References $ch_link.

Referenced by getFeed().

{
}

+ Here is the caller graph for this function:

ilFeedWriter::getChannelTitle ( )

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

References $ch_title.

Referenced by getFeed().

{
}

+ Here is the caller graph for this function:

ilFeedWriter::getContextPath (   $a_ref_id)

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

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

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

{
global $tree, $lng;
$items = array();
if ($a_ref_id > 0)
{
$path = $tree->getPathFull($a_ref_id);
// we want to show the full path, from the major container to the item
// (folders are not! treated as containers here), at least one parent item
$r_path = array_reverse($path);
$first = "";
$omit = array();
$do_omit = false;
foreach ($r_path as $key => $row)
{
if ($first == "")
{
if (in_array($row["type"], array("root", "cat", "grp", "crs")) )
{
$first = $row["child"];
}
}
$omit[$row["child"]] = $do_omit;
}
$add_it = false;
foreach ($path as $key => $row)
{
if ($first == $row["child"])
{
$add_it = true;
}
if ($add_it && !$omit[$row["child"]] &&
(($row["child"] != $a_ref_id)))
{
if ($row["title"] == "ILIAS" && $row["type"] == "root")
{
$row["title"] = $lng->txt("repository");
}
$items[] = $row["title"];
}
}
}
if (count($items) > 0)
{
return "[".implode(" > ", $items)."]";
}
return "";
}

+ Here is the caller graph for this function:

ilFeedWriter::getEncoding ( )

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

References $encoding.

Referenced by getFeed().

{
}

+ Here is the caller graph for this function:

ilFeedWriter::getFeed ( )

get feed xml

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

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

Referenced by showFeed().

{
include_once("./Services/UICore/classes/class.ilTemplate.php");
$this->tpl = new ilTemplate("tpl.rss_2_0.xml", true, true, "Services/Feeds");
$this->tpl->setVariable("XML", "xml");
$this->tpl->setVariable("CONTENT_ENCODING", $this->getEncoding());
$this->tpl->setVariable("CHANNEL_ABOUT", $this->getChannelAbout());
$this->tpl->setVariable("CHANNEL_TITLE", $this->getChannelTitle());
$this->tpl->setVariable("CHANNEL_LINK", $this->getChannelLink());
$this->tpl->setVariable("CHANNEL_DESCRIPTION", $this->getChannelDescription());
foreach($this->items as $item)
{
$this->tpl->setCurrentBlock("rdf_seq");
$this->tpl->setVariable("RESOURCE", $item->getAbout());
$this->tpl->parseCurrentBlock();
// Date
if ($item->getDate() != "")
{
$this->tpl->setCurrentBlock("date");
$d = $item->getDate();
$yyyy = substr($d, 0, 4);
$mm = substr($d, 5, 2);
$dd = substr($d, 8, 2);
$h = substr($d, 11, 2);
$m = substr($d, 14, 2);
$s = substr($d, 17, 2);
$this->tpl->setVariable("ITEM_DATE",
date("r", mktime($h, $m, $s, $mm, $dd, $yyyy)));
$this->tpl->parseCurrentBlock();
}
// Enclosure
if ($item->getEnclosureUrl() != "")
{
$this->tpl->setCurrentBlock("enclosure");
$this->tpl->setVariable("ENC_URL", $item->getEnclosureUrl());
$this->tpl->setVariable("ENC_LENGTH", $item->getEnclosureLength());
$this->tpl->setVariable("ENC_TYPE", $item->getEnclosureType());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("item");
$this->tpl->setVariable("ITEM_ABOUT", $item->getAbout());
$this->tpl->setVariable("ITEM_TITLE", $item->getTitle());
$this->tpl->setVariable("ITEM_DESCRIPTION", $item->getDescription());
$this->tpl->setVariable("ITEM_LINK", $item->getLink());
$this->tpl->parseCurrentBlock();
}
$this->tpl->parseCurrentBlock();
return $this->tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFeedWriter::getItems ( )

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

References $items.

{
return $this->items;
}
ilFeedWriter::ilFeedWriter ( )

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

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

{
}

+ Here is the caller graph for this function:

ilFeedWriter::prepareStr (   $a_str)

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

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

{
$a_str = str_replace("&", "&", $a_str);
$a_str = str_replace("<", "&lt;", $a_str);
$a_str = str_replace(">", "&gt;", $a_str);
return $a_str;
}

+ Here is the caller graph for this function:

ilFeedWriter::setChannelAbout (   $a_ab)

Unique URI that defines the channel.

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

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

{
$this->ch_about = $a_ab;
}

+ Here is the caller graph for this function:

ilFeedWriter::setChannelDescription (   $a_desc)

Channel Description.

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

{
$this->ch_desc = $a_desc;
}
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.

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

{
$this->ch_link = $a_link;
}

+ Here is the caller graph for this function:

ilFeedWriter::setChannelTitle (   $a_title)

Channel Title.

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

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

{
$this->ch_title = $a_title;
}

+ Here is the caller graph for this function:

ilFeedWriter::setEncoding (   $a_enc)

Set feed encoding.

Default is UTF-8.

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

{
$this->encoding = $a_enc;
}
ilFeedWriter::showFeed ( )

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

References getFeed().

{
header("Content-Type: text/xml; charset=UTF-8;");
echo $this->getFeed();
}

+ Here is the call graph for this function:

Field Documentation

ilFeedWriter::$ch_about = ""

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

Referenced by getChannelAbout().

ilFeedWriter::$ch_description = ""

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

ilFeedWriter::$ch_link = ""

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

Referenced by getChannelLink().

ilFeedWriter::$ch_title = ""

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

Referenced by getChannelTitle().

ilFeedWriter::$encoding = "UTF-8"

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

Referenced by getEncoding().

ilFeedWriter::$items = array()

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