ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilNewsTimelineGUI Class Reference

Timeline for news. More...

+ Collaboration diagram for ilNewsTimelineGUI:

Public Member Functions

 setEnableAddNews (bool $a_val)
 
 getEnableAddNews ()
 
 setPeriod (int $a_val)
 
 getPeriod ()
 
 setUserEditAll (bool $a_val)
 Set user can edit other users postings. More...
 
 getUserEditAll ()
 Get user can edit other users postings. More...
 
 executeCommand ()
 
 show (?ilPropertyFormGUI $form=null)
 
 getHTML (?ilPropertyFormGUI $form=null)
 
 loadMore ()
 
 save ()
 
 update ()
 
 remove ()
 

Static Public Member Functions

static getInstance (int $a_ref_id, bool $a_include_auto_entries)
 

Protected Member Functions

 __construct (int $a_ref_id, bool $a_include_auto_entries)
 
 readNewsData ($excluded=[])
 
 send (string $output)
 
 updateNewsItem ()
 
 getEditModal ($form=null)
 
 renderDeleteModal (ilTemplate $tpl)
 
 renderEditModal (?ilPropertyFormGUI $form, ilTemplate $tpl)
 
 downloadMob ()
 

Protected Attributes

ILIAS News InternalGUIService $gui
 
int $period = 0
 
ILIAS News Timeline TimelineManager $manager
 
ILIAS DI UIServices $ui
 
ILIAS Notes Service $notes
 
ILIAS HTTP Services $http
 
int $news_id
 
bool $include_auto_entries
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
int $ref_id
 
ilLanguage $lng
 
ilToolbarGUI $toolbar
 
ilObjUser $user
 
ilAccessHandler $access
 
bool $user_edit_all = false
 
StandardGUIRequest $std_request
 
bool $enable_add_news = true
 
array $news_data = null
 

Static Protected Attributes

static int $items_per_load = 20
 

Detailed Description

Timeline for news.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilNewsTimelineGUI: ilLikeGUI, ilCommentGUI

Definition at line 29 of file class.ilNewsTimelineGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNewsTimelineGUI::__construct ( int  $a_ref_id,
bool  $a_include_auto_entries 
)
protected

Definition at line 52 of file class.ilNewsTimelineGUI.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

55  {
56  global $DIC;
57 
58  $this->ctrl = $DIC->ctrl();
59  $this->tpl = $DIC["tpl"];
60  $this->ref_id = $a_ref_id;
61  $this->lng = $DIC->language();
62  $this->toolbar = $DIC->toolbar();
63  $this->user = $DIC->user();
64  $this->include_auto_entries = $a_include_auto_entries;
65  $this->access = $DIC->access();
66  $this->http = $DIC->http();
67  $this->notes = $DIC->notes();
68 
69  $this->std_request = $DIC->news()
70  ->internal()
71  ->gui()
72  ->standardRequest();
73 
74  $this->news_id = $this->std_request->getNewsId();
75 
76  $this->lng->loadLanguageModule("news");
77  $this->lng->loadLanguageModule("cont");
78  $this->ui = $DIC->ui();
79  $this->manager = $DIC->news()->internal()->domain()->timeline();
80  $this->gui = $DIC->news()->internal()->gui();
81  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ downloadMob()

ilNewsTimelineGUI::downloadMob ( )
protected

Definition at line 494 of file class.ilNewsTimelineGUI.php.

494  : void
495  {
496  $news_id = $this->std_request->getNewsId();
497  $news = new ilNewsItem($news_id);
498  $news->deliverMobFile("Standard", true);
499  }
A news item can be created by different sources.

◆ executeCommand()

ilNewsTimelineGUI::executeCommand ( )
Exceptions
ilCtrlException

Definition at line 130 of file class.ilNewsTimelineGUI.php.

References $ctrl, $news_id, ILIAS\Repository\ctrl(), ilCtrl\forwardCommand(), and ilCtrl\saveParameter().

130  : void
131  {
132  $ctrl = $this->ctrl;
133 
134  $next_class = $this->ctrl->getNextClass($this);
135  $cmd = $this->ctrl->getCmd("show");
136 
137  switch ($next_class) {
138  case "illikegui":
139  $i = new ilNewsItem($this->news_id);
140  $likef = new ilLikeFactoryGUI();
141  $like_gui = $likef->widget([$i->getContextObjId()]);
142  $ctrl->saveParameter($this, "news_id");
143  $like_gui->setObject(
144  $i->getContextObjId(),
145  $i->getContextObjType(),
146  $i->getContextSubObjId(),
147  $i->getContextSubObjType(),
149  );
150  $ret = $ctrl->forwardCommand($like_gui);
151  break;
152 
153  case strtolower(ilCommentGUI::class):
154  $i = new ilNewsItem($this->news_id);
155  $ctrl->saveParameter($this, "news_id");
156  $notes_obj_type = ($i->getContextSubObjType() == "")
157  ? $i->getContextObjType()
158  : $i->getContextSubObjType();
159  $comment_gui = $this->notes->gui()->getCommentsGUI(
160  $i->getContextObjId(),
161  $i->getContextSubObjId(),
162  $notes_obj_type,
163  $i->getId()
164  );
165  $comment_gui->setShowHeader(false);
166  $ret = $ctrl->forwardCommand($comment_gui);
167  break;
168 
169  default:
170  if (in_array($cmd, ["show", "save", "update", "loadMore", "remove", "updateNewsItem", "downloadMob"])) {
171  $this->$cmd();
172  }
173  }
174  }
forwardCommand(object $a_gui_object)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
saveParameter(object $a_gui_obj, $a_parameter)
+ Here is the call graph for this function:

◆ getEditModal()

ilNewsTimelineGUI::getEditModal (   $form = null)
protected

Definition at line 446 of file class.ilNewsTimelineGUI.php.

References ILIAS\Repository\ctrl(), ilNewsItemGUI\FORM_EDIT, ilNewsItemGUI\getEditForm(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by renderEditModal().

446  : \ILIAS\UI\Component\Modal\Modal
447  {
448  if (is_null($form)) {
450  }
451  $form->setShowTopButtons(false);
452  $form->setFormAction($this->ctrl->getFormAction($this));
453 
454 
455  //
456  $hi = new ilHiddenInputGUI("id");
457  $form->addItem($hi);
458  $act = new ilHiddenInputGUI("news_action");
459  $form->addItem($act);
460  $form->setId("news_edit_form");
461 
462  $modal = $this->gui->ui()->factory()->modal()->roundtrip(
463  $this->lng->txt("edit"),
464  $this->ui->factory()->legacy()->content($form->getHTML())
465  );
466 
467  return $modal;
468  }
This class represents a hidden form property in a property form.
static getEditForm(int $a_mode, int $a_ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnableAddNews()

ilNewsTimelineGUI::getEnableAddNews ( )

Definition at line 88 of file class.ilNewsTimelineGUI.php.

References $enable_add_news.

Referenced by getHTML().

88  : bool
89  {
91  }
+ Here is the caller graph for this function:

◆ getHTML()

ilNewsTimelineGUI::getHTML ( ?ilPropertyFormGUI  $form = null)

Definition at line 194 of file class.ilNewsTimelineGUI.php.

References Vendor\Package\$a, Vendor\Package\$d, $news_data, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), getEnableAddNews(), ilUtil\getImagePath(), ilTimelineGUI\getInstance(), ilNewsTimelineItemGUI\getInstance(), getUserEditAll(), ILIAS\Repository\lng(), readNewsData(), renderDeleteModal(), renderEditModal(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by show().

194  : string
195  {
196  // toolbar
197  if ($this->getEnableAddNews() &&
198  $this->access->checkAccess("news_add_news", "", $this->ref_id)) {
199  $this->gui->button(
200  $this->lng->txt("news_add_news"),
201  "#"
202  )->onClick("return il.News.create();")->primary()->toToolbar(true, $this->toolbar);
203  }
204 
205  $this->readNewsData();
206 
207  $timeline = ilTimelineGUI::getInstance();
208 
209  // get like widget
210  $obj_ids = array_unique(array_map(static function (array $a): int {
211  return (int) $a["context_obj_id"];
212  }, $this->news_data));
213  $likef = new ilLikeFactoryGUI();
214  $like_gui = $likef->widget($obj_ids);
215 
216  $js_items = [];
217  foreach ($this->news_data as $d) {
218  $news_item = new ilNewsItem((int) $d["id"]);
219  $item = ilNewsTimelineItemGUI::getInstance($news_item, (int) $d["ref_id"], $like_gui);
220  $item->setUserEditAll($this->getUserEditAll());
221  $timeline->addItem($item);
222  $js_items[$d["id"]] = [
223  "id" => $d["id"],
224  "user_id" => $d["user_id"],
225  "title" => $d["title"],
226  "content" => $d["content"] . $d["content_long"],
227  "content_long" => "",
228  "priority" => $d["priority"],
229  "visibility" => $d["visibility"],
230  "content_type" => $d["content_type"],
231  "mob_id" => $d["mob_id"]
232  ];
233  }
234 
235  $this->tpl->addOnLoadCode("il.News.setItems(" . json_encode($js_items, JSON_THROW_ON_ERROR) . ");");
236  $this->tpl->addOnLoadCode("il.News.setAjaxUrl('" . $this->ctrl->getLinkTarget($this, "", "", true) . "');");
237 
238  if (count($this->news_data) > 0) {
239  $ttpl = new ilTemplate("tpl.news_timeline.html", true, true, "components/ILIAS/News");
240  $ttpl->setVariable("NEWS", $timeline->render());
241  $this->renderDeleteModal($ttpl);
242  $this->renderEditModal($form, $ttpl);
243  $ttpl->setVariable("LOADER", ilUtil::getImagePath("media/loader.svg"));
244  $this->tpl->setContent($ttpl->get());
245  $html = $ttpl->get();
246  } else {
247  if ($this->getEnableAddNews()) {
248  $ttpl = new ilTemplate("tpl.news_timeline.html", true, true, "components/ILIAS/News");
249  $this->tpl->setOnScreenMessage('info', $this->lng->txt("news_timline_add_entries_info"));
250  $this->renderEditModal($form, $ttpl);
251  $this->tpl->setContent($ttpl->get());
252  $html = $ttpl->get();
253  } else {
254  $mess = $this->ui->factory()->messageBox()->info(
255  $this->lng->txt("news_timline_no_entries")
256  );
257  $html = $this->ui->renderer()->render($mess);
258  }
259  }
260 
261  $this->lng->toJS("create");
262  $this->lng->toJS("edit");
263  $this->lng->toJS("update");
264  $this->lng->toJS("save");
265 
266  $debug = false;
267  if ($debug) {
268  $this->tpl->addJavaScript("../components/ILIAS/News/resources/News.js");
269  } else {
270  $this->tpl->addJavaScript("assets/js/News.js");
271  }
272  $this->notes->gui()->initJavascript();
273  return $html;
274  }
renderDeleteModal(ilTemplate $tpl)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
A news item can be created by different sources.
static getInstance(ilNewsItem $a_news_item, int $a_news_ref_id, ilLikeGUI $a_like_gui)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getUserEditAll()
Get user can edit other users postings.
renderEditModal(?ilPropertyFormGUI $form, ilTemplate $tpl)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilNewsTimelineGUI::getInstance ( int  $a_ref_id,
bool  $a_include_auto_entries 
)
static

Definition at line 120 of file class.ilNewsTimelineGUI.php.

Referenced by ilObjGroupGUI\executeCommand(), ilObjCourseGUI\executeCommand(), and ILIAS\News\Dashboard\InternalGUIService\getTimelineGUI().

124  return new self($a_ref_id, $a_include_auto_entries);
125  }
+ Here is the caller graph for this function:

◆ getPeriod()

ilNewsTimelineGUI::getPeriod ( )

Definition at line 98 of file class.ilNewsTimelineGUI.php.

References $period.

98  : int
99  {
100  return $this->period;
101  }

◆ getUserEditAll()

ilNewsTimelineGUI::getUserEditAll ( )

Get user can edit other users postings.

Definition at line 115 of file class.ilNewsTimelineGUI.php.

References $user_edit_all.

Referenced by getHTML(), loadMore(), and remove().

115  : bool
116  {
117  return $this->user_edit_all;
118  }
+ Here is the caller graph for this function:

◆ loadMore()

ilNewsTimelineGUI::loadMore ( )

Definition at line 276 of file class.ilNewsTimelineGUI.php.

References Vendor\Package\$a, Vendor\Package\$d, $news_data, ILIAS\Repository\ctrl(), ilTimelineGUI\getInstance(), ilNewsTimelineItemGUI\getInstance(), getUserEditAll(), readNewsData(), and send().

276  : void
277  {
278  $news_item = new ilNewsItem();
279  $news_item->setContextObjId($this->ctrl->getContextObjId());
280  $news_item->setContextObjType($this->ctrl->getContextObjType());
281 
282  $excluded = $this->std_request->getRenderedNews();
283 
284  $this->readNewsData($excluded);
285 
286  $timeline = ilTimelineGUI::getInstance();
287 
288  // get like widget
289  $obj_ids = array_unique(array_map(static function ($a): int {
290  return (int) $a["context_obj_id"];
291  }, $this->news_data));
292  $likef = new ilLikeFactoryGUI();
293  $like_gui = $likef->widget($obj_ids);
294 
295  $js_items = [];
296  foreach ($this->news_data as $d) {
297  $news_item = new ilNewsItem((int) $d["id"]);
298  $item = ilNewsTimelineItemGUI::getInstance($news_item, (int) $d["ref_id"], $like_gui);
299  $item->setUserEditAll($this->getUserEditAll());
300  $timeline->addItem($item);
301  $js_items[$d["id"]] = [
302  "id" => $d["id"],
303  "user_id" => $d["user_id"],
304  "title" => $d["title"],
305  "content" => $d["content"] . $d["content_long"],
306  "content_long" => "",
307  "priority" => $d["priority"],
308  "visibility" => $d["visibility"],
309  "content_type" => $d["content_type"],
310  "mob_id" => $d["mob_id"]
311  ];
312  }
313 
314  $obj = new stdClass();
315  $obj->data = $js_items;
316  $obj->html = $timeline->render(true);
317 
318  $this->send(json_encode($obj, JSON_THROW_ON_ERROR));
319  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A news item can be created by different sources.
static getInstance(ilNewsItem $a_news_item, int $a_news_ref_id, ilLikeGUI $a_like_gui)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
getUserEditAll()
Get user can edit other users postings.
+ Here is the call graph for this function:

◆ readNewsData()

ilNewsTimelineGUI::readNewsData (   $excluded = [])
protected

Definition at line 181 of file class.ilNewsTimelineGUI.php.

References $include_auto_entries, $period, and ILIAS\Repository\ctrl().

Referenced by getHTML(), and loadMore().

181  : void
182  {
183  $this->news_data = $this->manager->getNewsData(
184  $this->ref_id,
185  $this->ctrl->getContextObjId(),
186  $this->ctrl->getContextObjType(),
189  self::$items_per_load,
190  $excluded
191  );
192  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

ilNewsTimelineGUI::remove ( )

Definition at line 437 of file class.ilNewsTimelineGUI.php.

References ilNewsItem\delete(), getUserEditAll(), send(), and ILIAS\Repository\user().

437  : void
438  {
439  $news_item = new ilNewsItem($this->std_request->getNewsId());
440  if ($this->getUserEditAll() || $this->user->getId() === $news_item->getUserId()) {
441  $news_item->delete();
442  }
443  $this->send("");
444  }
A news item can be created by different sources.
getUserEditAll()
Get user can edit other users postings.
delete()
Delete news item.
+ Here is the call graph for this function:

◆ renderDeleteModal()

ilNewsTimelineGUI::renderDeleteModal ( ilTemplate  $tpl)
protected

Definition at line 470 of file class.ilNewsTimelineGUI.php.

References $c, ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by getHTML().

470  : void
471  {
472  $mbox = $this->gui->ui()->factory()->messageBox()->confirmation(
473  $this->lng->txt("news_really_delete_news")
474  );
475  $title = $this->gui->ui()->factory()->legacy()->content("<p id='news_delete_news_title'></p>");
476  $modal = $this->gui->modal($this->lng->txt("delete"))
477  ->content([$title, $mbox])
478  ->button($this->lng->txt("delete"), "#", false, "il.News.remove(); return false;");
479  $c = $modal->getTriggerButtonComponents("");
480  $tpl->setVariable("DELETE_MODAL", $this->gui->ui()->renderer()->render($c["modal"]));
481  $tpl->setVariable("SIGNAL_ID", $c["signal"]);
482  }
$c
Definition: deliver.php:25
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderEditModal()

ilNewsTimelineGUI::renderEditModal ( ?ilPropertyFormGUI  $form,
ilTemplate  $tpl 
)
protected

Definition at line 484 of file class.ilNewsTimelineGUI.php.

References getEditModal(), HTML_Template_IT\setVariable(), and ILIAS\Repository\ui().

Referenced by getHTML().

484  : void
485  {
486  $edit_modal = $this->getEditModal($form);
487  $signal = $edit_modal->getShowSignal()->getId();
488  $close_signal = $edit_modal->getCloseSignal()->getId();
489  $tpl->setVariable("SHOW_EDIT_SIGNAL", $signal);
490  $tpl->setVariable("CLOSE_EDIT_SIGNAL", $close_signal);
491  $tpl->setVariable("EDIT_MODAL", $this->ui->renderer()->render($edit_modal));
492  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilNewsTimelineGUI::save ( )

Definition at line 345 of file class.ilNewsTimelineGUI.php.

References ilObject\_lookupObjectId(), ilObject\_lookupType(), ilObjMediaObject\_saveTempFileAsMediaObject(), ILIAS\Repository\ctrl(), ilNewsItemGUI\FORM_EDIT, ilNewsItemGUI\getEditForm(), ilNewsItemGUI\isRteActivated(), show(), and ILIAS\Repository\user().

Referenced by updateNewsItem().

345  : void
346  {
348  if ($form->checkInput()) {
349  $news_item = new ilNewsItem();
350  $news_item->setTitle($form->getInput("news_title"));
351  $news_item->setContent($form->getInput("news_content"));
352  $news_item->setVisibility($form->getInput("news_visibility"));
354  $news_item->setContentHtml(true);
355  }
356  //$news_item->setContentLong($form->getInput("news_content_long"));
357  $news_item->setContentLong("");
358 
359  $obj_id = ilObject::_lookupObjectId($this->ref_id);
360  $obj_type = ilObject::_lookupType($obj_id);
361  $news_item->setContextObjId($obj_id);
362  $news_item->setContextObjType($obj_type);
363  $news_item->setUserId($this->user->getId());
364 
365  $media = $_FILES["media"];
366  if ($media["name"] != "") {
367  $mob = ilObjMediaObject::_saveTempFileAsMediaObject($media["name"], $media["tmp_name"], true);
368  $news_item->setMobId($mob->getId());
369  }
370 
371  $news_set = new ilSetting("news");
372  if (!$news_set->get("enable_rss_for_internal")) {
373  $news_item->setVisibility("users");
374  }
375  $news_item->create();
376  $this->ctrl->redirect($this, "show");
377  } else {
378  $form->setValuesByPost();
379  $this->show($form);
380  $this->tpl->addOnLoadCode("il.News.create(true);");
381  }
382  }
show(?ilPropertyFormGUI $form=null)
static getEditForm(int $a_mode, int $a_ref_id)
static _lookupObjectId(int $ref_id)
static _saveTempFileAsMediaObject(string $name, string $tmp_name, bool $upload=true)
A news item can be created by different sources.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilNewsTimelineGUI::send ( string  $output)
protected
Exceptions
ResponseSendingException

Definition at line 324 of file class.ilNewsTimelineGUI.php.

References ILIAS\FileDelivery\http().

Referenced by loadMore(), and remove().

324  : void
325  {
326  $this->http->saveResponse($this->http->response()->withBody(
327  Streams::ofString($output)
328  ));
329  $this->http->sendResponse();
330  $this->http->close();
331  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEnableAddNews()

ilNewsTimelineGUI::setEnableAddNews ( bool  $a_val)

Definition at line 83 of file class.ilNewsTimelineGUI.php.

83  : void
84  {
85  $this->enable_add_news = $a_val;
86  }

◆ setPeriod()

ilNewsTimelineGUI::setPeriod ( int  $a_val)

Definition at line 93 of file class.ilNewsTimelineGUI.php.

93  : void
94  {
95  $this->period = $a_val;
96  }

◆ setUserEditAll()

ilNewsTimelineGUI::setUserEditAll ( bool  $a_val)

Set user can edit other users postings.

Definition at line 107 of file class.ilNewsTimelineGUI.php.

107  : void
108  {
109  $this->user_edit_all = $a_val;
110  }

◆ show()

ilNewsTimelineGUI::show ( ?ilPropertyFormGUI  $form = null)

Definition at line 176 of file class.ilNewsTimelineGUI.php.

References getHTML().

Referenced by save(), and update().

176  : void
177  {
178  $this->tpl->setContent($this->getHTML($form));
179  }
getHTML(?ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilNewsTimelineGUI::update ( )

Definition at line 387 of file class.ilNewsTimelineGUI.php.

References ilObject\_lookupObjectId(), ilObject\_lookupType(), ilObjMediaObject\_saveTempFileAsMediaObject(), ILIAS\Repository\ctrl(), ilNewsItemGUI\FORM_EDIT, ilNewsItemGUI\getEditForm(), ilNewsItemGUI\isRteActivated(), ilNewsItem\setTitle(), show(), and ILIAS\Repository\user().

Referenced by updateNewsItem().

387  : void
388  {
390  if ($form->checkInput()) {
391  $news_item = new ilNewsItem($this->std_request->getId());
392  $news_item->setTitle($form->getInput("news_title"));
393  $news_item->setContent($form->getInput("news_content"));
394  $news_item->setVisibility($form->getInput("news_visibility"));
395  //$news_item->setContentLong($form->getInput("news_content_long"));
397  $news_item->setContentHtml(true);
398  }
399  $news_item->setContentLong("");
400 
401  $media = $_FILES["media"];
402  $old_mob_id = 0;
403 
404  // delete old media object
405  if ($media["name"] != "" || $this->std_request->getDeleteMedia() > 0) {
406  if ($news_item->getMobId() > 0 && ilObject::_lookupType($news_item->getMobId()) === "mob") {
407  $old_mob_id = $news_item->getMobId();
408  }
409  $news_item->setMobId(0);
410  }
411 
412  if ($media["name"] != "") {
413  $mob = ilObjMediaObject::_saveTempFileAsMediaObject($media["name"], $media["tmp_name"], true);
414  $news_item->setMobId($mob->getId());
415  }
416 
417  $obj_id = ilObject::_lookupObjectId($this->ref_id);
418 
419  if ($news_item->getContextObjId() === $obj_id) {
420  $news_item->setUpdateUserId($this->user->getId());
421  $news_item->update();
422 
423  if ($old_mob_id > 0) {
424  $old_mob = new ilObjMediaObject($old_mob_id);
425  $old_mob->delete();
426  }
427  }
428  $this->ctrl->redirect($this, "show");
429  } else {
430  $form->setValuesByPost();
431  $this->show($form);
432  $this->tpl->addOnLoadCode("il.News.edit(" . $this->std_request->getNewsId() . ", true);");
433  }
434  }
show(?ilPropertyFormGUI $form=null)
setTitle(string $a_title)
static getEditForm(int $a_mode, int $a_ref_id)
static _lookupObjectId(int $ref_id)
static _saveTempFileAsMediaObject(string $name, string $tmp_name, bool $upload=true)
A news item can be created by different sources.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNewsItem()

ilNewsTimelineGUI::updateNewsItem ( )
protected

Definition at line 333 of file class.ilNewsTimelineGUI.php.

References save(), and update().

333  : void
334  {
335  if ($this->std_request->getNewsAction() === "save") {
336  $this->save();
337  }
338  if ($this->std_request->getNewsAction() === "update") {
339  $this->update();
340  }
341  }
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilNewsTimelineGUI::$access
protected

Definition at line 45 of file class.ilNewsTimelineGUI.php.

◆ $ctrl

ilCtrl ilNewsTimelineGUI::$ctrl
protected

Definition at line 39 of file class.ilNewsTimelineGUI.php.

Referenced by executeCommand().

◆ $enable_add_news

bool ilNewsTimelineGUI::$enable_add_news = true
protected

Definition at line 49 of file class.ilNewsTimelineGUI.php.

Referenced by getEnableAddNews().

◆ $gui

ILIAS News InternalGUIService ilNewsTimelineGUI::$gui
protected

Definition at line 31 of file class.ilNewsTimelineGUI.php.

◆ $http

ILIAS HTTP Services ilNewsTimelineGUI::$http
protected

Definition at line 36 of file class.ilNewsTimelineGUI.php.

◆ $include_auto_entries

bool ilNewsTimelineGUI::$include_auto_entries
protected

Definition at line 38 of file class.ilNewsTimelineGUI.php.

Referenced by readNewsData().

◆ $items_per_load

int ilNewsTimelineGUI::$items_per_load = 20
staticprotected

Definition at line 46 of file class.ilNewsTimelineGUI.php.

◆ $lng

ilLanguage ilNewsTimelineGUI::$lng
protected

Definition at line 42 of file class.ilNewsTimelineGUI.php.

◆ $manager

ILIAS News Timeline TimelineManager ilNewsTimelineGUI::$manager
protected

Definition at line 33 of file class.ilNewsTimelineGUI.php.

◆ $news_data

array ilNewsTimelineGUI::$news_data = null
protected

Definition at line 50 of file class.ilNewsTimelineGUI.php.

Referenced by getHTML(), and loadMore().

◆ $news_id

int ilNewsTimelineGUI::$news_id
protected

Definition at line 37 of file class.ilNewsTimelineGUI.php.

Referenced by executeCommand().

◆ $notes

ILIAS Notes Service ilNewsTimelineGUI::$notes
protected

Definition at line 35 of file class.ilNewsTimelineGUI.php.

◆ $period

int ilNewsTimelineGUI::$period = 0
protected

Definition at line 32 of file class.ilNewsTimelineGUI.php.

Referenced by getPeriod(), and readNewsData().

◆ $ref_id

int ilNewsTimelineGUI::$ref_id
protected

Definition at line 41 of file class.ilNewsTimelineGUI.php.

◆ $std_request

StandardGUIRequest ilNewsTimelineGUI::$std_request
protected

Definition at line 48 of file class.ilNewsTimelineGUI.php.

◆ $toolbar

ilToolbarGUI ilNewsTimelineGUI::$toolbar
protected

Definition at line 43 of file class.ilNewsTimelineGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilNewsTimelineGUI::$tpl
protected

Definition at line 40 of file class.ilNewsTimelineGUI.php.

◆ $ui

ILIAS DI UIServices ilNewsTimelineGUI::$ui
protected

Definition at line 34 of file class.ilNewsTimelineGUI.php.

◆ $user

ilObjUser ilNewsTimelineGUI::$user
protected

Definition at line 44 of file class.ilNewsTimelineGUI.php.

◆ $user_edit_all

bool ilNewsTimelineGUI::$user_edit_all = false
protected

Definition at line 47 of file class.ilNewsTimelineGUI.php.

Referenced by getUserEditAll().


The documentation for this class was generated from the following file: