ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilNewsForContextBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("Services/Block/classes/class.ilBlockGUI.php");
6 
19 {
23  const OBJECTS_WITH_NEWS_SUBTAB = ["category", "course", "group", "forum"];
24 
28  protected $help;
29 
33  protected $settings;
34 
38  protected $tabs;
39 
40  public static $block_type = "news";
41  public static $st_data;
42 
43  protected $obj_definition;
44 
48  public function __construct()
49  {
50  global $DIC;
51 
52  $this->ctrl = $DIC->ctrl();
53  $this->lng = $DIC->language();
54  $this->user = $DIC->user();
55  $this->help = $DIC["ilHelp"];
56  $this->access = $DIC->access();
57  $this->settings = $DIC->settings();
58  $this->tabs = $DIC->tabs();
59  $this->obj_definition = $DIC["objDefinition"];
60 
61  $ilCtrl = $DIC->ctrl();
62  $lng = $DIC->language();
63  $ilUser = $DIC->user();
64  $ilHelp = $DIC["ilHelp"];
65 
67 
68  $lng->loadLanguageModule("news");
69  $ilHelp->addHelpSection("news_block");
70 
71  include_once("./Services/News/classes/class.ilNewsItem.php");
72  $this->setBlockId($ilCtrl->getContextObjId());
73  $this->setLimit(5);
74  $this->setEnableNumInfo(true);
75 
76  $this->dynamic = false;
77  include_once("./Services/News/classes/class.ilNewsCache.php");
78  $this->acache = new ilNewsCache();
79  $cres = unserialize($this->acache->getEntry($ilUser->getId() . ":" . $_GET["ref_id"]));
80  $this->cache_hit = false;
81 
82  if ($this->acache->getLastAccessStatus() == "hit" && is_array($cres)) {
83  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
84  $this->cache_hit = true;
85  }
86  if ($this->getDynamic() && !$this->cache_hit) {
87  $this->dynamic = true;
88  $data = array();
89  } else {
90  if (!empty(self::$st_data)) {
91  $data = self::$st_data;
92  } else {
93  $data = $this->getNewsData();
94  self::$st_data = $data;
95  }
96  }
97 
98  $this->setTitle($lng->txt("news_internal_news"));
99  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
100  $this->setData($data);
101  $this->allow_moving = false;
102  $this->handleView();
103 
104  $this->setPresentation(self::PRES_SEC_LIST);
105  }
106 
110  public function getNewsData()
111  {
112  $ilCtrl = $this->ctrl;
114 
115  include_once("./Services/News/classes/class.ilNewsCache.php");
116  $this->acache = new ilNewsCache();
117  /* $cres = $this->acache->getEntry($ilUser->getId().":".$_GET["ref_id"]);
118  if ($this->acache->getLastAccessStatus() == "hit" && false)
119  {
120  $news_data = unserialize($cres);
121  }
122  else
123  {*/
124  $news_item = new ilNewsItem();
125  $news_item->setContextObjId($ilCtrl->getContextObjId());
126  $news_item->setContextObjType($ilCtrl->getContextObjType());
127 
128  // workaround, better: reduce constructor and introduce
129  //$prevent_aggregation = $this->getProperty("prevent_aggregation");
130  $prevent_aggregation = true;
131  if ($ilCtrl->getContextObjType() != "frm") {
132  $forum_grouping = true;
133  } else {
134  $forum_grouping = false;
135  }
136 
137 
138  $news_data = $news_item->getNewsForRefId(
139  $_GET["ref_id"],
140  false,
141  false,
142  0,
143  $prevent_aggregation,
144  $forum_grouping
145  );
146 
147  $this->acache->storeEntry(
148  $ilUser->getId() . ":" . $_GET["ref_id"],
149  serialize($news_data)
150  );
151 
152  // }
153  //var_dump($news_data);
154  return $news_data;
155  }
156 
160  public function getBlockType() : string
161  {
162  return self::$block_type;
163  }
164 
168  protected function isRepositoryObject() : bool
169  {
170  return false;
171  }
172 
176  public static function getScreenMode()
177  {
178  global $DIC;
179 
180  $ilCtrl = $DIC->ctrl();
181 
182  if ($ilCtrl->getCmdClass() == "ilnewsitemgui") {
183  return IL_SCREEN_FULL;
184  }
185 
186  switch ($ilCtrl->getCmd()) {
187  case "showNews":
188  case "showFeedUrl":
189  return IL_SCREEN_CENTER;
190  break;
191 
192  case "editSettings":
193  case "saveSettings":
194  return IL_SCREEN_FULL;
195  break;
196 
197  default:
198  return IL_SCREEN_SIDE;
199  break;
200  }
201  }
202 
206  public function executeCommand()
207  {
208  $ilCtrl = $this->ctrl;
209 
210  $next_class = $ilCtrl->getNextClass();
211  $cmd = $ilCtrl->getCmd("getHTML");
212 
213  switch ($next_class) {
214  case "ilnewsitemgui":
215  include_once("./Services/News/classes/class.ilNewsItemGUI.php");
216  $news_item_gui = new ilNewsItemGUI();
217  $news_item_gui->setEnableEdit($this->getEnableEdit());
218  $html = $ilCtrl->forwardCommand($news_item_gui);
219  return $html;
220 
221  default:
222  return $this->$cmd();
223  }
224  }
225 
231  public function setEnableEdit($a_enable_edit = 0)
232  {
233  $this->enable_edit = $a_enable_edit;
234  }
235 
241  public function getEnableEdit()
242  {
243  return $this->enable_edit;
244  }
245 
249  public function fillDataSection()
250  {
251  if ($this->dynamic) {
252  $this->setDataSection($this->getDynamicReload());
253  } elseif (count($this->getData()) > 0) {
254  parent::fillDataSection();
255  } else {
256  $this->setDataSection($this->getOverview());
257  }
258  }
259 
263  public function getHTML()
264  {
265  global $DIC;
266 
267  $ilCtrl = $this->ctrl;
268  $lng = $this->lng;
270 
271  $news_set = new ilSetting("news");
272  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
273 
274  $hide_block = ilBlockSetting::_lookup(
275  $this->getBlockType(),
276  "hide_news_block",
277  0,
278  $this->block_id
279  );
280 
281  if ($this->getProperty("title") != "") {
282  $this->setTitle($this->getProperty("title"));
283  }
284 
285  $public_feed = ilBlockSetting::_lookup(
286  $this->getBlockType(),
287  "public_feed",
288  0,
289  $this->block_id
290  );
291  if ($public_feed) {
292  if ($enable_internal_rss) {
293  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
294  // @todo: rss icon HTML: ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
295  $this->addBlockCommand(
296  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" .
297  "ref_id=" . $_GET["ref_id"],
298  $lng->txt("news_feed_url")
299  );
300  }
301  }
302 
303  // add edit commands
304  if ($this->getEnableEdit()) {
305  $this->addBlockCommand(
306  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
307  $lng->txt("edit")
308  );
309 
310  $ilCtrl->setParameter($this, "add_mode", "block");
311  $this->addBlockCommand(
312  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"),
313  $lng->txt("add")
314  );
315  $ilCtrl->setParameter($this, "add_mode", "");
316  }
317 
318  if ($this->getProperty("settings") == true) {
319  $ref_id = $_GET["ref_id"];
320  $obj_def = $DIC["objDefinition"];
321  $obj_id = ilObject::_lookupObjectId($ref_id);
322  $obj_type = ilObject::_lookupType($ref_id, true);
323  $obj_class = strtolower($obj_def->getClassName($obj_type));
324  $parent_gui = "ilobj" . $obj_class . "gui";
325 
326  $ilCtrl->setParameterByClass("ilcontainernewssettingsgui", "ref_id", $ref_id);
327 
328  if (in_array($obj_class, ilNewsForContextBlockGUI::OBJECTS_WITH_NEWS_SUBTAB)) {
329  $this->addBlockCommand(
330  $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $parent_gui, "ilcontainernewssettingsgui"), "show"),
331  $lng->txt("settings")
332  );
333  } else {
334  $this->addBlockCommand(
335  $ilCtrl->getLinkTarget($this, "editSettings"),
336  $lng->txt("settings")
337  );
338  }
339  }
340 
341  // do not display hidden repository news blocks for users
342  // who do not have write permission
343  if (!$this->getEnableEdit() && $this->getRepositoryMode() &&
345  $this->getBlockType(),
346  "hide_news_block",
347  0,
348  $this->block_id
349  )) {
350  return "";
351  }
352 
353  // do not display empty news blocks for users
354  // who do not have write permission
355  if (count($this->getData()) == 0 && !$this->getEnableEdit() &&
356  $this->getRepositoryMode() && !$this->dynamic
357  && (!$news_set->get("enable_rss_for_internal") ||
359  $this->getBlockType(),
360  "public_feed",
361  0,
362  $this->block_id
363  ))) {
364  return "";
365  }
366 
367  $en = "";
368  if ($ilUser->getPref("il_feed_js") == "n") {
369  // $en = getJSEnabler();
370  }
371 
372  return parent::getHTML() . $en;
373  }
374 
378  public function handleView()
379  {
381 
382  include_once("Services/Block/classes/class.ilBlockSetting.php");
383  $this->view = ilBlockSetting::_lookup(
384  $this->getBlockType(),
385  "view",
386  $ilUser->getId(),
388  );
389 
390  // check whether notices and messages exist
391  $got_notices = $got_messages = false;
392  foreach ($this->data as $row) {
393  if ($row["priority"] == 0) {
394  $got_notices = true;
395  }
396  if ($row["priority"] == 1) {
397  $got_messages = true;
398  }
399  }
400  $this->show_view_selection = false;
401 
402  if ($got_notices && $got_messages) {
403  $this->show_view_selection = true;
404  } elseif ($got_notices) {
405  $this->view = "";
406  }
407 
408  // remove notifications if hidden
409 /*
410  if (($this->view == "hide_notifications") && $this->show_view_selection)
411  {
412  $rset = array();
413  foreach($this->data as $k => $row)
414  {
415  if ($row["priority"] == 1)
416  {
417  $rset[$k] = $row;
418  }
419  }
420  $this->data = $rset;
421  }
422 */
423  }
424 
428  public function fillRow($data)
429  {
430  $info = $this->getInfoForData($data);
431 
432  $this->tpl->setCurrentBlock("long");
433  $this->tpl->setVariable("VAL_CREATION_DATE", $info["creation_date"]);
434  $this->tpl->parseCurrentBlock();
435 
436  if ($info["ref_id"] > 0) {
437  $this->tpl->setCurrentBlock("news_context");
438  $this->tpl->setVariable("TYPE", $info["type_txt"]);
439  $this->tpl->setVariable("IMG_TYPE", $info["type_icon"]);
440  $this->tpl->setVariable("TITLE", $info["obj_title"]);
441  if ($info["user_read"] > 0) {
442  $this->tpl->setVariable("TITLE_CLASS", 'class="light"');
443  }
444 
445  $this->tpl->parseCurrentBlock();
446  }
447 
448  // title
449  $this->tpl->setVariable("VAL_TITLE", $info["news_title"]);
450 
451  if ($info["user_read"] > 0) {
452  $this->tpl->setVariable("A_CLASS", 'class="light"');
453  }
454 
455  $this->tpl->setVariable("HREF_SHOW", $info["url"]);
456  }
457 
458  public function getInfoForData($news)
459  {
460  $ilCtrl = $this->ctrl;
461  $lng = $this->lng;
463 
464  $info = [];
465 
466  $info["ref_id"] = $news["ref_id"];
467  $info["creation_date"] =
468  ilDatePresentation::formatDate(new ilDateTime($news["creation_date"], IL_CAL_DATETIME));
469 
470  // title image type
471  if ($news["ref_id"] > 0) {
472  if ($news["agg_ref_id"] > 0) {
473  $obj_id = ilObject::_lookupObjId($news["agg_ref_id"]);
474  $type = ilObject::_lookupType($obj_id);
475  $context_ref = $news["agg_ref_id"];
476  } else {
477  $obj_id = $news["context_obj_id"];
478  $type = $news["context_obj_type"];
479  $context_ref = $news["ref_id"];
480  }
481 
482  $lang_type = in_array($type, array("sahs", "lm", "htlm"))
483  ? "lres"
484  : "obj_" . $type;
485 
486  $type_txt = ($obj_definition->isPlugin($news["context_obj_type"]))
487  ? ilObjectPlugin::lookupTxtById($news["context_obj_type"], $lang_type)
488  : $lng->txt($lang_type);
489 
490 
491  $info["type_txt"] = $type_txt;
492  $info["type_icon"] = ilObject::_getIcon($obj_id, "tiny", $type);
493  $info["obj_title"] = ilUtil::shortenWords(ilObject::_lookupTitle($obj_id));
494  $info["user_read"] = $news["user_read"];
495 
496  $ilCtrl->setParameter($this, "news_context", $context_ref);
497  } else {
498  $ilCtrl->setParameter($this, "news_context", "");
499  }
500 
501  // title
502  $info["news_title"] =
504  $news["context_obj_type"],
505  $news["title"],
506  $news["content_is_lang_var"],
507  $news["agg_ref_id"],
508  $news["aggregation"]
509  ));
510 
511 
512  $ilCtrl->setParameter($this, "news_id", $news["id"]);
513  $info["url"] =
514  $ilCtrl->getLinkTarget($this, "showNews");
515  $ilCtrl->clearParameters($this);
516 
517  return $info;
518  }
519 
523  public function getOverview()
524  {
526  $lng = $this->lng;
527  $ilCtrl = $this->ctrl;
528 
529  return '<div class="small">' . ((int) count($this->getData())) . " " . $lng->txt("news_news_items") . "</div>";
530  }
531 
535  public function showNews()
536  {
537  $lng = $this->lng;
538  $ilCtrl = $this->ctrl;
540  $ilAccess = $this->access;
541 
542  // workaround for dynamic mode (if cache is disabled, showNews has no data)
543  if (empty(self::$st_data)) {
544  $this->setData($this->getNewsData());
545  }
546 
547  $news_set = new ilSetting("news");
548  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
549 
550  include_once("./Services/News/classes/class.ilNewsItem.php");
551  $news = new ilNewsItem((int) $_GET["news_id"]);
552 
553  $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
554 
555  // get current item in data set
556  $previous = $next = "";
557  reset($this->data);
558  $c = current($this->data);
559  $curr_cnt = 1;
560 
561  while ($c["id"] > 0 &&
562  $c["id"] != $_GET["news_id"]) {
563  $previous = $c;
564  $c = next($this->data);
565  $curr_cnt++;
566  }
567 
568  if (!is_array($c) && is_object($news) && $news->getId() > 0
569  && ilNewsItem::_lookupContextObjId($news->getId()) != $ilCtrl->getContextObjId()) {
570  throw new ilException("News ID does not match object context.");
571  }
572 
573 
574  // collect news items to show
575  $news_list = array();
576  if (is_array($c["aggregation"])) { // we have an aggregation
577  $news_list[] = array("ref_id" => $c["agg_ref_id"],
578  "agg_ref_id" => $c["agg_ref_id"],
579  "aggregation" => $c["aggregation"],
580  "user_id" => "",
581  "content_type" => "text",
582  "mob_id" => 0,
583  "visibility" => "",
584  "content" => "",
585  "content_long" => "",
586  "update_date" => $news->getUpdateDate(),
587  "creation_date" => "",
588  "content_is_lang_var" => false,
589  "loc_context" => $_GET["news_context"],
590  "context_obj_type" => $news->getContextObjType(),
591  "title" => "");
592 
593  foreach ($c["aggregation"] as $c_item) {
594  ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
595  $c_item["loc_context"] = $c_item["ref_id"];
596  $c_item["loc_stop"] = $_GET["news_context"];
597  $news_list[] = $c_item;
598  }
599  } else { // no aggregation, simple news item
600  $news_list[] = array(
601  "id" => $news->getId(),
602  "ref_id" => $_GET["news_context"],
603  "user_id" => $news->getUserId(),
604  "content_type" => $news->getContentType(),
605  "mob_id" => $news->getMobId(),
606  "visibility" => $news->getVisibility(),
607  "priority" => $news->getPriority(),
608  "content" => $news->getContent(),
609  "content_long" => $news->getContentLong(),
610  "update_date" => $news->getUpdateDate(),
611  "creation_date" => $news->getCreationDate(),
612  "context_sub_obj_type" => $news->getContextSubObjType(),
613  "context_obj_type" => $news->getContextObjType(),
614  "context_sub_obj_id" => $news->getContextSubObjId(),
615  "content_is_lang_var" => $news->getContentIsLangVar(),
616  "content_text_is_lang_var" => $news->getContentTextIsLangVar(),
617  "loc_context" => $_GET["news_context"],
618  "title" => $news->getTitle());
619  ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]);
620  }
621 
622  $row_css = "";
623  $cache_deleted = false;
624  foreach ($news_list as $item) {
625  $row_css = ($row_css != "tblrow1")
626  ? "tblrow1"
627  : "tblrow2";
628 
629  if ($item["ref_id"] > 0 && !$ilAccess->checkAccess("read", "", $item["ref_id"])) {
630  $tpl->setCurrentBlock("content");
631  $tpl->setVariable("VAL_CONTENT", $lng->txt("news_sorry_not_accessible_anymore"));
632  $tpl->parseCurrentBlock();
633  $tpl->setCurrentBlock("item");
634  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
635  $tpl->parseCurrentBlock();
636  if (!$cache_deleted) {
637  $this->acache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
638  $cache_deleted = true;
639  }
640  continue;
641  }
642 
643  // user
644  if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) {
645  // get login
646  if (ilObjUser::_exists($item["user_id"])) {
647  $user = new ilObjUser($item["user_id"]);
648  $displayname = $user->getLogin();
649  } else {
650  // this should actually not happen, since news entries
651  // should be deleted when the user is going to be removed
652  $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
653  }
654 
655  $tpl->setCurrentBlock("user_info");
656  $tpl->setVariable("VAL_AUTHOR", $displayname);
657  $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
658  $tpl->parseCurrentBlock();
659  }
660 
661  // media player
662  $ui_renderer = $this->ui->renderer();
663  $ui_factory = $this->ui->factory();
664  $this->ui->factory();
665  if ($item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
666  $media_path = $this->getMediaPath($item["mob_id"]);
667  $mime = ilObjMediaObject::getMimeType($media_path);
668  if (in_array($mime, array("image/jpeg", "image/svg+xml", "image/gif", "image/png"))) {
669  $title = basename($media_path);
670  $html = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
671  } elseif (in_array($mime, array("audio/mpeg", "audio/ogg", "video/mp4", "video/x-flv", "video/webm"))) {
672  $mp = new ilMediaPlayerGUI();
673  $mp->setFile($media_path);
674  $mp->setDisplayHeight(200);
675  $html = $mp->getMediaPlayerHtml();
676  } else {
677  // download?
678  $html = "";
679  }
680 
681 
682  $tpl->setCurrentBlock("player");
683  $tpl->setVariable(
684  "PLAYER",
685  $html
686  );
687  $tpl->parseCurrentBlock();
688  }
689 
690  // access
691  if ($enable_internal_rss && $item["visibility"] != "") {
692  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
693  $tpl->setCurrentBlock("access");
694  $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
695  if ($item["visibility"] == NEWS_PUBLIC ||
696  ($item["priority"] == 0 &&
698  "news",
699  "public_notifications",
700  0,
701  $obj_id
702  ))) {
703  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
704  } else {
705  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
706  }
707  $tpl->parseCurrentBlock();
708  }
709 
710  // content
711  include_once("./Services/News/classes/class.ilNewsRendererFactory.php");
712  $renderer = ilNewsRendererFactory::getRenderer($item["context_obj_type"]);
713  if (trim($item["content"]) != "") { // content
714  $it = new ilNewsItem($item["id"]);
715  $renderer->setNewsItem($it, $item["ref_id"]);
716  $tpl->setCurrentBlock("content");
717  $tpl->setVariable("VAL_CONTENT", $renderer->getDetailContent());
718  $tpl->parseCurrentBlock();
719  }
720  if ($item["update_date"] != $item["creation_date"]) { // update date
721  $tpl->setCurrentBlock("ni_update");
722  $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
723  $tpl->setVariable(
724  "VAL_LAST_UPDATE",
725  ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME))
726  );
727  $tpl->parseCurrentBlock();
728  }
729 
730  // creation date
731  if ($item["creation_date"] != "") {
732  $tpl->setCurrentBlock("ni_update");
733  $tpl->setVariable(
734  "VAL_CREATION_DATE",
735  ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME))
736  );
737  $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
738  $tpl->parseCurrentBlock();
739  }
740 
741 
742  // context / title
743  if ($_GET["news_context"] > 0) {
744  //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
745  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
746  $obj_type = ilObject::_lookupType($obj_id);
747  $obj_title = ilObject::_lookupTitle($obj_id);
748 
749  // file hack, not nice
750  if ($obj_type == "file") {
751  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
752  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile");
753  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
754 
755  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
756  $button = ilLinkButton::getInstance();
757  $button->setUrl($url);
758  $button->setCaption("download");
759 
760  $tpl->setCurrentBlock("download");
761  $tpl->setVariable("BUTTON_DOWNLOAD", $button->render());
762  $tpl->parseCurrentBlock();
763  }
764 
765  // forum hack, not nice
766  $add = "";
767  if ($obj_type == "frm" && $item["context_sub_obj_type"] == "pos"
768  && $item["context_sub_obj_id"] > 0) {
769  include_once("./Modules/Forum/classes/class.ilObjForumAccess.php");
770  $pos = $item["context_sub_obj_id"];
772  if ($thread > 0) {
773  $add = "_" . $thread . "_" . $pos;
774  }
775  }
776 
777  // wiki hack, not nice
778  if ($obj_type == "wiki" && $item["context_sub_obj_type"] == "wpg"
779  && $item["context_sub_obj_id"] > 0) {
780  include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
781  $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
782  if ($wptitle != "") {
783  $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
784  }
785  }
786 
787  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
788  $obj_type . "_" . $item["ref_id"] . $add;
789 
790  // lm page hack, not nice
791  if (in_array($obj_type, array("lm")) && $item["context_sub_obj_type"] == "pg"
792  && $item["context_sub_obj_id"] > 0) {
793  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
794  "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
795  }
796 
797  // blog posting hack, not nice
798  if ($obj_type == "blog" && $item["context_sub_obj_type"] == "blp"
799  && $item["context_sub_obj_id"] > 0) {
800  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
801  "blog_" . $item["ref_id"] . "_" . $item["context_sub_obj_id"];
802  }
803 
804  $context_opened = false;
805  if ($item["loc_context"] != null && $item["loc_context"] != $item["loc_stop"]) {
806  $tpl->setCurrentBlock("context");
807  $context_opened = true;
808  $cont_loc = new ilLocatorGUI();
809  $cont_loc->addContextItems($item["loc_context"], true, $item["loc_stop"]);
810  $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
811  }
812 
813  //var_dump($item);
814  if ($item["no_context_title"] !== true) {
815  if (!$context_opened) {
816  $tpl->setCurrentBlock("context");
817  }
818  $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
819  $tpl->setVariable("CONTEXT_TITLE", $obj_title);
820  $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
821  }
822  if ($context_opened) {
823  $tpl->parseCurrentBlock();
824  }
825 
826  $tpl->setVariable("HREF_TITLE", $url_target);
827  }
828 
829  // title
830  $tpl->setVariable(
831  "VAL_TITLE",
833  $item["context_obj_type"],
834  $item["title"],
835  $item["content_is_lang_var"],
836  $item["agg_ref_id"],
837  $item["aggregation"]
838  )
839  );
840 
841 
842  $tpl->setCurrentBlock("item");
843  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
844  $tpl->parseCurrentBlock();
845  }
846 
847  $content_block = new ilDashboardContentBlockGUI();
848  $content_block->setContent($tpl->get());
849  if ($this->getProperty("title") != "") {
850  $content_block->setTitle($this->getProperty("title"));
851  } else {
852  $content_block->setTitle($lng->txt("news_internal_news"));
853  }
854 
855  // previous
856  if ($previous != "") {
857  if ($previous["ref_id"] > 0) {
858  $ilCtrl->setParameter($this, "news_context", $previous["ref_id"]);
859  }
860  $ilCtrl->setParameter($this, "news_id", $previous["id"]);
861  // @todo: make this a view control
862  $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, "showNews"), $lng->txt("previous"));
863  $ilCtrl->setParameter($this, "news_context", "");
864  }
865 
866  // next
867  if ($c = next($this->data)) {
868  if ($c["ref_id"] > 0) {
869  $ilCtrl->setParameter($this, "news_context", $c["ref_id"]);
870  }
871  $ilCtrl->setParameter($this, "news_id", $c["id"]);
872  // @todo: make this a view control
873  $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, "showNews"), $lng->txt("next"));
874  }
875  $ilCtrl->setParameter($this, "news_context", "");
876  $ilCtrl->setParameter($this, "news_id", "");
877  $content_block->setCurrentItemNumber($curr_cnt);
878  $content_block->setEnableNumInfo(true);
879  $content_block->setData($this->getData());
880 
881  return $content_block->getHTML();
882  }
883 
888  protected function getMediaPath(int $mob_id)
889  {
890  $media_path = "";
891  if ($mob_id > 0) {
892  $mob = new ilObjMediaObject($mob_id);
893  $med = $mob->getMediaItem("Standard");
894  if (strcasecmp("Reference", $med->getLocationType()) == 0) {
895  $media_path = $med->getLocation();
896  } else {
897  $media_path = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
898  }
899  }
900  return $media_path;
901  }
902 
909  public function makeClickable($a_str)
910  {
911  // this fixes bug 8744. We assume that strings that contain < and >
912  // already contain html, we do not handle these
913  if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
914  return $a_str;
915  }
916 
917  return ilUtil::makeClickable($a_str);
918  }
919 
920 
924  public function unsubscribeNews()
925  {
927  $ilCtrl = $this->ctrl;
928 
929  include_once("./Services/News/classes/class.ilNewsSubscription.php");
930  ilNewsSubscription::_unsubscribe($_GET["ref_id"], $ilUser->getId());
931  $ilCtrl->returnToParent($this);
932  }
933 
937  public function subscribeNews()
938  {
940  $ilCtrl = $this->ctrl;
941 
942  include_once("./Services/News/classes/class.ilNewsSubscription.php");
943  ilNewsSubscription::_subscribe($_GET["ref_id"], $ilUser->getId());
944  $ilCtrl->returnToParent($this);
945  }
946 
947 
948  public function showNotifications()
949  {
950  $ilCtrl = $this->ctrl;
952 
953  include_once("Services/Block/classes/class.ilBlockSetting.php");
955  $this->getBlockType(),
956  "view",
957  "",
958  $ilUser->getId(),
960  );
961 
962  // reload data
963  $data = $this->getNewsData();
964  $this->setData($data);
965  $this->handleView();
966 
967  if ($ilCtrl->isAsynch()) {
968  echo $this->getHTML();
969  exit;
970  } else {
971  $ilCtrl->returnToParent($this);
972  }
973  }
974 
975  public function hideNotifications()
976  {
977  $ilCtrl = $this->ctrl;
979 
980  include_once("Services/Block/classes/class.ilBlockSetting.php");
982  $this->getBlockType(),
983  "view",
984  "hide_notifications",
985  $ilUser->getId(),
987  );
988 
989  // reload data
990  $data = $this->getNewsData();
991  $this->setData($data);
992  $this->handleView();
993 
994  if ($ilCtrl->isAsynch()) {
995  echo $this->getHTML();
996  exit;
997  } else {
998  $ilCtrl->returnToParent($this);
999  }
1000  }
1001 
1005  public function editSettings()
1006  {
1007  $this->initSettingsForm();
1008  return $this->settings_form->getHTML();
1009  }
1010 
1014  public function initSettingsForm()
1015  {
1016  $ilUser = $this->user;
1017  $lng = $this->lng;
1018  $ilCtrl = $this->ctrl;
1020  $ilTabs = $this->tabs;
1021 
1022  $ilTabs->clearTargets();
1023 
1024  $news_set = new ilSetting("news");
1025  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1026 
1027  $public = ilBlockSetting::_lookup(
1028  $this->getBlockType(),
1029  "public_notifications",
1030  0,
1031  $this->block_id
1032  );
1033  $public_feed = ilBlockSetting::_lookup(
1034  $this->getBlockType(),
1035  "public_feed",
1036  0,
1037  $this->block_id
1038  );
1039  $hide_block = ilBlockSetting::_lookup(
1040  $this->getBlockType(),
1041  "hide_news_block",
1042  0,
1043  $this->block_id
1044  );
1045  $hide_news_per_date = ilBlockSetting::_lookup(
1046  $this->getBlockType(),
1047  "hide_news_per_date",
1048  0,
1049  $this->block_id
1050  );
1051  $hide_news_date = ilBlockSetting::_lookup(
1052  $this->getBlockType(),
1053  "hide_news_date",
1054  0,
1055  $this->block_id
1056  );
1057 
1058  if ($hide_news_date != "") {
1059  $hide_news_date = explode(" ", $hide_news_date);
1060  }
1061 
1062  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1063  $this->settings_form = new ilPropertyFormGUI();
1064  $this->settings_form->setTitle($lng->txt("news_settings"));
1065 
1066  // hide news block for learners
1067  if ($this->getProperty("hide_news_block_option")) {
1068  $ch = new ilCheckboxInputGUI(
1069  $lng->txt("news_hide_news_block"),
1070  "hide_news_block"
1071  );
1072  $ch->setInfo($lng->txt("news_hide_news_block_info"));
1073  $ch->setChecked($hide_block);
1074  $this->settings_form->addItem($ch);
1075 
1076  $hnpd = new ilCheckboxInputGUI(
1077  $lng->txt("news_hide_news_per_date"),
1078  "hide_news_per_date"
1079  );
1080  $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
1081  $hnpd->setChecked($hide_news_per_date);
1082 
1083  $dt_prop = new ilDateTimeInputGUI(
1084  $lng->txt("news_hide_news_date"),
1085  "hide_news_date"
1086  );
1087  $dt_prop->setRequired(true);
1088  if ($hide_news_date != "") {
1089  $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
1090  }
1091  #$dt_prop->setDate($hide_news_date[0]);
1092  #$dt_prop->setTime($hide_news_date[1]);
1093  $dt_prop->setShowTime(true);
1094  //$dt_prop->setInfo($lng->txt("news_hide_news_date_info"));
1095  $hnpd->addSubItem($dt_prop);
1096 
1097  $this->settings_form->addItem($hnpd);
1098  }
1099 
1100  // default visibility
1101  if ($this->getProperty("default_visibility_option") &&
1102  $enable_internal_rss) {
1103  $default_visibility = ilBlockSetting::_lookup(
1104  $this->getBlockType(),
1105  "default_visibility",
1106  0,
1107  $this->block_id
1108  );
1109  if ($default_visibility == "") {
1110  $default_visibility =
1112  }
1113 
1114  // Default Visibility
1115  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1116  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1117  $radio_group->addOption($radio_option);
1118  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1119  $radio_group->addOption($radio_option);
1120  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1121  $radio_group->setRequired(false);
1122  $radio_group->setValue($default_visibility);
1123  $this->settings_form->addItem($radio_group);
1124  }
1125 
1126  // public notifications
1127  if ($this->getProperty("public_notifications_option") &&
1128  $enable_internal_rss) {
1129  $ch = new ilCheckboxInputGUI(
1130  $lng->txt("news_notifications_public"),
1131  "notifications_public"
1132  );
1133  $ch->setInfo($lng->txt("news_notifications_public_info"));
1134  $ch->setChecked($public);
1135  $this->settings_form->addItem($ch);
1136  }
1137 
1138  // extra rss feed
1139  if ($enable_internal_rss) {
1140  $ch = new ilCheckboxInputGUI(
1141  $lng->txt("news_public_feed"),
1142  "notifications_public_feed"
1143  );
1144  $ch->setInfo($lng->txt("news_public_feed_info"));
1145  $ch->setChecked($public_feed);
1146  $this->settings_form->addItem($ch);
1147  }
1148 
1149 
1150  //$this->settings_form->addCheckboxProperty($lng->txt("news_public_feed"), "notifications_public_feed",
1151  // "1", $public_feed, $lng->txt("news_public_feed_info"));
1152  //if ($this->getProperty("public_notifications_option"))
1153  //{
1154  // $this->settings_form->addCheckboxProperty($lng->txt("news_notifications_public"), "notifications_public",
1155  // "1", $public, $lng->txt("news_notifications_public_info"));
1156  //}
1157  $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
1158  $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
1159  $this->settings_form->setFormAction($ilCtrl->getFormaction($this));
1160  }
1161 
1166  public static function addToSettingsForm(ilFormPropertyGUI $a_input)
1167  {
1168  global $DIC;
1169 
1170  $lng = $DIC->language();
1171  $block_id = $DIC->ctrl()->getContextObjId();
1172 
1173  $news_set = new ilSetting("news");
1174  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1175 
1176  //$public_notification = ilBlockSetting::_lookup(self::$block_type, "public_notifications",0, $block_id);
1177  $public_feed = ilBlockSetting::_lookup(
1178  self::$block_type,
1179  "public_feed",
1180  0,
1181  $block_id
1182  );
1183 
1184  $default_visibility = ilBlockSetting::_lookup(self::$block_type, "default_visibility", 0, $block_id);
1185  if ($default_visibility == "") {
1186  $default_visibility =
1188  }
1189  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1190  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1191  $radio_group->addOption($radio_option);
1192  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1193  $radio_group->addOption($radio_option);
1194  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1195  $radio_group->setRequired(false);
1196  $radio_group->setValue($default_visibility);
1197  $a_input->addSubItem($radio_group);
1198 
1199  // extra rss feed
1200  if ($enable_internal_rss) {
1201  $radio_rss = new ilCheckboxInputGUI(
1202  $lng->txt("news_public_feed"),
1203  "notifications_public_feed"
1204  );
1205  $radio_rss->setInfo($lng->txt("news_public_feed_info"));
1206  $radio_rss->setChecked($public_feed);
1207  $a_input->addSubItem($radio_rss);
1208  }
1209  }
1210 
1211  public static function writeSettings($a_values)
1212  {
1213  global $DIC;
1214 
1215  $block_id = $DIC->ctrl()->getContextObjId();
1216  foreach ($a_values as $key => $value) {
1217  ilBlockSetting::_write(self::$block_type, $key, $value, 0, $block_id);
1218  }
1219  }
1220 
1224  public function cancelSettings()
1225  {
1226  $ilCtrl = $this->ctrl;
1227 
1228  $ilCtrl->returnToParent($this);
1229  }
1230 
1234  public function saveSettings()
1235  {
1236  $ilCtrl = $this->ctrl;
1237  $ilUser = $this->user;
1238 
1239  $this->initSettingsForm();
1240  if ($this->settings_form->checkInput()) {
1241  $news_set = new ilSetting("news");
1242  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1243 
1244  if ($enable_internal_rss) {
1246  $this->getBlockType(),
1247  "public_notifications",
1248  $_POST["notifications_public"],
1249  0,
1250  $this->block_id
1251  );
1253  $this->getBlockType(),
1254  "public_feed",
1255  $_POST["notifications_public_feed"],
1256  0,
1257  $this->block_id
1258  );
1260  $this->getBlockType(),
1261  "default_visibility",
1262  $_POST["default_visibility"],
1263  0,
1264  $this->block_id
1265  );
1266  }
1267 
1268  if ($this->getProperty("hide_news_block_option")) {
1270  $this->getBlockType(),
1271  "hide_news_block",
1272  $_POST["hide_news_block"],
1273  0,
1274  $this->block_id
1275  );
1277  $this->getBlockType(),
1278  "hide_news_per_date",
1279  $_POST["hide_news_per_date"],
1280  0,
1281  $this->block_id
1282  );
1283 
1284  // hide date
1285  $hd = $this->settings_form->getItemByPostVar("hide_news_date");
1286  $hide_date = $hd->getDate();
1287  if ($_POST["hide_news_per_date"] && $hide_date != null) {
1289  $this->getBlockType(),
1290  "hide_news_date",
1291  $hide_date->get(IL_CAL_DATETIME),
1292  0,
1294  );
1295  } else {
1297  $this->getBlockType(),
1298  "hide_news_date",
1299  "",
1300  0,
1301  $this->block_id
1302  );
1303  }
1304  }
1305 
1306  include_once("./Services/News/classes/class.ilNewsCache.php");
1307  $cache = new ilNewsCache();
1308  $cache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
1309 
1310  $ilCtrl->returnToParent($this);
1311  } else {
1312  $this->settings_form->setValuesByPost();
1313  return $this->settings_form->getHtml();
1314  }
1315  }
1316 
1320  public function showFeedUrl()
1321  {
1322  $lng = $this->lng;
1323  $ilCtrl = $this->ctrl;
1324  $ilUser = $this->user;
1325 
1326  include_once("./Services/News/classes/class.ilNewsItem.php");
1327 
1328  $title = ilObject::_lookupTitle($this->block_id);
1329 
1330  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
1331  $tpl->setVariable(
1332  "TXT_TITLE",
1333  sprintf($lng->txt("news_feed_url_for"), $title)
1334  );
1335  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
1336  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
1337  $tpl->setVariable(
1338  "VAL_FEED_URL",
1339  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
1340  "&obj_id=" . $this->block_id .
1341  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1342  );
1343  $tpl->setVariable(
1344  "VAL_FEED_URL_TXT",
1345  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
1346  "&obj_id=" . $this->block_id .
1347  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1348  );
1349 
1350  $content_block = new ilDashboardContentBlockGUI();
1351  $content_block->setContent($tpl->get());
1352  $content_block->setTitle($lng->txt("news_internal_news"));
1353 
1354  return $content_block->getHTML();
1355  }
1356 
1357 
1358  public function getDynamic()
1359  {
1360  $ilCtrl = $this->ctrl;
1361  $ilUser = $this->user;
1362 
1363  // @todo: enable js loading
1364  if ($this->new_rendering) {
1365  return false;
1366  }
1367 
1368  if ($ilCtrl->getCmd() == "hideNotifications" ||
1369  $ilCtrl->getCmd() == "showNotifications") {
1370  return false;
1371  }
1372 
1373  if ($ilCtrl->getCmdClass() != "ilcolumngui" && $ilCtrl->getCmd() != "enableJS") {
1374  $sess_feed_js = "";
1375  if (isset($_SESSION["il_feed_js"])) {
1376  $sess_feed_js = $_SESSION["il_feed_js"];
1377  }
1378 
1379  if ($sess_feed_js != "n" &&
1380  ($ilUser->getPref("il_feed_js") != "n" || $sess_feed_js == "y")) {
1381  // do not get feed dynamically, if cache hit is given.
1382  // if (!$this->feed->checkCacheHit())
1383  // {
1384  return true;
1385  // }
1386  }
1387  }
1388 
1389  return false;
1390  }
1391 
1392  public function getDynamicReload()
1393  {
1394  $ilCtrl = $this->ctrl;
1395  $lng = $this->lng;
1396 
1397  $ilCtrl->setParameterByClass(
1398  "ilcolumngui",
1399  "block_id",
1400  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1401  );
1402 
1403  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/News");
1404  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("news_loading_news"));
1405  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1406  $rel_tpl->setVariable(
1407  "TARGET",
1408  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
1409  );
1410 
1411  // no JS
1412  $rel_tpl->setVariable("TXT_NEWS_CLICK_HERE", $lng->txt("news_no_js_click_here"));
1413  $rel_tpl->setVariable(
1414  "TARGET_NO_JS",
1415  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "disableJS")
1416  );
1417 
1418  return $rel_tpl->get();
1419  }
1420 
1421  public function getJSEnabler()
1422  {
1423  $ilCtrl = $this->ctrl;
1424  $lng = $this->lng;
1425 
1426  $ilCtrl->setParameterByClass(
1427  "ilcolumngui",
1428  "block_id",
1429  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1430  );
1431  //echo "hh";
1432  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/News");
1433  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1434  $rel_tpl->setVariable(
1435  "TARGET",
1436  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "enableJS", true, "", false)
1437  );
1438 
1439  return $rel_tpl->get();
1440  }
1441 
1442 
1443  public function disableJS()
1444  {
1445  $ilCtrl = $this->ctrl;
1446  $ilUser = $this->user;
1447 
1448  $_SESSION["il_feed_js"] = "n";
1449  $ilUser->writePref("il_feed_js", "n");
1450  $ilCtrl->returnToParent($this);
1451  }
1452 
1453  public function enableJS()
1454  {
1455  $ilUser = $this->user;
1456  //echo "enableJS";
1457  $_SESSION["il_feed_js"] = "y";
1458  $ilUser->writePref("il_feed_js", "y");
1459  echo $this->getHTML();
1460  exit;
1461  }
1462 
1463  //
1464  // New rendering
1465  //
1466 
1467  protected $new_rendering = true;
1468 
1469 
1473  protected function getListItemForData(array $data) : \ILIAS\UI\Component\Item\Item
1474  {
1475  $info = $this->getInfoForData($data);
1476 
1477 
1478  $props = [
1479  $this->lng->txt("date") => $info["creation_date"]
1480  ];
1481 
1482 
1483  // @todo: fix this
1484  // $info["user_read"]
1485 
1486  $factory = $this->ui->factory();
1487  $item = $factory->item()->standard($factory->link()->standard($info["news_title"], $info["url"]))
1488  ->withProperties($props);
1489  if ($info["ref_id"] > 0) {
1490  $item = $item->withDescription($info["type_txt"] . ": " . $info["obj_title"]);
1491  }
1492  return $item;
1493  }
1494 
1500  protected function getNoItemFoundContent() : string
1501  {
1502  return $this->lng->txt("news_no_news_items");
1503  }
1504 }
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
This class represents an option in a radio group.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static shortenWords($a_str, $a_len=30, $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
exit
Definition: login.php:29
static getMimeType($a_file, $a_external=null)
get mime type for file
settings()
Definition: settings.php:2
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
Class Factory.
const IL_CAL_DATETIME
$c
Definition: cli.php:37
static lookupTxtById($plugin_id, $lang_var)
$_SESSION["AccountId"]
static _getThreadForPosting($a_pos_id)
Get thread id for posting.
fillRow($data)
get flat list for personal desktop
This class represents a property form user interface.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
$type
handleView()
Handles show/hide notification view and removes notifications if hidden.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
$_GET["client_id"]
Class ChatMainBarProvider .
User Interface for NewsItem entities.
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
BlockGUI class for block NewsForContext.
getRepositoryMode()
Get RepositoryMode.
static prepareNewsDataFromCache($a_cres)
Prepare news data from cache.
setInfo($a_info)
Set Info.
static _getURL($a_mob_id)
get directory for files of media object (static)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
user()
Definition: user.php:4
News cache.
This class represents a date/time property in a property form.
static _lookupObjectId($a_ref_id)
lookup object id
locator handling class
static _unsubscribe($a_ref_id, $a_user_id)
Unsubscribe a user from an object (ref id).
help()
Definition: help.php:2
setInfo($a_info)
Set Information Text.
const IL_SCREEN_FULL
This class represents a property in a property form.
const NEWS_PUBLIC
subscribeNews()
Subscribe current user from news.
setTitle($a_title)
Set Title.
static makeUrlTitle($a_par)
Set page parameter for Url Embedding.
static _setRead($a_user_id, $a_news_id)
Set item read.
setBlockId($a_block_id=0)
Set Block Id.
setData($a_data)
Set Data.
static _lookupObjId($a_id)
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
const CLIENT_ID
Definition: constants.php:39
global $DIC
Definition: goto.php:24
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
ui()
Definition: ui.php:5
Class ilObjMediaObject.
const IL_SCREEN_CENTER
static _lookupType($a_id, $a_reference=false)
lookup object type
getBlockId()
Get Block Id.
unsubscribeNews()
Unsubscribe current user from news.
getData()
Get Data.
setLimit($a_limit)
Set Limit.
static _subscribe($a_ref_id, $a_user_id)
Subscribe a user to an object (ref id).
User interface for media player.
This class represents a property in a property form.
global $ilSetting
Definition: privfeed.php:17
__construct(Container $dic, ilPlugin $plugin)
static getRenderer($a_context_obj_type)
Get renderer.
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
static _lookupContextObjId($a_news_id)
Context Object ID.
static addToSettingsForm(ilFormPropertyGUI $a_input)
Add inputs to the container news settings form to configure also the contextBlock options...
BlockGUI class for (centered) Content on Personal Desktop.
static determineNewsTitle( $a_context_obj_type, $a_title, $a_content_is_lang_var, $a_agg_ref_id=0, $a_aggregation="")
Determine title for news item entry.
This class represents a block method of a block.
static getScreenMode()
Get Screen Mode for current command.
$url
$ilUser
Definition: imgupload.php:18
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
const IL_SCREEN_SIDE
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
$_POST["username"]
setPresentation(int $type)
Set presentation.
setRequired($a_required)
Set Required.
$factory
Definition: metadata.php:58
const OBJECTS_WITH_NEWS_SUBTAB
object type names with settings->news settings subtab
getProperty($a_property)