ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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());
106  $this->news_item->getContextObjType(),
107  $this->news_item->getContent(),
108  $this->news_item->getContentTextIsLangVar()
109  );
110  }
111 
112  $content = $this->makeClickable($this->news_item->getContent());
113  if (!$this->news_item->getContentHtml()) {
114  $content = "<p>" . nl2br($content) . "</p>";
115  }
116  $content .= $this->news_item->getContentLong();
117 
118  return $content;
119  }
120 
127  public function makeClickable($a_str)
128  {
129  // this fixes bug 8744.
130  // If the string already contains a tags our makeClickable does not work
131  if (is_int(strpos($a_str, "</a>")) && is_int(strpos($a_str, "<a"))) {
132  return $a_str;
133  }
134 
135  return ilUtil::makeClickable($a_str);
136  }
137 
138 
143  {
144  }
145 
151  public function getObjectLink()
152  {
153  include_once("./Services/Link/classes/class.ilLink.php");
154  return ilLink::_getLink($this->getNewsRefId());
155  }
156 }
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 determineNewsContent($a_context_obj_type, $a_content, $a_is_lang_var)
Determine new content.
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.