ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public function __construct()
44  {
45  global $DIC;
46 
47  $this->ctrl = $DIC->ctrl();
48  $this->lng = $DIC->language();
49  }
50 
54  public 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  public function getNewsItem()
66  {
67  return $this->news_item;
68  }
69 
75  public function getNewsRefId()
76  {
77  return $this->news_ref_id;
78  }
79 
80 
84  public 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  public function getDetailContent()
102  {
103  if ($this->news_item->getContentTextIsLangVar()) {
104  $this->lng->loadLanguageModule($this->news_item->getContextObjType());
105  return $this->lng->txt($this->news_item->getContent());
106  }
107 
108  $content = $this->makeClickable($this->news_item->getContent());
109  if (!$this->news_item->getContentHtml()) {
110  $content = "<p>" . nl2br($content) . "</p>";
111  }
112  $content.= $this->news_item->getContentLong();
113 
114  return $content;
115  }
116 
123  public function makeClickable($a_str)
124  {
125  // this fixes bug 8744.
126  // If the string already contains a tags our makeClickable does not work
127  if (is_int(strpos($a_str, "</a>")) && is_int(strpos($a_str, "<a"))) {
128  return $a_str;
129  }
130 
131  return ilUtil::makeClickable($a_str);
132  }
133 
134 
139  {
140  }
141 
147  public function getObjectLink()
148  {
149  include_once("./Services/Link/classes/class.ilLink.php");
150  return ilLink::_getLink($this->getNewsRefId());
151  }
152 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
getDetailContent()
Render content for detail view.string html
getTimelineContent()
Render content for timeline.string html
setLanguage($a_lang_key)
Language key.ilNewsItem news item
global $DIC
Definition: saml.php:7
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.
News render interface.