ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilNewsDefaultRendererGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/News/interfaces/interface.ilNewsRendererGUI.php");
14 {
15  protected $lng_key;
16 
20  protected $ctrl;
21 
25  protected $lng;
26 
30  protected $news_item;
31 
35  protected $news_ref_id;
36 
43  function __construct()
44  {
45  global $DIC;
46 
47  $this->ctrl = $DIC->ctrl();
48  $this->lng = $DIC->language();
49  }
50 
54  function setNewsItem(ilNewsItem $a_news_item, $a_news_ref_id)
55  {
56  $this->news_item = $a_news_item;
57  $this->news_ref_id = $a_news_ref_id;
58  }
59 
65  function getNewsItem()
66  {
67  return $this->news_item;
68  }
69 
75  function getNewsRefId()
76  {
77  return $this->news_ref_id;
78  }
79 
80 
84  function setLanguage($a_lang_key)
85  {
86  $this->lng_key = $a_lang_key;
87  }
88 
89 
93  public function getTimelineContent()
94  {
95  return $this->getDetailContent();
96  }
97 
101  function getDetailContent()
102  {
103  if ($this->news_item->getContentTextIsLangVar())
104  {
105  $this->lng->loadLanguageModule($this->news_item->getContextObjType());
106  return $this->lng->txt($this->news_item->getContent());
107  }
108 
109  $content = $this->makeClickable($this->news_item->getContent());
110  if (!$this->news_item->getContentHtml())
111  {
112  $content = "<p>".nl2br($content)."</p>";
113  }
114  $content.= $this->news_item->getContentLong();
115 
116  return $content;
117  }
118 
125  function makeClickable($a_str)
126  {
127  // this fixes bug 8744.
128  // If the string already contains a tags our makeClickable does not work
129  if (is_int(strpos($a_str, "</a>")) && is_int(strpos($a_str, "<a")))
130  {
131  return $a_str;
132  }
133 
134  return ilUtil::makeClickable($a_str);
135  }
136 
137 
142  {
143 
144  }
145 
151  function getObjectLink()
152  {
153  include_once("./Services/Link/classes/class.ilLink.php");
154  return ilLink::_getLink($this->getNewsRefId());
155  }
156 
157 }
158 
159 ?>
getDetailContent()
Render content for detail view.string html
getTimelineContent()
Render content for timeline.string html
setLanguage($a_lang_key)
Language key.ilNewsItem news item
setNewsItem(ilNewsItem $a_news_item, $a_news_ref_id)
Set news item.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
addTimelineActions(ilAdvancedSelectionListGUI $list)
User interface class for advanced drop-down selection lists.
global $DIC
News render interface.