Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once("./Services/News/classes/class.ilNewsItem.php");
00025 include_once("./Services/Feeds/classes/class.ilFeedItem.php");
00026 include_once("./Services/Feeds/classes/class.ilFeedWriter.php");
00027
00038 class ilUserFeedWriter extends ilFeedWriter
00039 {
00040
00041 function ilUserFeedWriter($a_user_id, $a_hash)
00042 {
00043 global $ilSetting, $lng;
00044
00045 parent::ilFeedWriter();
00046
00047
00048
00049 if ($a_user_id == "" || $a_hash == "")
00050 {
00051 return;
00052 }
00053
00054 $news_set = new ilSetting("news");
00055 if (!$news_set->get("enable_rss_for_internal"))
00056 {
00057 return;
00058 }
00059
00060 $hash = ilObjUser::_lookupFeedHash($a_user_id);
00061
00062 include_once("./Services/News/classes/class.ilNewsItem.php");
00063 $rss_period = ilNewsItem::_lookupRSSPeriod();
00064
00065 if ($a_hash == $hash)
00066 {
00067 $items = ilNewsItem::_getNewsItemsOfUser($a_user_id, true, true, $rss_period);
00068 if ($ilSetting->get('short_inst_name') != "")
00069 {
00070 $this->setChannelTitle($ilSetting->get('short_inst_name'));
00071 }
00072 else
00073 {
00074 $this->setChannelTitle("ILIAS");
00075 }
00076
00077 $this->setChannelAbout(ILIAS_HTTP_PATH);
00078 $this->setChannelLink(ILIAS_HTTP_PATH);
00079
00080 $i = 0;
00081 foreach($items as $item)
00082 {
00083 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
00084 $obj_type = ilObject::_lookupType($obj_id);
00085 $obj_title = ilObject::_lookupTitle($obj_id);
00086
00087
00088 if ($obj_type == "mcst")
00089 {
00090 include_once("./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php");
00091 if (!ilObjMediaCastAccess::_lookupOnline($obj_id))
00092 {
00093 continue;
00094 }
00095 }
00096
00097 $i++;
00098 $feed_item = new ilFeedItem();
00099 $title = ilNewsItem::determineNewsTitle
00100 ($item["context_obj_type"], $item["title"], $item["content_is_lang_var"],
00101 $item["agg_ref_id"], $item["aggregation"]);
00102
00103
00104 $cont_loc = new ilLocatorGUI();
00105 $cont_loc->addContextItems($item["ref_id"], true);
00106 $cont_loc->setTextOnly(true);
00107 $loc = "[".$cont_loc->getHTML()."]";
00108
00109
00110 $feed_item->setTitle($this->prepareStr($loc)." ".$this->prepareStr($obj_title).": ".$this->prepareStr(str_replace("<br />", " ", $title)));
00111
00112
00113 $content = $this->prepareStr(nl2br($item["content"]));
00114 $feed_item->setDescription($content);
00115 $feed_item->setLink(ILIAS_HTTP_PATH."/goto.php?client_id=".CLIENT_ID.
00116 "&target=".$item["context_obj_type"]."_".$item["ref_id"]);
00117 $feed_item->setAbout($feed_item->getLink()."&il_about_feed=".$item["id"]);
00118 $this->addItem($feed_item);
00119 }
00120 }
00121 }
00122 }
00123 ?>