ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilNewsForContextBlockGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
30 {
34  public const OBJECTS_WITH_NEWS_SUBTAB = ["category", "course", "group", "forum"];
36  protected bool $cache_hit = false;
37  protected bool $dynamic = false;
38  protected ilNewsCache $acache;
39  protected bool $show_view_selection;
40  protected bool $new_rendering = true;
41 
45  protected string $view;
47  protected ilHelpGUI $help;
48  protected ilSetting $settings;
49  protected ilTabsGUI $tabs;
50  public static string $block_type = "news";
51  public static array $st_data;
54 
55  public function __construct()
56  {
57  global $DIC;
58  $this->ctrl = $DIC->ctrl();
59  $this->lng = $DIC->language();
60  $this->user = $DIC->user();
61  $this->help = $DIC["ilHelp"];
62  $this->access = $DIC->access();
63  $this->settings = $DIC->settings();
64  $this->tabs = $DIC->tabs();
65  $this->obj_definition = $DIC["objDefinition"];
66  $this->std_request = new StandardGUIRequest(
67  $DIC->http(),
68  $DIC->refinery()
69  );
70 
71  $this->news_access = new NewsAccess($this->std_request->getRefId());
72 
73  $ilCtrl = $DIC->ctrl();
74  $lng = $DIC->language();
75  $ilUser = $DIC->user();
76  $ilHelp = $DIC["ilHelp"];
77 
79 
80  $lng->loadLanguageModule("news");
81  $ilHelp->addHelpSection("news_block");
82 
83  $this->setBlockId((string) $ilCtrl->getContextObjId());
84  $this->setLimit(5);
85  $this->setEnableNumInfo(true);
86 
87  $this->dynamic = false;
88  $this->acache = new ilNewsCache();
89  $cres = unserialize(
90  $this->acache->getEntry($ilUser->getId() . ":" . $this->std_request->getRefId()),
91  ["allowed_classes" => false]
92  );
93  $this->cache_hit = false;
94 
95  if ($this->acache->getLastAccessStatus() === "hit" && is_array($cres)) {
96  self::$st_data = ilNewsItem::prepareNewsDataFromCache($cres);
97  $this->cache_hit = true;
98  }
99  if ($this->getDynamic() && !$this->cache_hit) {
100  $this->dynamic = true;
101  $data = [];
102  } elseif (!empty(self::$st_data)) {
103  $data = self::$st_data;
104  } else {
105  $data = $this->getNewsData();
106  self::$st_data = $data;
107  }
108 
109  $this->setTitle($lng->txt("news_internal_news"));
110  $this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
111  $this->setData($data);
112  $this->allow_moving = false;
113  $this->handleView();
114 
115  $this->setPresentation(self::PRES_SEC_LIST);
116  }
117 
118  public function getNewsData(): array
119  {
120  $ilCtrl = $this->ctrl;
122 
123  $this->acache = new ilNewsCache();
124  /* $cres = $this->acache->getEntry($ilUser->getId().":".$_GET["ref_id"]);
125  if ($this->acache->getLastAccessStatus() == "hit" && false)
126  {
127  $news_data = unserialize($cres);
128  }
129  else
130  {*/
131  $news_item = new ilNewsItem();
132  $news_item->setContextObjId($ilCtrl->getContextObjId());
133  $news_item->setContextObjType($ilCtrl->getContextObjType());
134 
135  // workaround, better: reduce constructor and introduce
136  //$prevent_aggregation = $this->getProperty("prevent_aggregation");
137  $prevent_aggregation = true;
138  if ($ilCtrl->getContextObjType() !== "frm") {
139  $forum_grouping = true;
140  } else {
141  $forum_grouping = false;
142  }
143 
144 
145  $news_data = $news_item->getNewsForRefId(
146  $this->std_request->getRefId(),
147  false,
148  false,
149  0,
150  $prevent_aggregation,
151  $forum_grouping
152  );
153 
154  $this->acache->storeEntry(
155  $ilUser->getId() . ":" . $this->std_request->getRefId(),
156  serialize($news_data)
157  );
158 
159  // }
160  //var_dump($news_data);
161  return $news_data;
162  }
163 
164  public function getBlockType(): string
165  {
166  return self::$block_type;
167  }
168 
169  protected function isRepositoryObject(): bool
170  {
171  return false;
172  }
173 
174  public static function getScreenMode(): string
175  {
176  global $DIC;
177 
178  $ilCtrl = $DIC->ctrl();
179 
180  if (strtolower($ilCtrl->getCmdClass()) === "ilnewsitemgui") {
181  return IL_SCREEN_FULL;
182  }
183 
184  switch ($ilCtrl->getCmd()) {
185  case "showNews":
186  case "showFeedUrl":
187  return IL_SCREEN_CENTER;
188 
189  case "editSettings":
190  case "saveSettings":
191  return IL_SCREEN_FULL;
192 
193  default:
194  return IL_SCREEN_SIDE;
195  }
196  }
197 
198  public function executeCommand()
199  {
200  $ilCtrl = $this->ctrl;
201 
202  $next_class = $ilCtrl->getNextClass();
203  $cmd = $ilCtrl->getCmd("getHTML");
204 
205  switch ($next_class) {
206  case "ilnewsitemgui":
207  $news_item_gui = new ilNewsItemGUI();
208  $news_item_gui->setEnableEdit($this->getEnableEdit());
209  $html = $ilCtrl->forwardCommand($news_item_gui);
210  return $html;
211 
212  default:
213  return $this->$cmd();
214  }
215  }
216 
217  public function fillDataSection(): void
218  {
219  if ($this->dynamic) {
220  $this->setDataSection($this->getDynamicReload());
221  } elseif (count($this->getData()) > 0) {
222  parent::fillDataSection();
223  } else {
224  $this->setDataSection($this->getOverview());
225  }
226  }
227 
228  public function getHTML(): string
229  {
230  global $DIC;
231 
232  $ilCtrl = $this->ctrl;
233  $lng = $this->lng;
235 
236  $news_set = new ilSetting("news");
237  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
238 
239  $hide_block = ilBlockSetting::_lookup(
240  $this->getBlockType(),
241  "hide_news_block",
242  0,
243  (int) $this->block_id
244  );
245 
246  if ($this->getProperty("title") != "") {
247  $this->setTitle($this->getProperty("title"));
248  }
249 
250  $public_feed = ilBlockSetting::_lookup(
251  $this->getBlockType(),
252  "public_feed",
253  0,
254  (int) $this->block_id
255  );
256  if ($public_feed && $enable_internal_rss) {
257  // @todo: rss icon HTML: ilRSSButtonGUI::get(ilRSSButtonGUI::ICON_RSS)
258  $this->addBlockCommand(
259  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" .
260  "ref_id=" . $this->std_request->getRefId(),
261  $lng->txt("news_feed_url")
262  );
263  }
264 
265  // add edit commands
266  if ($this->news_access->canAdd()) {
267  $this->addBlockCommand(
268  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNews"),
269  $lng->txt("edit")
270  );
271 
272  $ilCtrl->setParameter($this, "add_mode", "block");
273  $this->addBlockCommand(
274  $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "createNewsItem"),
275  $lng->txt("add")
276  );
277  $ilCtrl->setParameter($this, "add_mode", "");
278  }
279 
280  if ($this->getProperty("settings")) {
281  $ref_id = $this->std_request->getRefId();
282  $obj_def = $DIC["objDefinition"];
284  $obj_type = ilObject::_lookupType($ref_id, true);
285  $obj_class = strtolower($obj_def->getClassName($obj_type));
286  $parent_gui = "ilobj" . $obj_class . "gui";
287 
288  $ilCtrl->setParameterByClass("ilcontainernewssettingsgui", "ref_id", $ref_id);
289 
290  if (in_array($obj_class, self::OBJECTS_WITH_NEWS_SUBTAB)) {
291  $this->addBlockCommand(
292  $ilCtrl->getLinkTargetByClass(["ilrepositorygui", $parent_gui, "ilcontainernewssettingsgui"], "show"),
293  $lng->txt("settings")
294  );
295  } else {
296  // not sure if this code is still used anywhere, see discussion at
297  // https://mantis.ilias.de/view.php?id=31801
298  // If ILIAS 8 beta phase does not throw this exception, we can remove this part.
299  //throw new ilException("News settings are deprecated.");
300  // the info screen will call this
301  $this->addBlockCommand(
302  $ilCtrl->getLinkTarget($this, "editSettings"),
303  $lng->txt("settings")
304  );
305  }
306  }
307 
308  // do not display hidden repository news blocks for users
309  // who do not have write permission
310  if (!$this->getEnableEdit() && $this->getRepositoryMode() &&
312  $this->getBlockType(),
313  "hide_news_block",
314  0,
315  (int) $this->block_id
316  )) {
317  return "";
318  }
319 
320  // do not display empty news blocks for users
321  // who do not have write permission
322  if (!$this->dynamic && !$this->getEnableEdit() && $this->getRepositoryMode() && count($this->getData()) === 0 &&
323  (
324  !$news_set->get("enable_rss_for_internal") ||
326  $this->getBlockType(),
327  "public_feed",
328  0,
329  (int) $this->block_id
330  )
331  )) {
332  return "";
333  }
334 
335  $en = "";
336 
337  return parent::getHTML() . $en;
338  }
339 
343  public function handleView(): void
344  {
346 
347  $this->view = (string) ilBlockSetting::_lookup(
348  $this->getBlockType(),
349  "view",
350  $ilUser->getId(),
351  (int) $this->block_id
352  );
353 
354  // check whether notices and messages exist
355  $got_notices = $got_messages = false;
356  foreach ($this->data as $row) {
357  if ((int) ($row["priority"] ?? 0) === 0) {
358  $got_notices = true;
359  }
360  if ((int) ($row["priority"] ?? 0) === 1) {
361  $got_messages = true;
362  }
363  }
364  $this->show_view_selection = false;
365 
366  if ($got_notices && $got_messages) {
367  $this->show_view_selection = true;
368  } elseif ($got_notices) {
369  $this->view = "";
370  }
371  }
372 
376  public function fillRow(array $a_set): void
377  {
378  $info = $this->getInfoForData($a_set);
379 
380  $this->tpl->setCurrentBlock("long");
381  $this->tpl->setVariable("VAL_CREATION_DATE", $info["creation_date"]);
382  $this->tpl->parseCurrentBlock();
383 
384  if ($info["ref_id"] > 0) {
385  $this->tpl->setCurrentBlock("news_context");
386  $this->tpl->setVariable("TYPE", $info["type_txt"]);
387  $this->tpl->setVariable("IMG_TYPE", $info["type_icon"]);
388  $this->tpl->setVariable("TITLE", $info["obj_title"]);
389  if ($info["user_read"] > 0) {
390  $this->tpl->setVariable("TITLE_CLASS", 'class="light"');
391  }
392 
393  $this->tpl->parseCurrentBlock();
394  }
395 
396  // title
397  $this->tpl->setVariable("VAL_TITLE", $info["news_title"]);
398 
399  if ($info["user_read"] > 0) {
400  $this->tpl->setVariable("A_CLASS", 'class="light"');
401  }
402 
403  $this->tpl->setVariable("HREF_SHOW", $info["url"]);
404  }
405 
406  public function getInfoForData(array $news): array
407  {
408  $ilCtrl = $this->ctrl;
409  $lng = $this->lng;
410  $obj_definition = $this->obj_definition;
411 
412  $info = [];
413 
414  $info["ref_id"] = $news["ref_id"] ?? 0;
415  $info["creation_date"] =
416  ilDatePresentation::formatDate(new ilDateTime($news["creation_date"], IL_CAL_DATETIME));
417 
418  // title image type
419  if (($news["ref_id"] ?? 0) > 0) {
420  if (isset($news["agg_ref_id"]) && $news["agg_ref_id"] > 0) {
421  $obj_id = ilObject::_lookupObjId($news["agg_ref_id"]);
422  $type = ilObject::_lookupType($obj_id);
423  $context_ref = $news["agg_ref_id"];
424  } else {
425  $obj_id = $news["context_obj_id"];
426  $type = $news["context_obj_type"];
427  $context_ref = $news["ref_id"];
428  }
429 
430  $lang_type = in_array($type, ["sahs", "lm", "htlm"])
431  ? "lres"
432  : "obj_" . $type;
433 
434  $type_txt = ($obj_definition->isPlugin($news["context_obj_type"]))
435  ? ilObjectPlugin::lookupTxtById($news["context_obj_type"], $lang_type)
436  : $lng->txt($lang_type);
437 
438 
439  $info["type_txt"] = $type_txt;
440  $info["type_icon"] = ilObject::_getIcon($obj_id, "tiny", $type);
441  $info["obj_title"] = ilStr::shortenWords(ilObject::_lookupTitle($obj_id));
442  $info["user_read"] = $news["user_read"];
443 
444  $ilCtrl->setParameter($this, "news_context", $context_ref);
445  } else {
446  $ilCtrl->setParameter($this, "news_context", "");
447  }
448 
449  // title
450  $info["news_title"] =
453  $news["context_obj_type"] ?? "",
454  $news["title"] ?? "",
455  $news["content_is_lang_var"] ?? false,
456  $news["agg_ref_id"] ?? 0,
457  $news["aggregation"] ?? []
458  )
459  );
460 
461 
462  $ilCtrl->setParameter($this, "news_id", $news["id"]);
463  $info["url"] =
464  $ilCtrl->getLinkTarget($this, "showNews");
465  $ilCtrl->clearParameters($this);
466 
467  return $info;
468  }
469 
470  public function getOverview(): string
471  {
472  $lng = $this->lng;
473 
474  return '<div class="small">' . (count($this->getData())) . " " . $lng->txt("news_news_items") . "</div>";
475  }
476 
477  public function showNews(): string
478  {
479  $lng = $this->lng;
480  $ilCtrl = $this->ctrl;
482  $ilAccess = $this->access;
483 
484  // workaround for dynamic mode (if cache is disabled, showNews has no data)
485  if (empty(self::$st_data)) {
486  $this->setData($this->getNewsData());
487  }
488 
489  $news_set = new ilSetting("news");
490  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
491 
492 
493  $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
494 
495  // get current item in data set
496  $previous = "";
497  reset($this->data);
498  $c = current($this->data);
499  $curr_cnt = 1;
500 
501  if ($this->std_request->getNewsId() > 0) {
502  $news = new ilNewsItem($this->std_request->getNewsId());
503  $news_context = $this->std_request->getNewsContext();
504  while ($c["id"] > 0 && (int) $c["id"] !== $this->std_request->getNewsId()) {
505  $previous = $c;
506  $c = next($this->data);
507  $curr_cnt++;
508  }
509  } else {
510  $news_page = $this->std_request->getNewsPage();
511  $news_context = 0;
512  while ($curr_cnt - 1 < $news_page) {
513  $previous = $c;
514  $c = next($this->data);
515  if ($curr_cnt - 1 === $news_page) {
516  }
517  $curr_cnt++;
518  }
519  $news = new ilNewsItem($c["id"] ?? 0);
520  if (($c["ref_id"] ?? 0) > 0) {
521  $news_context = (int) $c["ref_id"];
522  }
523  }
524 
525 
526  if (!is_array($c) && is_object($news) && $news->getId() > 0
527  && ilNewsItem::_lookupContextObjId($news->getId()) !== $ilCtrl->getContextObjId()) {
528  throw new ilException("News ID does not match object context.");
529  }
530 
531 
532  // collect news items to show
533  $news_list = [];
534  if (isset($c["aggregation"]) && is_array($c["aggregation"])) { // we have an aggregation
535  $news_list[] = [
536  "ref_id" => $c["agg_ref_id"],
537  "agg_ref_id" => $c["agg_ref_id"],
538  "aggregation" => $c["aggregation"],
539  "user_id" => "",
540  "content_type" => "text",
541  "mob_id" => 0,
542  "visibility" => "",
543  "content" => "",
544  "content_long" => "",
545  "update_date" => $news->getUpdateDate(),
546  "creation_date" => "",
547  "content_is_lang_var" => false,
548  "loc_context" => $news_context,
549  "context_obj_type" => $news->getContextObjType(),
550  "title" => ""
551  ];
552 
553  foreach ($c["aggregation"] as $c_item) {
554  ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
555  $c_item["loc_context"] = $c_item["ref_id"];
556  $c_item["loc_stop"] = $news_context;
557  $news_list[] = $c_item;
558  }
559  } else { // no aggregation, simple news item
560  $news_list[] = [
561  "id" => $news->getId(),
562  "ref_id" => $news_context,
563  "user_id" => $news->getUserId(),
564  "content_type" => $news->getContentType(),
565  "mob_id" => $news->getMobId(),
566  "visibility" => $news->getVisibility(),
567  "priority" => $news->getPriority(),
568  "content" => $news->getContent(),
569  "content_long" => $news->getContentLong(),
570  "update_date" => $news->getUpdateDate(),
571  "creation_date" => $news->getCreationDate(),
572  "context_sub_obj_type" => $news->getContextSubObjType(),
573  "context_obj_type" => $news->getContextObjType(),
574  "context_sub_obj_id" => $news->getContextSubObjId(),
575  "content_is_lang_var" => $news->getContentIsLangVar(),
576  "content_text_is_lang_var" => $news->getContentTextIsLangVar(),
577  "loc_context" => $news_context,
578  "title" => $news->getTitle()
579  ];
580  ilNewsItem::_setRead($ilUser->getId(), $this->std_request->getNewsId());
581  }
582 
583  $row_css = "";
584  $cache_deleted = false;
585  foreach ($news_list as $item) {
586  $row_css = ($row_css !== "tblrow1")
587  ? "tblrow1"
588  : "tblrow2";
589 
590  if ($item["ref_id"] > 0 && !$ilAccess->checkAccess("read", "", $item["ref_id"])) {
591  $tpl->setCurrentBlock("content");
592  $tpl->setVariable("VAL_CONTENT", $lng->txt("news_sorry_not_accessible_anymore"));
594  $tpl->setCurrentBlock("item");
595  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
597  if (!$cache_deleted) {
598  $this->acache->deleteEntry($ilUser->getId() . ":" . $this->std_request->getRefId());
599  $cache_deleted = true;
600  }
601  continue;
602  }
603 
604  // user
605  if ($item["user_id"] > 0 &&
606  \ilObjUser::userExists([$item["user_id"]])
607  ) {
608  // get login
609  if (ilObjUser::_exists($item["user_id"])) {
610  $user = new ilObjUser($item["user_id"]);
611  $displayname = $user->getLogin();
612  } else {
613  // this should actually not happen, since news entries
614  // should be deleted when the user is going to be removed
615  $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
616  }
617 
618  $tpl->setCurrentBlock("user_info");
619  $tpl->setVariable("VAL_AUTHOR", $displayname);
620  $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
622  }
623 
624  // media player
625  $ui_renderer = $this->ui->renderer();
626  $ui_factory = $this->ui->factory();
627 
628  if ($item["mob_id"] > 0 && ilObject::_exists((int) $item["mob_id"])) {
629  $media_path = $this->getMediaPath((int) $item["mob_id"]);
630  $mime = ilObjMediaObject::getMimeType($media_path);
631  if (in_array($mime, ["image/jpeg", "image/svg+xml", "image/gif", "image/png"])) {
632  $title = basename($media_path);
633  $html = $ui_renderer->render($ui_factory->image()->responsive($media_path, $title));
634  } elseif (in_array($mime, ["video/mp4"])) {
635  $video = $ui_factory->player()->video($media_path);
636  $html = $ui_renderer->render($video);
637  } elseif (in_array($mime, ["audio/mpeg"])) {
638  $audio = $ui_factory->player()->audio($media_path);
639  $html = $ui_renderer->render($audio);
640  } else {
641  // download?
642  $html = "";
643  }
644 
645 
646  $tpl->setCurrentBlock("player");
647  $tpl->setVariable(
648  "PLAYER",
649  $html
650  );
652  }
653 
654  // access
655  if ($enable_internal_rss && $item["visibility"] != "") {
656  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
657  $tpl->setCurrentBlock("access");
658  $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
659  if ($item["visibility"] === NEWS_PUBLIC ||
660  ((int) $item["priority"] === 0 &&
662  "news",
663  "public_notifications",
664  0,
665  $obj_id
666  ))) {
667  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
668  } else {
669  $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
670  }
672  }
673 
674  // content
675  $renderer = ilNewsRendererFactory::getRenderer($item["context_obj_type"]);
676  if (trim($item["content"]) != "") { // content
677  $it = new ilNewsItem($item["id"]);
678  $renderer->setNewsItem($it, $item["ref_id"]);
679  $tpl->setCurrentBlock("content");
680  $tpl->setVariable("VAL_CONTENT", $renderer->getDetailContent());
682  }
683  if ($item["update_date"] != $item["creation_date"]) { // update date
684  $tpl->setCurrentBlock("ni_update");
685  $tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
686  $tpl->setVariable(
687  "VAL_LAST_UPDATE",
688  ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME))
689  );
691  }
692 
693  // creation date
694  if ($item["creation_date"] != "") {
695  $tpl->setCurrentBlock("ni_update");
696  $tpl->setVariable(
697  "VAL_CREATION_DATE",
698  ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME))
699  );
700  $tpl->setVariable("TXT_CREATED", $lng->txt("created"));
702  }
703 
704 
705  // context / title
706  if ($news_context > 0) {
707  //$obj_id = ilObject::_lookupObjId($_GET["news_context"]);
708  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
709  $obj_type = ilObject::_lookupType($obj_id);
710  $obj_title = ilObject::_lookupTitle($obj_id);
711 
712  // file hack, not nice
713  if ($obj_type === "file") {
714  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $item["ref_id"]);
715  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "sendfile");
716  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->std_request->getRefId());
717 
718  $button = ilLinkButton::getInstance();
719  $button->setUrl($url);
720  $button->setCaption("download");
721 
722  $tpl->setCurrentBlock("download");
723  $tpl->setVariable("BUTTON_DOWNLOAD", $button->render());
725  }
726 
727  // forum hack, not nice
728  $add = "";
729  if ($obj_type === "frm" && ($item["context_sub_obj_type"] ?? "") === "pos"
730  && $item["context_sub_obj_id"] > 0) {
731  $pos = $item["context_sub_obj_id"];
733  if ($thread > 0) {
734  $add = "_" . $thread . "_" . $pos;
735  }
736  }
737 
738  // wiki hack, not nice
739  if ($obj_type === "wiki" && $item["context_sub_obj_type"] === "wpg"
740  && $item["context_sub_obj_id"] > 0) {
741  $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
742  if ($wptitle != "") {
743  $add = "_" . ilWikiUtil::makeUrlTitle($wptitle);
744  }
745  }
746 
747  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
748  $obj_type . "_" . $item["ref_id"] . $add;
749 
750  // lm page hack, not nice
751  if (
752  ($item["context_sub_obj_type"] ?? "") === "pg" &&
753  $item["context_sub_obj_id"] > 0 &&
754  in_array($obj_type, ["lm"], true)) {
755  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
756  "pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"];
757  }
758 
759  // blog posting hack, not nice
760  if ($obj_type === "blog" && ($item["context_sub_obj_type"] ?? "") === "blp"
761  && $item["context_sub_obj_id"] > 0) {
762  $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" .
763  "blog_" . $item["ref_id"] . "_" . $item["context_sub_obj_id"];
764  }
765 
766  $context_opened = false;
767  $loc_stop = $item["loc_stop"] ?? "";
768  if ($item["loc_context"] != null &&
769  $item["loc_context"] != $loc_stop
770  ) {
771  $tpl->setCurrentBlock("context");
772  $context_opened = true;
773  $cont_loc = new ilLocatorGUI();
774  $cont_loc->addContextItems($item["loc_context"], true, (int) $loc_stop);
775  $tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
776  }
777 
778  //var_dump($item);
779  $no_context_title = $item["no_context_title"] ?? false;
780  if ($no_context_title !== true) {
781  if (!$context_opened) {
782  $tpl->setCurrentBlock("context");
783  }
784  $tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
785  $tpl->setVariable("CONTEXT_TITLE", $obj_title);
786  $tpl->setVariable("IMG_CONTEXT_TITLE", ilObject::_getIcon($obj_id, "big", $obj_type));
787  }
788  if ($context_opened) {
790  }
791 
792  $tpl->setVariable("HREF_TITLE", $url_target);
793  }
794 
795  // title
796  $tpl->setVariable(
797  "VAL_TITLE",
799  $item["context_obj_type"] ?? "",
800  $item["title"] ?? "",
801  $item["content_is_lang_var"] ?? false,
802  $item["agg_ref_id"] ?? 0,
803  $item["aggregation"] ?? []
804  )
805  );
806 
807 
808  $tpl->setCurrentBlock("item");
809  $tpl->setVariable("ITEM_ROW_CSS", $row_css);
811  }
812 
813  $content = $tpl->get();
814  if ($this->getProperty("title") != "") {
815  $title = $this->getProperty("title");
816  } else {
817  $title = $lng->txt("news_internal_news");
818  }
819  $panel = $this->ui->factory()->panel()->standard($title, $this->ui->factory()->legacy($content));
820 
821  $parameter_name = 'news_page';
822 
823  $pagination = $this->ui->factory()->viewControl()->pagination()
824  ->withTargetURL($ilCtrl->getLinkTarget($this, "showNews"), "news_page")
825  ->withTotalEntries(count($this->getData()))
826  ->withPageSize(1)
827  ->withMaxPaginationButtons(10)
828  ->withCurrentPage($curr_cnt - 1);
829  $panel = $panel->withViewControls([$pagination]);
830 
831  return $this->ui->renderer()->render($panel);
832  }
833 
834  protected function getMediaPath(int $mob_id): string
835  {
836  $media_path = "";
837  if ($mob_id > 0) {
838  $mob = new ilObjMediaObject($mob_id);
839  $med = $mob->getMediaItem("Standard");
840  if (strcasecmp("Reference", $med->getLocationType()) === 0) {
841  $media_path = $med->getLocation();
842  } else {
843  $media_path = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
844  }
845  }
846  return $media_path;
847  }
848 
849  public function makeClickable(string $a_str): string
850  {
851  // this fixes bug 8744. We assume that strings that contain < and >
852  // already contain html, we do not handle these
853  if (is_int(strpos($a_str, ">")) && is_int(strpos($a_str, "<"))) {
854  return $a_str;
855  }
856 
857  return ilUtil::makeClickable($a_str);
858  }
859 
860  public function showNotifications(): void
861  {
862  $ilCtrl = $this->ctrl;
864 
866  $this->getBlockType(),
867  "view",
868  "",
869  $ilUser->getId(),
870  (int) $this->block_id
871  );
872 
873  // reload data
874  $data = $this->getNewsData();
875  $this->setData($data);
876  $this->handleView();
877 
878  if ($ilCtrl->isAsynch()) {
879  $this->send($this->getHTML());
880  }
881 
882  $ilCtrl->returnToParent($this);
883  }
884 
885  public function hideNotifications(): void
886  {
887  $ilCtrl = $this->ctrl;
889 
891  $this->getBlockType(),
892  "view",
893  "hide_notifications",
894  $ilUser->getId(),
895  (int) $this->block_id
896  );
897 
898  // reload data
899  $data = $this->getNewsData();
900  $this->setData($data);
901  $this->handleView();
902 
903  if ($ilCtrl->isAsynch()) {
904  $this->send($this->getHTML());
905  }
906 
907  $ilCtrl->returnToParent($this);
908  }
909 
913  public function editSettings(): string
914  {
915  $this->initSettingsForm();
916  return $this->settings_form->getHTML();
917  }
918 
922  public function initSettingsForm(): void
923  {
924  $lng = $this->lng;
925  $ilCtrl = $this->ctrl;
926  $ilTabs = $this->tabs;
927 
928  $ilTabs->clearTargets();
929 
930  $news_set = new ilSetting("news");
931  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
932 
933  $public = ilBlockSetting::_lookup(
934  $this->getBlockType(),
935  "public_notifications",
936  0,
937  (int) $this->block_id
938  );
939  $public_feed = ilBlockSetting::_lookup(
940  $this->getBlockType(),
941  "public_feed",
942  0,
943  (int) $this->block_id
944  );
945  $hide_block = ilBlockSetting::_lookup(
946  $this->getBlockType(),
947  "hide_news_block",
948  0,
949  (int) $this->block_id
950  );
951  $hide_news_per_date = ilBlockSetting::_lookup(
952  $this->getBlockType(),
953  "hide_news_per_date",
954  0,
955  (int) $this->block_id
956  );
957  $hide_news_date = ilBlockSetting::_lookup(
958  $this->getBlockType(),
959  "hide_news_date",
960  0,
961  (int) $this->block_id
962  );
963 
964  if (is_string($hide_news_date) && $hide_news_date !== '') {
965  $hide_news_date = explode(" ", $hide_news_date);
966  }
967 
968  $this->settings_form = new ilPropertyFormGUI();
969  $this->settings_form->setTitle($lng->txt("news_settings"));
970 
971  // hide news block for learners
972  if ($this->getProperty("hide_news_block_option")) {
973  $ch = new ilCheckboxInputGUI(
974  $lng->txt("news_hide_news_block"),
975  "hide_news_block"
976  );
977  $ch->setInfo($lng->txt("news_hide_news_block_info"));
978  $ch->setChecked((bool) $hide_block);
979  $this->settings_form->addItem($ch);
980 
981  $hnpd = new ilCheckboxInputGUI(
982  $lng->txt("news_hide_news_per_date"),
983  "hide_news_per_date"
984  );
985  $hnpd->setInfo($lng->txt("news_hide_news_per_date_info"));
986  $hnpd->setChecked((bool) $hide_news_per_date);
987 
988  $dt_prop = new ilDateTimeInputGUI(
989  $lng->txt("news_hide_news_date"),
990  "hide_news_date"
991  );
992  $dt_prop->setRequired(true);
993  if (is_array($hide_news_date) && count($hide_news_date) === 2) {
994  $dt_prop->setDate(new ilDateTime($hide_news_date[0] . ' ' . $hide_news_date[1], IL_CAL_DATETIME));
995  }
996  $dt_prop->setShowTime(true);
997  $hnpd->addSubItem($dt_prop);
998 
999  $this->settings_form->addItem($hnpd);
1000  }
1001 
1002  // default visibility
1003  if ($enable_internal_rss && $this->getProperty("default_visibility_option")) {
1004  $default_visibility = ilBlockSetting::_lookup(
1005  $this->getBlockType(),
1006  "default_visibility",
1007  0,
1008  (int) $this->block_id
1009  );
1010  if ($default_visibility == "") {
1011  $default_visibility =
1012  ilNewsItem::_getDefaultVisibilityForRefId($this->std_request->getRefId());
1013  }
1014 
1015  // Default Visibility
1016  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1017  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1018  $radio_group->addOption($radio_option);
1019  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1020  $radio_group->addOption($radio_option);
1021  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1022  $radio_group->setRequired(false);
1023  $radio_group->setValue($default_visibility);
1024  $this->settings_form->addItem($radio_group);
1025  }
1026 
1027  // public notifications
1028  if ($enable_internal_rss && $this->getProperty("public_notifications_option")) {
1029  $ch = new ilCheckboxInputGUI(
1030  $lng->txt("news_notifications_public"),
1031  "notifications_public"
1032  );
1033  $ch->setInfo($lng->txt("news_notifications_public_info"));
1034  $ch->setChecked((bool) $public);
1035  $this->settings_form->addItem($ch);
1036  }
1037 
1038  // extra rss feed
1039  if ($enable_internal_rss) {
1040  $ch = new ilCheckboxInputGUI(
1041  $lng->txt("news_public_feed"),
1042  "notifications_public_feed"
1043  );
1044  $ch->setInfo($lng->txt("news_public_feed_info"));
1045  $ch->setChecked((bool) $public_feed);
1046  $this->settings_form->addItem($ch);
1047  }
1048 
1049  $this->settings_form->addCommandButton("saveSettings", $lng->txt("save"));
1050  $this->settings_form->addCommandButton("cancelSettings", $lng->txt("cancel"));
1051  $this->settings_form->setFormAction($ilCtrl->getFormAction($this));
1052  }
1053 
1057  public static function addToSettingsForm(ilFormPropertyGUI $a_input): void
1058  {
1059  global $DIC;
1060 
1061  $std_request = new StandardGUIRequest(
1062  $DIC->http(),
1063  $DIC->refinery()
1064  );
1065 
1066  $lng = $DIC->language();
1067  $block_id = $DIC->ctrl()->getContextObjId();
1068 
1069  $news_set = new ilSetting("news");
1070  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1071 
1072  $public_feed = ilBlockSetting::_lookup(
1073  self::$block_type,
1074  "public_feed",
1075  0,
1076  $block_id
1077  );
1078  $default_visibility = ilBlockSetting::_lookup(self::$block_type, "default_visibility", 0, $block_id);
1079  if ($default_visibility == "") {
1080  $default_visibility =
1082  }
1083  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "default_visibility");
1084  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
1085  $radio_group->addOption($radio_option);
1086  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
1087  $radio_group->addOption($radio_option);
1088  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
1089  $radio_group->setRequired(false);
1090  $radio_group->setValue($default_visibility);
1091  $a_input->addSubItem($radio_group);
1092 
1093  // extra rss feed
1094  if ($enable_internal_rss) {
1095  $radio_rss = new ilCheckboxInputGUI(
1096  $lng->txt("news_public_feed"),
1097  "notifications_public_feed"
1098  );
1099  $radio_rss->setInfo($lng->txt("news_public_feed_info"));
1100  $radio_rss->setChecked((bool) $public_feed);
1101  $a_input->addSubItem($radio_rss);
1102  }
1103  }
1104 
1105  public static function writeSettings(array $a_values): void
1106  {
1107  global $DIC;
1108 
1109  $block_id = $DIC->ctrl()->getContextObjId();
1110  foreach ($a_values as $key => $value) {
1111  ilBlockSetting::_write(self::$block_type, (string) $key, (string) $value, 0, $block_id);
1112  }
1113  }
1114 
1115  public function cancelSettings(): void
1116  {
1117  $ilCtrl = $this->ctrl;
1118 
1119  $ilCtrl->returnToParent($this);
1120  }
1121 
1122  public function saveSettings(): string
1123  {
1124  $ilCtrl = $this->ctrl;
1125  $ilUser = $this->user;
1126 
1127  $this->initSettingsForm();
1128  $form = $this->settings_form;
1129  if ($form->checkInput()) {
1130  $news_set = new ilSetting("news");
1131  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1132 
1133  if ($enable_internal_rss) {
1135  $this->getBlockType(),
1136  "public_notifications",
1137  $form->getInput("notifications_public"),
1138  0,
1139  (int) $this->block_id
1140  );
1142  $this->getBlockType(),
1143  "public_feed",
1144  $form->getInput("notifications_public_feed"),
1145  0,
1146  (int) $this->block_id
1147  );
1149  $this->getBlockType(),
1150  "default_visibility",
1151  $form->getInput("default_visibility"),
1152  0,
1153  (int) $this->block_id
1154  );
1155  }
1156 
1157  if ($this->getProperty("hide_news_block_option")) {
1159  $this->getBlockType(),
1160  "hide_news_block",
1161  $form->getInput("hide_news_block"),
1162  0,
1163  (int) $this->block_id
1164  );
1166  $this->getBlockType(),
1167  "hide_news_per_date",
1168  $form->getInput("hide_news_per_date"),
1169  0,
1170  (int) $this->block_id
1171  );
1172 
1173  // hide date
1174  $hd = $this->settings_form->getItemByPostVar("hide_news_date");
1175  $hide_date = $hd->getDate();
1176  if ($hide_date instanceof ilDateTime && $form->getInput("hide_news_per_date")) {
1178  $this->getBlockType(),
1179  "hide_news_date",
1180  $hide_date->get(IL_CAL_DATETIME),
1181  0,
1182  (int) $this->block_id
1183  );
1184  } else {
1186  $this->getBlockType(),
1187  "hide_news_date",
1188  "",
1189  0,
1190  (int) $this->block_id
1191  );
1192  }
1193  }
1194 
1195  $cache = new ilNewsCache();
1196  $cache->deleteEntry($ilUser->getId() . ":" . $this->std_request->getRefId());
1197 
1198  $ilCtrl->returnToParent($this);
1199  } else {
1200  $this->settings_form->setValuesByPost();
1201  return $this->settings_form->getHTML();
1202  }
1203  return "";
1204  }
1205 
1206  public function showFeedUrl(): string
1207  {
1208  $lng = $this->lng;
1209  $ilUser = $this->user;
1210 
1211  $title = ilObject::_lookupTitle((int) $this->block_id);
1212 
1213  $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
1214  $tpl->setVariable(
1215  "TXT_TITLE",
1216  sprintf($lng->txt("news_feed_url_for"), $title)
1217  );
1218  $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
1219  $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
1220  $tpl->setVariable(
1221  "VAL_FEED_URL",
1222  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() .
1223  "&obj_id=" . $this->block_id .
1224  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1225  );
1226  $tpl->setVariable(
1227  "VAL_FEED_URL_TXT",
1228  ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() .
1229  "&obj_id=" . $this->block_id .
1230  "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true)
1231  );
1232 
1233  $panel = $this->ui->factory()->panel()->standard(
1234  $lng->txt("news_internal_news"),
1235  $this->ui->factory()->legacy($tpl->get())
1236  );
1237 
1238  return $this->ui->renderer()->render($panel);
1239  }
1240 
1241  public function getDynamic(): bool
1242  {
1243  $ilCtrl = $this->ctrl;
1244  $ilUser = $this->user;
1245 
1246  // @todo: enable js loading
1247  if ($this->new_rendering) {
1248  return false;
1249  }
1250 
1251  if ($ilCtrl->getCmd() === "hideNotifications" ||
1252  $ilCtrl->getCmd() === "showNotifications") {
1253  return false;
1254  }
1255 
1256  if ($ilCtrl->getCmdClass() !== "ilcolumngui" && $ilCtrl->getCmd() !== "enableJS") {
1257  $sess_feed_js = "";
1258  if (ilSession::get("il_feed_js") != "") {
1259  $sess_feed_js = ilSession::get("il_feed_js");
1260  }
1261 
1262  if ($sess_feed_js !== "n" &&
1263  ($ilUser->getPref("il_feed_js") !== "n" || $sess_feed_js === "y")) {
1264  // do not get feed dynamically, if cache hit is given.
1265  // if (!$this->feed->checkCacheHit())
1266  // {
1267  return true;
1268  // }
1269  }
1270  }
1271 
1272  return false;
1273  }
1274 
1275  public function getDynamicReload(): string
1276  {
1277  $ilCtrl = $this->ctrl;
1278  $lng = $this->lng;
1279 
1280  $ilCtrl->setParameterByClass(
1281  "ilcolumngui",
1282  "block_id",
1283  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1284  );
1285 
1286  $rel_tpl = new ilTemplate("tpl.dynamic_reload.html", true, true, "Services/News");
1287  $rel_tpl->setVariable("TXT_LOADING", $lng->txt("news_loading_news"));
1288  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1289  $rel_tpl->setVariable(
1290  "TARGET",
1291  $ilCtrl->getLinkTargetByClass("ilcolumngui", "updateBlock", "", true)
1292  );
1293 
1294  // no JS
1295  $rel_tpl->setVariable("TXT_NEWS_CLICK_HERE", $lng->txt("news_no_js_click_here"));
1296  $rel_tpl->setVariable(
1297  "TARGET_NO_JS",
1298  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "disableJS")
1299  );
1300 
1301  return $rel_tpl->get();
1302  }
1303 
1304  public function getJSEnabler(): string
1305  {
1306  $ilCtrl = $this->ctrl;
1307 
1308  $ilCtrl->setParameterByClass(
1309  "ilcolumngui",
1310  "block_id",
1311  "block_" . $this->getBlockType() . "_" . $this->getBlockId()
1312  );
1313  //echo "hh";
1314  $rel_tpl = new ilTemplate("tpl.js_enabler.html", true, true, "Services/News");
1315  $rel_tpl->setVariable("BLOCK_ID", "block_" . $this->getBlockType() . "_" . $this->getBlockId());
1316  $rel_tpl->setVariable(
1317  "TARGET",
1318  $ilCtrl->getLinkTargetByClass(strtolower(get_class($this)), "enableJS", "", true, false)
1319  );
1320 
1321  return $rel_tpl->get();
1322  }
1323 
1324 
1325  public function disableJS(): void
1326  {
1327  $ilCtrl = $this->ctrl;
1328  $ilUser = $this->user;
1329 
1330  ilSession::set("il_feed_js", "n");
1331  $ilUser->writePref("il_feed_js", "n");
1332  $ilCtrl->returnToParent($this);
1333  }
1334 
1335  public function enableJS(): void
1336  {
1337  $ilUser = $this->user;
1338  ilSession::set("il_feed_js", "y");
1339  $ilUser->writePref("il_feed_js", "y");
1340  $this->send($this->getHTML());
1341  }
1342 
1343  //
1344  // New rendering
1345  //
1346 
1347 
1348 
1349  protected function getListItemForData(array $data): ?\ILIAS\UI\Component\Item\Item
1350  {
1351  if ((int) ($data["id"] ?? 0) === 0) {
1352  return null;
1353  }
1354  $info = $this->getInfoForData($data);
1355 
1356  $props = [
1357  $this->lng->txt("date") => $info["creation_date"] ?? ""
1358  ];
1359 
1360  $factory = $this->ui->factory();
1361  $item = $factory->item()->standard($factory->link()->standard($info["news_title"] ?? "", $info["url"] ?? ""))
1362  ->withProperties($props);
1363  if (($info["ref_id"] ?? 0) > 0) {
1364  $item = $item->withDescription($info["type_txt"] . ": " . $info["obj_title"]);
1365  }
1366  return $item;
1367  }
1368 
1369  public function getNoItemFoundContent(): string
1370  {
1371  return $this->lng->txt("news_no_news_items");
1372  }
1373 }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjUser $user
static _getDefaultVisibilityForRefId(int $a_ref_id)
Get default visibility for reference id.
Class Factory.
const IL_CAL_DATETIME
$c
Definition: cli.php:38
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
ilObjectDefinition $obj_def
get(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static determineNewsTitle(string $a_context_obj_type, string $a_title, bool $a_content_is_lang_var, int $a_agg_ref_id=0, array $a_aggregation=[])
Determine title for news item entry.
$type
ilLanguage $lng
handleView()
Handles show/hide notification view and removes notifications if hidden.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
setLimit(int $a_limit)
setBlockId(string $a_block_id="0")
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
send(string $output)
Send.
Class ChatMainBarProvider .
setInfo(string $a_info)
setEnableNumInfo(bool $a_enablenuminfo)
Help GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User Interface for NewsItem entities.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This class represents a checkbox property in a property form.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
loadLanguageModule(string $a_module)
Load language module.
BlockGUI class for block NewsForContext.
returnToParent(object $a_gui_obj, string $a_anchor=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getRenderer(string $a_context_obj_type)
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_rowtemplatename, string $a_rowtemplatedir="")
Set Row Template Name.
parses the objects.xml it handles the xml-description of all ilias objects
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
getNextClass($a_gui_class=null)
$ref_id
Definition: ltiauth.php:67
const IL_SCREEN_FULL
This class represents a property in a property form.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
const NEWS_PUBLIC
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
ilTemplate $tpl
static _lookupTitle(int $obj_id)
const CLIENT_ID
Definition: constants.php:41
fillRow(array $a_set)
get flat list for dashboard
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
string $key
Consumer key/client ID value.
Definition: System.php:193
getClassName(string $obj_name)
static _lookupObjectId(int $ref_id)
const IL_SCREEN_CENTER
clearTargets()
clear all targets
setRequired(bool $a_required)
static userExists(array $a_usr_ids=array())
static lookupTxtById(string $plugin_id, string $lang_var)
static _getThreadForPosting(int $a_pos_id)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static lookupTitle(int $a_page_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeUrlTitle(string $a_par)
A news item can be created by different sources.
static _lookupFeedHash(int $a_user_id, bool $a_create=false)
Lookup news feed hash for user.
This class represents a property in a property form.
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:34
setTitle(string $a_title)
static addToSettingsForm(ilFormPropertyGUI $a_input)
Add inputs to the container news settings form to configure also the contextBlock options...
static prepareNewsDataFromCache(array $a_cres)
Prepare news data from cache.
This class represents a block method of a block.
$url
static _getURL(int $a_mob_id)
get directory for files of media object
static _setRead(int $a_user_id, int $a_news_id)
Set item read.
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type ...
setData(array $a_data)
ilAccessHandler $access
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
static _lookupType(int $id, bool $reference=false)
const IL_SCREEN_SIDE
static makeClickable(string $a_text, bool $detectGotoLinks=false)
static _lookupContextObjId(int $a_news_id)
Context Object ID.
getProperty(string $a_property)
static set(string $a_var, $a_val)
Set a value.
setPresentation(int $type)
static shortenWords(string $a_str, int $a_len=30, bool $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
$factory
Definition: metadata.php:75
const OBJECTS_WITH_NEWS_SUBTAB
object type names with settings->news settings subtab