ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 $ctrl
 
 $lng
 
 $tabs
 
 $user
 
 $toolbar
 
 $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 58 of file class.ilNewsItemGUI.php.

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

59  {
60  global $DIC;
61 
62  $this->lng = $DIC->language();
63  $this->tabs = $DIC->tabs();
64  $this->user = $DIC->user();
65  $this->toolbar = $DIC->toolbar();
66  $ilCtrl = $DIC->ctrl();
67  $lng = $DIC->language();
68 
69  $this->ctrl = $ilCtrl;
70 
71  include_once("Services/News/classes/class.ilNewsItem.php");
72  if ($_GET["news_item_id"] > 0) {
73  $this->news_item = new ilNewsItem($_GET["news_item_id"]);
74  }
75 
76  $this->ctrl->saveParameter($this, array("news_item_id"));
77 
78  // Init EnableEdit.
79  $this->setEnableEdit(false);
80 
81  // Init Context.
82  $this->setContextObjId($ilCtrl->getContextObjId());
83  $this->setContextObjType($ilCtrl->getContextObjType());
84  $this->setContextSubObjId($ilCtrl->getContextSubObjId());
85  $this->setContextSubObjType($ilCtrl->getContextSubObjType());
86 
87  $lng->loadLanguageModule("news");
88 
89  $ilCtrl->saveParameter($this, "add_mode");
90  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setContextObjId($a_context_obj_id)
Set ContextObjId.
user()
Definition: user.php:4
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.
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 498 of file class.ilNewsItemGUI.php.

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

499  {
501 
502  if ($_GET["add_mode"] == "block") {
503  $ilCtrl->returnToParent($this);
504  } else {
505  return $this->editNews();
506  }
507  }
$_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 537 of file class.ilNewsItemGUI.php.

References editNews().

538  {
539  return $this->editNews();
540  }
editNews()
Edit news.
+ Here is the call graph for this function:

◆ cancelUpdateNewsItem()

ilNewsItemGUI::cancelUpdateNewsItem ( )

FORM NewsItem: Save NewsItem.

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

References editNews().

490  {
491  return $this->editNews();
492  }
editNews()
Edit news.
+ Here is the call graph for this function:

◆ confirmDeletionNewsItems()

ilNewsItemGUI::confirmDeletionNewsItems ( )

Confirmation Screen.

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

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

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

◆ createNewsItem()

ilNewsItemGUI::createNewsItem ( )

FORM NewsItem: Create NewsItem.

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

References $form, IL_FORM_CREATE, and initFormNewsItem().

260  {
262  return $form->getHtml();
263  }
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
if(isset($_POST['submit'])) $form
const IL_FORM_CREATE
+ Here is the call graph for this function:

◆ deleteNewsItems()

ilNewsItemGUI::deleteNewsItems ( )

Delete news items.

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

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

585  {
586  if (!$this->getEnableEdit()) {
587  return;
588  }
589  // delete all selected news items
590  foreach ($_POST["news_id"] as $news_id) {
591  $news = new ilNewsItem($news_id);
592  $news->delete();
593  }
594 
595  return $this->editNews();
596  }
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 514 of file class.ilNewsItemGUI.php.

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

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

515  {
516  $ilTabs = $this->tabs;
517  $ilToolbar = $this->toolbar;
518  $lng = $this->lng;
520 
521  $this->setTabs();
522 
523  $ilToolbar->addButton(
524  $lng->txt("news_add_news"),
525  $ilCtrl->getLinkTarget($this, "createNewsItem")
526  );
527 
528  if (!$this->getEnableEdit()) {
529  return;
530  }
531  return $this->getNewsForContextTable();
532  }
getEnableEdit()
Get EnableEdit.
global $ilCtrl
Definition: ilias.php:18
getNewsForContextTable()
TABLE NewsForContext: Get table HTML.
+ 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 269 of file class.ilNewsItemGUI.php.

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

270  {
272  $this->getValuesNewsItem($form);
273  return $form->getHtml();
274  }
getValuesNewsItem($a_form)
FORM NewsItem: Get current values for NewsItem form.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
if(isset($_POST['submit'])) $form
const IL_FORM_EDIT
+ Here is the call graph for this function:

◆ executeCommand()

ilNewsItemGUI::executeCommand ( )

Execute command.

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

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

112  {
114 
115  // check, if news item id belongs to context
116  if (is_object($this->news_item) && $this->news_item->getId() > 0
117  && ilNewsItem::_lookupContextObjId($this->news_item->getId()) != $this->getContextObjId()) {
118  throw new ilException("News ID does not match object context.");
119  }
120 
121 
122  // get next class and command
123  $next_class = $this->ctrl->getNextClass($this);
124  $cmd = $this->ctrl->getCmd();
125 
126  switch ($next_class) {
127  default:
128  $html = $this->$cmd();
129  break;
130  }
131 
132  return $html;
133  }
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 436 of file class.ilNewsItemGUI.php.

References $_GET, $ctrl, and $ilCtrl.

Referenced by saveNewsItem().

437  {
439 
440  if ($_GET["add_mode"] == "block") {
441  $ilCtrl->returnToParent($this);
442  } else {
443  $ilCtrl->redirect($this, "editNews");
444  }
445  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ exitUpdateNewsItem()

ilNewsItemGUI::exitUpdateNewsItem ( )

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

References $ctrl, and $ilCtrl.

Referenced by updateNewsItem().

479  {
481 
482  $ilCtrl->redirect($this, "editNews");
483  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ getContextObjId()

ilNewsItemGUI::getContextObjId ( )

Get ContextObjId.

Returns
int

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

References $context_obj_id.

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

171  {
172  return $this->context_obj_id;
173  }
+ Here is the caller graph for this function:

◆ getContextObjType()

ilNewsItemGUI::getContextObjType ( )

Get ContextObjType.

Returns
int

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

References $context_obj_type.

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

191  {
193  }
+ Here is the caller graph for this function:

◆ getContextSubObjId()

ilNewsItemGUI::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

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

References $context_sub_obj_id.

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

211  {
213  }
+ Here is the caller graph for this function:

◆ getContextSubObjType()

ilNewsItemGUI::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

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

References $context_sub_obj_type.

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

231  {
233  }
+ 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 300 of file class.ilNewsItemGUI.php.

References $DIC, $form, $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().

301  {
302  global $DIC;
303 
304  $lng = $DIC->language();
305 
306  $lng->loadLanguageModule("news");
307 
308  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
309 
310  $form = new ilPropertyFormGUI();
311 
312  // Property Title
313  $text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
314  $text_input->setInfo("");
315  $text_input->setRequired(true);
316  $text_input->setMaxLength(200);
317  $form->addItem($text_input);
318 
319  // Property Content
320  $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
321  $text_area->setInfo("");
322  $text_area->setRequired(false);
323  $text_area->setRows("4");
324  $text_area->setUseRte(true);
325  $form->addItem($text_area);
326 
327  // Property Visibility
328  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
329  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
330  $radio_group->addOption($radio_option);
331  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
332  $radio_group->addOption($radio_option);
333  $radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
334  $radio_group->setRequired(false);
335  $radio_group->setValue("users");
336  $form->addItem($radio_group);
337 
338  // Property ContentLong
339  /*
340  $text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
341  $text_area->setInfo($lng->txt("news_news_item_content_long_info"));
342  $text_area->setRequired(false);
343  $text_area->setCols("40");
344  $text_area->setRows("8");
345  $text_area->setUseRte(true);
346  $form->addItem($text_area);*/
347 
348 
349  // save and cancel commands
350  if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE))) {
351  $form->addCommandButton("saveNewsItem", $lng->txt("save"), "news_btn_create");
352  $form->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"), "news_btn_cancel_create");
353  } else {
354  $form->addCommandButton("updateNewsItem", $lng->txt("save"), "news_btn_update");
355  $form->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"), "news_btn_cancel_update");
356  }
357 
358  $form->setTitle($lng->txt("news_news_item_head"));
359 
360  $news_set = new ilSetting("news");
361  if (!$news_set->get("enable_rss_for_internal")) {
362  $form->removeItemByPostVar("news_visibility");
363  } else {
364  $nv = $form->getItemByPostVar("news_visibility");
365  if (is_object($nv)) {
366  $nv->setValue(ilNewsItem::_getDefaultVisibilityForRefId($a_ref_id));
367  }
368  }
369 
370  return $form;
371  }
This class represents an option in a radio group.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
Create styles array
The data for the language used.
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 150 of file class.ilNewsItemGUI.php.

References $enable_edit.

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

151  {
152  return $this->enable_edit;
153  }
+ 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 250 of file class.ilNewsItemGUI.php.

References $form_edit_mode.

251  {
252  return $this->form_edit_mode;
253  }

◆ getHTML()

ilNewsItemGUI::getHTML ( )

Get html.

Returns
string html

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

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

98  {
99  $lng = $this->lng;
101 
102  $lng->LoadLanguageModule("news");
103 
104  return $this->getNewsForContextBlock();
105  }
getNewsForContextBlock()
BLOCK NewsForContext: Get block HTML.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ getNewsForContextBlock()

ilNewsItemGUI::getNewsForContextBlock ( )

BLOCK NewsForContext: Get block HTML.

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

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

Referenced by getHTML().

603  {
604  $lng = $this->lng;
605 
606  include_once("Services/News/classes/class.ilNewsForContextBlockGUI.php");
607  $block_gui = new ilNewsForContextBlockGUI(get_class($this));
608 
609  $block_gui->setParentClass("ilinfoscreengui");
610  $block_gui->setParentCmd("showSummary");
611  $block_gui->setEnableEdit($this->getEnableEdit());
612 
613 
614  $news_item = new ilNewsItem();
615 
616  // changed
617  //$news_item->setContextObjId($this->ctrl->getContextObjId());
618  //$news_item->setContextObjType($this->ctrl->getContextObjType());
619  $news_item->setContextObjId($this->getContextObjId());
620  $news_item->setContextObjType($this->getContextObjType());
621  $news_item->setContextSubObjId($this->getContextSubObjId());
622  $news_item->setContextSubObjType($this->getContextSubObjType());
623 
624  $data = $news_item->queryNewsForContext();
625 
626  $block_gui->setTitle($lng->txt("news_block_news_for_context"));
627  $block_gui->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
628  $block_gui->setData($data);
629 
630  return $block_gui->getHTML();
631  }
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
BlockGUI class for block NewsForContext.
getEnableEdit()
Get EnableEdit.
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
+ 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 638 of file class.ilNewsItemGUI.php.

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

Referenced by editNews().

639  {
640  $lng = $this->lng;
641 
642  $news_item = new ilNewsItem();
643  $news_item->setContextObjId($this->getContextObjId());
644  $news_item->setContextObjType($this->getContextObjType());
645  $news_item->setContextSubObjId($this->getContextSubObjId());
646  $news_item->setContextSubObjType($this->getContextSubObjType());
647 
648  $perm_ref_id = 0;
649  if (in_array($this->getContextObjType(), array("cat", "grp", "crs", "root"))) {
650  $data = $news_item->getNewsForRefId(
651  $_GET["ref_id"],
652  false,
653  false,
654  0,
655  true,
656  false,
657  true,
658  true
659  );
660  } else {
661  $perm_ref_id = $_GET["ref_id"];
662  if ($this->getContextSubObjId() > 0) {
663  $data = $news_item->queryNewsForContext(
664  false,
665  0,
666  "",
667  true,
668  true
669  );
670  } else {
671  $data = $news_item->queryNewsForContext();
672  }
673  }
674 
675  include_once("Services/News/classes/class.ilNewsForContextTableGUI.php");
676  $table_gui = new ilNewsForContextTableGUI($this, "getNewsForContextTable", $perm_ref_id);
677 
678  $table_gui->setTitle($lng->txt("news_table_news_for_context"));
679  $table_gui->setRowTemplate("tpl.table_row_news_for_context.html", "Services/News");
680  $table_gui->setData($data);
681 
682  $table_gui->setDefaultOrderField("creation_date");
683  $table_gui->setDefaultOrderDirection("desc");
684  $table_gui->addMultiCommand("confirmDeletionNewsItems", $lng->txt("delete"));
685  $table_gui->setTitle($lng->txt("news"));
686  $table_gui->setSelectAllCheckbox("news_id");
687 
688 
689  return $table_gui->getHTML();
690  }
getContextSubObjId()
Get ContextSubObjId.
$_GET["client_id"]
getContextObjId()
Get ContextObjId.
getContextObjType()
Get ContextObjType.
getContextSubObjType()
Get ContextSubObjType.
Create styles array
The data for the language used.
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 377 of file class.ilNewsItemGUI.php.

References array.

Referenced by editNewsItem().

378  {
379  $values = array();
380 
381  $values["news_title"] = $this->news_item->getTitle();
382  $values["news_content"] = $this->news_item->getContent() . $this->news_item->getContentLong();
383  $values["news_visibility"] = $this->news_item->getVisibility();
384  //$values["news_content_long"] = $this->news_item->getContentLong();
385  $values["news_content_long"] = "";
386 
387  $a_form->setValuesByArray($values);
388  }
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 283 of file class.ilNewsItemGUI.php.

References $_GET, $form, and $tabs.

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

284  {
285  $ilTabs = $this->tabs;
286 
287  $ilTabs->clearTargets();
288  $form = self::getEditForm($a_mode, (int) $_GET["ref_id"]);
289  $form->setFormAction($this->ctrl->getFormAction($this));
290 
291  return $form;
292  }
$_GET["client_id"]
if(isset($_POST['submit'])) $form
+ Here is the caller graph for this function:

◆ isRteActivated()

static ilNewsItemGUI::isRteActivated ( )
static

Is Rte activated.

Returns
bool

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

References ilObjAdvancedEditing\_getRichTextEditor().

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

717  {
718  include_once("./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
720  return false;
721  }
722  return true;
723  }
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 394 of file class.ilNewsItemGUI.php.

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

395  {
397 
398  if (!$this->getEnableEdit()) {
399  return;
400  }
401 
403  if ($form->checkInput()) {
404  $this->news_item = new ilNewsItem();
405  $this->news_item->setTitle($form->getInput("news_title"));
406  $this->news_item->setContent($form->getInput("news_content"));
407  $this->news_item->setVisibility($form->getInput("news_visibility"));
408  $this->news_item->setContentLong("");
409  if (self::isRteActivated()) {
410  $this->news_item->setContentHtml(true);
411  }
412  //$this->news_item->setContentLong($form->getInput("news_content_long"));
413 
414  // changed
415  //$this->news_item->setContextObjId($this->ctrl->getContextObjId());
416  //$this->news_item->setContextObjType($this->ctrl->getContextObjType());
417  $this->news_item->setContextObjId($this->getContextObjId());
418  $this->news_item->setContextObjType($this->getContextObjType());
419  $this->news_item->setContextSubObjId($this->getContextSubObjId());
420  $this->news_item->setContextSubObjType($this->getContextSubObjType());
421  $this->news_item->setUserId($ilUser->getId());
422 
423  $news_set = new ilSetting("news");
424  if (!$news_set->get("enable_rss_for_internal")) {
425  $this->news_item->setVisibility("users");
426  }
427 
428  $this->news_item->create();
429  $this->exitSaveNewsItem();
430  } else {
431  $form->setValuesByPost();
432  return $form->getHtml();
433  }
434  }
getContextSubObjId()
Get ContextSubObjId.
getContextObjId()
Get ContextObjId.
getEnableEdit()
Get EnableEdit.
getContextObjType()
Get ContextObjType.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
if(isset($_POST['submit'])) $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 160 of file class.ilNewsItemGUI.php.

Referenced by __construct().

161  {
162  $this->context_obj_id = $a_context_obj_id;
163  }
+ 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 180 of file class.ilNewsItemGUI.php.

Referenced by __construct().

181  {
182  $this->context_obj_type = $a_context_obj_type;
183  }
+ 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 200 of file class.ilNewsItemGUI.php.

Referenced by __construct().

201  {
202  $this->context_sub_obj_id = $a_context_sub_obj_id;
203  }
+ 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 220 of file class.ilNewsItemGUI.php.

Referenced by __construct().

221  {
222  $this->context_sub_obj_type = $a_context_sub_obj_type;
223  }
+ 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 140 of file class.ilNewsItemGUI.php.

Referenced by __construct().

141  {
142  $this->enable_edit = $a_enable_edit;
143  }
+ 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 240 of file class.ilNewsItemGUI.php.

241  {
242  $this->form_edit_mode = $a_form_edit_mode;
243  }

◆ setTabs()

ilNewsItemGUI::setTabs ( )

Set tabs.

Parameters

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

References $ctrl, $ilCtrl, $lng, and $tabs.

Referenced by editNews().

699  {
700  $ilTabs = $this->tabs;
702  $lng = $this->lng;
703 
704  $ilTabs->clearTargets();
705  $ilTabs->setBackTarget(
706  $lng->txt("back"),
707  $ilCtrl->getParentReturnByClass("ilnewsitemgui")
708  );
709  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ updateNewsItem()

ilNewsItemGUI::updateNewsItem ( )

FORM NewsItem: Save NewsItem.

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

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

452  {
454 
455  if (!$this->getEnableEdit()) {
456  return "";
457  }
458 
460  if ($form->checkInput()) {
461  $this->news_item->setUpdateUserId($ilUser->getId());
462  $this->news_item->setTitle($form->getInput("news_title"));
463  $this->news_item->setContent($form->getInput("news_content"));
464  $this->news_item->setVisibility($form->getInput("news_visibility"));
465  //$this->news_item->setContentLong($form->getInput("news_content_long"));
466  $this->news_item->setContentLong("");
467  if (self::isRteActivated()) {
468  $this->news_item->setContentHtml(true);
469  }
470  $this->news_item->update();
471  $this->exitUpdateNewsItem();
472  } else {
473  $form->setValuesByPost();
474  return $form->getHtml();
475  }
476  }
getEnableEdit()
Get EnableEdit.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
if(isset($_POST['submit'])) $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 48 of file class.ilNewsItemGUI.php.

Referenced by getContextObjId().

◆ $context_obj_type

ilNewsItemGUI::$context_obj_type
protected

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

Referenced by getContextObjType().

◆ $context_sub_obj_id

ilNewsItemGUI::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

◆ $context_sub_obj_type

ilNewsItemGUI::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

◆ $ctrl

◆ $enable_edit

ilNewsItemGUI::$enable_edit = 0
protected

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

Referenced by getEnableEdit().

◆ $form_edit_mode

ilNewsItemGUI::$form_edit_mode
protected

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

Referenced by getFormEditMode().

◆ $lng

◆ $tabs

ilNewsItemGUI::$tabs
protected

◆ $toolbar

ilNewsItemGUI::$toolbar
protected

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

Referenced by editNews().

◆ $user

ilNewsItemGUI::$user
protected

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

Referenced by saveNewsItem(), and updateNewsItem().


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