ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilNewsItemGUI Class Reference

User Interface for NewsItem entities. More...

+ Collaboration diagram for ilNewsItemGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getHTML ()
 Get html. More...
 
 executeCommand ()
 Execute command. More...
 
 setEnableEdit ($a_enable_edit=0)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setContextObjId ($a_context_obj_id)
 Set ContextObjId. More...
 
 getContextObjId ()
 Get ContextObjId. More...
 
 setContextObjType ($a_context_obj_type)
 Set ContextObjType. More...
 
 getContextObjType ()
 Get ContextObjType. More...
 
 setContextSubObjId ($a_context_sub_obj_id)
 Set ContextSubObjId. More...
 
 getContextSubObjId ()
 Get ContextSubObjId. More...
 
 setContextSubObjType ($a_context_sub_obj_type)
 Set ContextSubObjType. More...
 
 getContextSubObjType ()
 Get ContextSubObjType. More...
 
 setFormEditMode ($a_form_edit_mode)
 Set FormEditMode. More...
 
 getFormEditMode ()
 Get FormEditMode. More...
 
 createNewsItem ()
 FORM NewsItem: Create NewsItem. More...
 
 editNewsItem ()
 FORM NewsItem: Edit form. More...
 
 getValuesNewsItem ($a_form)
 FORM NewsItem: Get current values for NewsItem form. More...
 
 saveNewsItem ()
 FORM NewsItem: Save NewsItem. More...
 
 exitSaveNewsItem ()
 
 updateNewsItem ()
 FORM NewsItem: Save NewsItem. More...
 
 exitUpdateNewsItem ()
 
 cancelUpdateNewsItem ()
 FORM NewsItem: Save NewsItem. More...
 
 cancelSaveNewsItem ()
 FORM NewsItem: Save NewsItem. More...
 
 editNews ()
 Edit news. More...
 
 cancelUpdate ()
 Cancel update. More...
 
 confirmDeletionNewsItems ()
 Confirmation Screen. More...
 
 deleteNewsItems ()
 Delete news items. More...
 
 getNewsForContextBlock ()
 BLOCK NewsForContext: Get block HTML. More...
 
 getNewsForContextTable ()
 TABLE NewsForContext: Get table HTML. More...
 
 setTabs ()
 Set tabs. More...
 

Static Public Member Functions

static getEditForm ($a_mode, $a_ref_id)
 FORM NewsItem: Init form. More...
 
static isRteActivated ()
 Is Rte activated. More...
 

Protected Member Functions

 initFormNewsItem ($a_mode)
 FORM NewsItem: Init form. More...
 

Protected Attributes

 $enable_edit = 0
 
 $context_obj_id
 
 $context_obj_type
 
 $context_sub_obj_id
 
 $context_sub_obj_type
 
 $form_edit_mode
 

Detailed Description

User Interface for NewsItem entities.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 20 of file class.ilNewsItemGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNewsItemGUI::__construct ( )

Constructor.

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

References $_GET, $ilCtrl, $lng, array, setContextObjId(), setContextObjType(), setContextSubObjId(), setContextSubObjType(), and setEnableEdit().

34  {
35  global $ilCtrl, $lng;
36 
37  $this->ctrl = $ilCtrl;
38 
39  include_once("Services/News/classes/class.ilNewsItem.php");
40  if ($_GET["news_item_id"] > 0)
41  {
42  $this->news_item = new ilNewsItem($_GET["news_item_id"]);
43  }
44 
45  $this->ctrl->saveParameter($this, array("news_item_id"));
46 
47  // Init EnableEdit.
48  $this->setEnableEdit(false);
49 
50  // Init Context.
51  $this->setContextObjId($ilCtrl->getContextObjId());
52  $this->setContextObjType($ilCtrl->getContextObjType());
53  $this->setContextSubObjId($ilCtrl->getContextSubObjId());
54  $this->setContextSubObjType($ilCtrl->getContextSubObjType());
55 
56  $lng->loadLanguageModule("news");
57 
58  $ilCtrl->saveParameter($this, "add_mode");
59  }
$_GET["client_id"]
setContextObjId($a_context_obj_id)
Set ContextObjId.
global $ilCtrl
Definition: ilias.php:18
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
setContextObjType($a_context_obj_type)
Set ContextObjType.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelSaveNewsItem()

ilNewsItemGUI::cancelSaveNewsItem ( )

FORM NewsItem: Save NewsItem.

Definition at line 491 of file class.ilNewsItemGUI.php.

References $_GET, $ilCtrl, and editNews().

492  {
493  global $ilCtrl;
494 
495  if ($_GET["add_mode"] == "block")
496  {
497  $ilCtrl->returnToParent($this);
498  }
499  else
500  {
501  return $this->editNews();
502  }
503  }
$_GET["client_id"]
editNews()
Edit news.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ cancelUpdate()

ilNewsItemGUI::cancelUpdate ( )

Cancel update.

Definition at line 529 of file class.ilNewsItemGUI.php.

References editNews().

530  {
531  return $this->editNews();
532  }
editNews()
Edit news.
+ Here is the call graph for this function:

◆ cancelUpdateNewsItem()

ilNewsItemGUI::cancelUpdateNewsItem ( )

FORM NewsItem: Save NewsItem.

Definition at line 482 of file class.ilNewsItemGUI.php.

References editNews().

483  {
484  return $this->editNews();
485  }
editNews()
Edit news.
+ Here is the call graph for this function:

◆ confirmDeletionNewsItems()

ilNewsItemGUI::confirmDeletionNewsItems ( )

Confirmation Screen.

Definition at line 537 of file class.ilNewsItemGUI.php.

References $_POST, $ilCtrl, $lng, editNews(), getEnableEdit(), and ilUtil\sendFailure().

538  {
539  global $ilCtrl, $lng, $ilTabs;
540 
541  if (!$this->getEnableEdit())
542  {
543  return;
544  }
545 
546  // check whether at least one item is selected
547  if (count($_POST["news_id"]) == 0)
548  {
549  ilUtil::sendFailure($lng->txt("no_checkbox"));
550  return $this->editNews();
551  }
552 
553  $ilTabs->clearTargets();
554 
555  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
556  $c_gui = new ilConfirmationGUI();
557 
558  // set confirm/cancel commands
559  $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteNewsItems"));
560  $c_gui->setHeaderText($lng->txt("info_delete_sure"));
561  $c_gui->setCancel($lng->txt("cancel"), "editNews");
562  $c_gui->setConfirm($lng->txt("confirm"), "deleteNewsItems");
563 
564  // add items to delete
565  foreach($_POST["news_id"] as $news_id)
566  {
567  $news = new ilNewsItem($news_id);
568  $c_gui->addItem("news_id[]", $news_id, $news->getTitle());
569  }
570 
571  return $c_gui->getHTML();
572  }
editNews()
Edit news.
getEnableEdit()
Get EnableEdit.
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:17
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ createNewsItem()

ilNewsItemGUI::createNewsItem ( )

FORM NewsItem: Create NewsItem.

Definition at line 230 of file class.ilNewsItemGUI.php.

References IL_FORM_CREATE, and initFormNewsItem().

231  {
232  $form = $this->initFormNewsItem(IL_FORM_CREATE);
233  return $form->getHtml();
234  }
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
const IL_FORM_CREATE
+ Here is the call graph for this function:

◆ deleteNewsItems()

ilNewsItemGUI::deleteNewsItems ( )

Delete news items.

Definition at line 577 of file class.ilNewsItemGUI.php.

References $_POST, editNews(), and getEnableEdit().

578  {
579  if (!$this->getEnableEdit())
580  {
581  return;
582  }
583  // delete all selected news items
584  foreach($_POST["news_id"] as $news_id)
585  {
586  $news = new ilNewsItem($news_id);
587  $news->delete();
588  }
589 
590  return $this->editNews();
591  }
editNews()
Edit news.
getEnableEdit()
Get EnableEdit.
$_POST["username"]
+ Here is the call graph for this function:

◆ editNews()

ilNewsItemGUI::editNews ( )

Edit news.

Returns
html

Definition at line 510 of file class.ilNewsItemGUI.php.

References $ilCtrl, $lng, getEnableEdit(), getNewsForContextTable(), and setTabs().

Referenced by cancelSaveNewsItem(), cancelUpdate(), cancelUpdateNewsItem(), confirmDeletionNewsItems(), and deleteNewsItems().

511  {
512  global $ilTabs, $ilToolbar, $lng, $ilCtrl;
513 
514  $this->setTabs();
515 
516  $ilToolbar->addButton($lng->txt("news_add_news"),
517  $ilCtrl->getLinkTarget($this, "createNewsItem"));
518 
519  if (!$this->getEnableEdit())
520  {
521  return;
522  }
523  return $this->getNewsForContextTable();
524  }
getEnableEdit()
Get EnableEdit.
global $ilCtrl
Definition: ilias.php:18
getNewsForContextTable()
TABLE NewsForContext: Get table HTML.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editNewsItem()

ilNewsItemGUI::editNewsItem ( )

FORM NewsItem: Edit form.

Definition at line 240 of file class.ilNewsItemGUI.php.

References getValuesNewsItem(), IL_FORM_EDIT, and initFormNewsItem().

241  {
242  $form = $this->initFormNewsItem(IL_FORM_EDIT);
243  $this->getValuesNewsItem($form);
244  return $form->getHtml();
245 
246  }
getValuesNewsItem($a_form)
FORM NewsItem: Get current values for NewsItem form.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
const IL_FORM_EDIT
+ Here is the call graph for this function:

◆ executeCommand()

ilNewsItemGUI::executeCommand ( )

Execute command.

Definition at line 79 of file class.ilNewsItemGUI.php.

References $cmd, $html, $ilCtrl, ilNewsItem\_lookupContextObjId(), and getContextObjId().

80  {
81  global $ilCtrl;
82 
83  // check, if news item id belongs to context
84  if (is_object($this->news_item) && $this->news_item->getId() > 0
85  && ilNewsItem::_lookupContextObjId($this->news_item->getId()) != $this->getContextObjId())
86  {
87  throw new ilException("News ID does not match object context.");
88  }
89 
90 
91  // get next class and command
92  $next_class = $this->ctrl->getNextClass($this);
93  $cmd = $this->ctrl->getCmd();
94 
95  switch ($next_class)
96  {
97  default:
98  $html = $this->$cmd();
99  break;
100  }
101 
102  return $html;
103 
104  }
Base class for ILIAS Exception handling.
$cmd
Definition: sahs_server.php:35
getContextObjId()
Get ContextObjId.
global $ilCtrl
Definition: ilias.php:18
static _lookupContextObjId($a_news_id)
Context Object ID.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ exitSaveNewsItem()

ilNewsItemGUI::exitSaveNewsItem ( )

Definition at line 421 of file class.ilNewsItemGUI.php.

References $_GET, and $ilCtrl.

Referenced by saveNewsItem().

422  {
423  global $ilCtrl;
424 
425  if ($_GET["add_mode"] == "block")
426  {
427  $ilCtrl->returnToParent($this);
428  }
429  else
430  {
431  $ilCtrl->redirect($this, "editNews");
432  }
433  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ exitUpdateNewsItem()

ilNewsItemGUI::exitUpdateNewsItem ( )

Definition at line 471 of file class.ilNewsItemGUI.php.

References $ilCtrl.

Referenced by updateNewsItem().

472  {
473  global $ilCtrl;
474 
475  $ilCtrl->redirect($this, "editNews");
476  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ getContextObjId()

ilNewsItemGUI::getContextObjId ( )

Get ContextObjId.

Returns
int

Definition at line 141 of file class.ilNewsItemGUI.php.

References $context_obj_id.

Referenced by executeCommand(), getNewsForContextBlock(), getNewsForContextTable(), and saveNewsItem().

142  {
143  return $this->context_obj_id;
144  }
+ Here is the caller graph for this function:

◆ getContextObjType()

ilNewsItemGUI::getContextObjType ( )

Get ContextObjType.

Returns
int

Definition at line 161 of file class.ilNewsItemGUI.php.

References $context_obj_type.

Referenced by getNewsForContextBlock(), getNewsForContextTable(), and saveNewsItem().

162  {
164  }
+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilNewsItemGUI::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

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

References $context_sub_obj_id.

Referenced by getNewsForContextBlock(), getNewsForContextTable(), and saveNewsItem().

182  {
184  }
+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilNewsItemGUI::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

Definition at line 201 of file class.ilNewsItemGUI.php.

References $context_sub_obj_type.

Referenced by getNewsForContextBlock(), getNewsForContextTable(), and saveNewsItem().

202  {
204  }
+ Here is the caller graph for this function:

◆ getEditForm()

static ilNewsItemGUI::getEditForm (   $a_mode,
  $a_ref_id 
)
static

FORM NewsItem: Init form.

Parameters
int$a_modeForm Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)
Returns
ilPropertyFormGUI form

Definition at line 272 of file class.ilNewsItemGUI.php.

References $lng, ilNewsItem\_getDefaultVisibilityForRefId(), array, IL_FORM_CREATE, IL_FORM_RE_CREATE, ilRadioOption\setInfo(), and ilFormPropertyGUI\setInfo().

Referenced by ilNewsTimelineGUI\getEditModal(), ilNewsTimelineGUI\save(), and ilNewsTimelineGUI\update().

273  {
274  global $lng;
275 
276  $lng->loadLanguageModule("news");
277 
278  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
279 
280  $form = new ilPropertyFormGUI();
281 
282  // Property Title
283  $text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
284  $text_input->setInfo("");
285  $text_input->setRequired(true);
286  $text_input->setMaxLength(200);
287  $form->addItem($text_input);
288 
289  // Property Content
290  $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
291  $text_area->setInfo("");
292  $text_area->setRequired(false);
293  $text_area->setRows("4");
294  $text_area->setUseRte(true);
295  $form->addItem($text_area);
296 
297  // Property Visibility
298  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
299  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
300  $radio_group->addOption($radio_option);
301  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
302  $radio_group->addOption($radio_option);
303  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
304  $radio_group->setRequired(false);
305  $radio_group->setValue("users");
306  $form->addItem($radio_group);
307 
308  // Property ContentLong
309  /*
310  $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
311  $text_area->setInfo($lng->txt("news_news_item_content_long_info"));
312  $text_area->setRequired(false);
313  $text_area->setCols("40");
314  $text_area->setRows("8");
315  $text_area->setUseRte(true);
316  $form->addItem($text_area);*/
317 
318 
319  // save and cancel commands
320  if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
321  {
322  $form->addCommandButton("saveNewsItem", $lng->txt("save"), "news_btn_create");
323  $form->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"), "news_btn_cancel_create");
324  }
325  else
326  {
327  $form->addCommandButton("updateNewsItem", $lng->txt("save"), "news_btn_update");
328  $form->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"), "news_btn_cancel_update");
329  }
330 
331  $form->setTitle($lng->txt("news_news_item_head"));
332 
333  $news_set = new ilSetting("news");
334  if (!$news_set->get("enable_rss_for_internal"))
335  {
336  $form->removeItemByPostVar("news_visibility");
337  }
338  else
339  {
340  $nv = $form->getItemByPostVar("news_visibility");
341  if (is_object($nv))
342  {
343  $nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($a_ref_id));
344  }
345  }
346 
347  return $form;
348  }
This class represents an option in a radio group.
ILIAS Setting Class.
This class represents a property form user interface.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
This class represents a text property in a property form.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
This class represents a text area property in a property form.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
const IL_FORM_RE_CREATE
const IL_FORM_CREATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEnableEdit()

ilNewsItemGUI::getEnableEdit ( )

Get EnableEdit.

Returns
boolean Edit mode on/off

Definition at line 121 of file class.ilNewsItemGUI.php.

References $enable_edit.

Referenced by confirmDeletionNewsItems(), deleteNewsItems(), editNews(), getNewsForContextBlock(), saveNewsItem(), and updateNewsItem().

122  {
123  return $this->enable_edit;
124  }
+ Here is the caller graph for this function:

◆ getFormEditMode()

ilNewsItemGUI::getFormEditMode ( )

Get FormEditMode.

Returns
int Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE | IL_FORM_RE_EDIT | IL_FORM_RE_CREATE)

Definition at line 221 of file class.ilNewsItemGUI.php.

References $form_edit_mode.

222  {
223  return $this->form_edit_mode;
224  }

◆ getHTML()

ilNewsItemGUI::getHTML ( )

Get html.

Returns
string html

Definition at line 66 of file class.ilNewsItemGUI.php.

References $ilCtrl, $lng, and getNewsForContextBlock().

67  {
68  global $lng, $ilCtrl;
69 
70  $lng->LoadLanguageModule("news");
71 
72  return $this->getNewsForContextBlock();
73  }
getNewsForContextBlock()
BLOCK NewsForContext: Get block HTML.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ getNewsForContextBlock()

ilNewsItemGUI::getNewsForContextBlock ( )

BLOCK NewsForContext: Get block HTML.

Definition at line 597 of file class.ilNewsItemGUI.php.

References $data, $lng, getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), and getEnableEdit().

Referenced by getHTML().

598  {
599  global $lng;
600 
601  include_once("Services/News/classes/class.ilNewsForContextBlockGUI.php");
602  $block_gui = new ilNewsForContextBlockGUI(get_class($this));
603 
604  $block_gui->setParentClass("ilinfoscreengui");
605  $block_gui->setParentCmd("showSummary");
606  $block_gui->setEnableEdit($this->getEnableEdit());
607 
608 
609  $news_item = new ilNewsItem();
610 
611 // changed
612  //$news_item->setContextObjId($this->ctrl->getContextObjId());
613  //$news_item->setContextObjType($this->ctrl->getContextObjType());
614  $news_item->setContextObjId($this->getContextObjId());
615  $news_item->setContextObjType($this->getContextObjType());
616  $news_item->setContextSubObjId($this->getContextSubObjId());
617  $news_item->setContextSubObjType($this->getContextSubObjType());
618 
619  $data = $news_item->queryNewsForContext();
620 
621  $block_gui->setTitle($lng->txt("news_block_news_for_context"));
622  $block_gui->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
623  $block_gui->setData($data);
624 
625  return $block_gui->getHTML();
626 
627  }
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
BlockGUI class for block NewsForContext.
getEnableEdit()
Get EnableEdit.
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewsForContextTable()

ilNewsItemGUI::getNewsForContextTable ( )

TABLE NewsForContext: Get table HTML.

Definition at line 634 of file class.ilNewsItemGUI.php.

References $_GET, $data, $lng, array, getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

Referenced by editNews().

635  {
636  global $lng;
637 
638  $news_item = new ilNewsItem();
639  $news_item->setContextObjId($this->getContextObjId());
640  $news_item->setContextObjType($this->getContextObjType());
641  $news_item->setContextSubObjId($this->getContextSubObjId());
642  $news_item->setContextSubObjType($this->getContextSubObjType());
643 
644  $perm_ref_id = 0;
645  if (in_array($this->getContextObjType(), array("cat", "grp", "crs", "root")))
646  {
647  $data = $news_item->getNewsForRefId($_GET["ref_id"], false, false,
648  0, true, false, true, true);
649  }
650  else
651  {
652  $perm_ref_id = $_GET["ref_id"];
653  if ($this->getContextSubObjId() > 0)
654  {
655  $data = $news_item->queryNewsForContext(false, 0,
656  "", true, true);
657  }
658  else
659  {
660  $data = $news_item->queryNewsForContext();
661  }
662  }
663 
664  include_once("Services/News/classes/class.ilNewsForContextTableGUI.php");
665  $table_gui = new ilNewsForContextTableGUI($this, "getNewsForContextTable", $perm_ref_id);
666 
667  $table_gui->setTitle($lng->txt("news_table_news_for_context"));
668  $table_gui->setRowTemplate("tpl.table_row_news_for_context.html", "Services/News");
669  $table_gui->setData($data);
670 
671  $table_gui->setDefaultOrderField("creation_date");
672  $table_gui->setDefaultOrderDirection("desc");
673  $table_gui->addMultiCommand("confirmDeletionNewsItems", $lng->txt("delete"));
674  $table_gui->setTitle($lng->txt("news"));
675  $table_gui->setSelectAllCheckbox("news_id");
676 
677 
678  return $table_gui->getHTML();
679 
680  }
getContextSubObjId()
Get ContextSubObjId.
$_GET["client_id"]
getContextObjId()
Get ContextObjId.
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
TableGUI class for table NewsForContext.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValuesNewsItem()

ilNewsItemGUI::getValuesNewsItem (   $a_form)

FORM NewsItem: Get current values for NewsItem form.

Definition at line 354 of file class.ilNewsItemGUI.php.

References array.

Referenced by editNewsItem().

355  {
356  $values = array();
357 
358  $values["news_title"] = $this->news_item->getTitle();
359  $values["news_content"] = $this->news_item->getContent().$this->news_item->getContentLong();
360  $values["news_visibility"] = $this->news_item->getVisibility();
361  //$values["news_content_long"] = $this->news_item->getContentLong();
362  $values["news_content_long"] = "";
363 
364  $a_form->setValuesByArray($values);
365 
366  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ initFormNewsItem()

ilNewsItemGUI::initFormNewsItem (   $a_mode)
protected

FORM NewsItem: Init form.

Parameters
int$a_modeForm Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)
Returns
ilPropertyFormGUI form

Definition at line 255 of file class.ilNewsItemGUI.php.

References $_GET.

Referenced by createNewsItem(), editNewsItem(), saveNewsItem(), and updateNewsItem().

256  {
257  global $ilTabs;
258 
259  $ilTabs->clearTargets();
260  $form = self::getEditForm($a_mode, (int) $_GET["ref_id"]);
261  $form->setFormAction($this->ctrl->getFormAction($this));
262 
263  return $form;
264  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ isRteActivated()

static ilNewsItemGUI::isRteActivated ( )
static

Is Rte activated.

Returns
bool

Definition at line 702 of file class.ilNewsItemGUI.php.

References ilObjAdvancedEditing\_getRichTextEditor().

Referenced by ilNewsTimelineGUI\save(), and ilNewsTimelineGUI\update().

703  {
704  include_once("./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
706  {
707  return false;
708  }
709  return true;
710  }
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveNewsItem()

ilNewsItemGUI::saveNewsItem ( )

FORM NewsItem: Save NewsItem.

Definition at line 372 of file class.ilNewsItemGUI.php.

References $ilUser, exitSaveNewsItem(), getContextObjId(), getContextObjType(), getContextSubObjId(), getContextSubObjType(), getEnableEdit(), IL_FORM_CREATE, and initFormNewsItem().

373  {
374  global $ilUser;
375 
376  if (!$this->getEnableEdit())
377  {
378  return;
379  }
380 
381  $form = $this->initFormNewsItem(IL_FORM_CREATE);
382  if ($form->checkInput())
383  {
384  $this->news_item = new ilNewsItem();
385  $this->news_item->setTitle($form->getInput("news_title"));
386  $this->news_item->setContent($form->getInput("news_content"));
387  $this->news_item->setVisibility($form->getInput("news_visibility"));
388  $this->news_item->setContentLong("");
389  if (self::isRteActivated())
390  {
391  $this->news_item->setContentHtml(true);
392  }
393  //$this->news_item->setContentLong($form->getInput("news_content_long"));
394 
395 // changed
396  //$this->news_item->setContextObjId($this->ctrl->getContextObjId());
397  //$this->news_item->setContextObjType($this->ctrl->getContextObjType());
398  $this->news_item->setContextObjId($this->getContextObjId());
399  $this->news_item->setContextObjType($this->getContextObjType());
400  $this->news_item->setContextSubObjId($this->getContextSubObjId());
401  $this->news_item->setContextSubObjType($this->getContextSubObjType());
402  $this->news_item->setUserId($ilUser->getId());
403 
404  $news_set = new ilSetting("news");
405  if (!$news_set->get("enable_rss_for_internal"))
406  {
407  $this->news_item->setVisibility("users");
408  }
409 
410  $this->news_item->create();
411  $this->exitSaveNewsItem();
412  }
413  else
414  {
415  $form->setValuesByPost();
416  return $form->getHtml();
417  }
418 
419  }
ILIAS Setting Class.
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
getEnableEdit()
Get EnableEdit.
getContextObjType()
Get ContextObjType.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
getContextSubObjType()
Get ContextSubObjType.
$ilUser
Definition: imgupload.php:18
const IL_FORM_CREATE
+ Here is the call graph for this function:

◆ setContextObjId()

ilNewsItemGUI::setContextObjId (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

Definition at line 131 of file class.ilNewsItemGUI.php.

Referenced by __construct().

132  {
133  $this->context_obj_id = $a_context_obj_id;
134  }
+ Here is the caller graph for this function:

◆ setContextObjType()

ilNewsItemGUI::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

Definition at line 151 of file class.ilNewsItemGUI.php.

Referenced by __construct().

152  {
153  $this->context_obj_type = $a_context_obj_type;
154  }
+ Here is the caller graph for this function:

◆ setContextSubObjId()

ilNewsItemGUI::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

Definition at line 171 of file class.ilNewsItemGUI.php.

Referenced by __construct().

172  {
173  $this->context_sub_obj_id = $a_context_sub_obj_id;
174  }
+ Here is the caller graph for this function:

◆ setContextSubObjType()

ilNewsItemGUI::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

Definition at line 191 of file class.ilNewsItemGUI.php.

Referenced by __construct().

192  {
193  $this->context_sub_obj_type = $a_context_sub_obj_type;
194  }
+ Here is the caller graph for this function:

◆ setEnableEdit()

ilNewsItemGUI::setEnableEdit (   $a_enable_edit = 0)

Set EnableEdit.

Parameters
boolean$a_enable_editEdit mode on/off

Definition at line 111 of file class.ilNewsItemGUI.php.

Referenced by __construct().

112  {
113  $this->enable_edit = $a_enable_edit;
114  }
+ Here is the caller graph for this function:

◆ setFormEditMode()

ilNewsItemGUI::setFormEditMode (   $a_form_edit_mode)

Set FormEditMode.

Parameters
int$a_form_edit_modeForm Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE | IL_FORM_RE_EDIT | IL_FORM_RE_CREATE)

Definition at line 211 of file class.ilNewsItemGUI.php.

212  {
213  $this->form_edit_mode = $a_form_edit_mode;
214  }

◆ setTabs()

ilNewsItemGUI::setTabs ( )

Set tabs.

Parameters

Definition at line 688 of file class.ilNewsItemGUI.php.

References $ilCtrl, and $lng.

Referenced by editNews().

689  {
690  global $ilTabs, $ilCtrl, $lng;
691 
692  $ilTabs->clearTargets();
693  $ilTabs->setBackTarget($lng->txt("back"),
694  $ilCtrl->getParentReturnByClass("ilnewsitemgui"));
695  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ updateNewsItem()

ilNewsItemGUI::updateNewsItem ( )

FORM NewsItem: Save NewsItem.

Definition at line 439 of file class.ilNewsItemGUI.php.

References $ilUser, exitUpdateNewsItem(), getEnableEdit(), IL_FORM_EDIT, and initFormNewsItem().

440  {
441  global $ilUser;
442 
443  if (!$this->getEnableEdit())
444  {
445  return "";
446  }
447 
448  $form = $this->initFormNewsItem(IL_FORM_EDIT);
449  if ($form->checkInput())
450  {
451  $this->news_item->setUpdateUserId($ilUser->getId());
452  $this->news_item->setTitle($form->getInput("news_title"));
453  $this->news_item->setContent($form->getInput("news_content"));
454  $this->news_item->setVisibility($form->getInput("news_visibility"));
455  //$this->news_item->setContentLong($form->getInput("news_content_long"));
456  $this->news_item->setContentLong("");
457  if (self::isRteActivated())
458  {
459  $this->news_item->setContentHtml(true);
460  }
461  $this->news_item->update();
462  $this->exitUpdateNewsItem();
463  }
464  else
465  {
466  $form->setValuesByPost();
467  return $form->getHtml();
468  }
469  }
getEnableEdit()
Get EnableEdit.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
$ilUser
Definition: imgupload.php:18
const IL_FORM_EDIT
+ Here is the call graph for this function:

Field Documentation

◆ $context_obj_id

ilNewsItemGUI::$context_obj_id
protected

Definition at line 23 of file class.ilNewsItemGUI.php.

Referenced by getContextObjId().

◆ $context_obj_type

ilNewsItemGUI::$context_obj_type
protected

Definition at line 24 of file class.ilNewsItemGUI.php.

Referenced by getContextObjType().

◆ $context_sub_obj_id

ilNewsItemGUI::$context_sub_obj_id
protected

Definition at line 25 of file class.ilNewsItemGUI.php.

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

ilNewsItemGUI::$context_sub_obj_type
protected

Definition at line 26 of file class.ilNewsItemGUI.php.

Referenced by getContextSubObjType().

◆ $enable_edit

ilNewsItemGUI::$enable_edit = 0
protected

Definition at line 22 of file class.ilNewsItemGUI.php.

Referenced by getEnableEdit().

◆ $form_edit_mode

ilNewsItemGUI::$form_edit_mode
protected

Definition at line 27 of file class.ilNewsItemGUI.php.

Referenced by getFormEditMode().


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