5 include_once(
"./Services/News/classes/class.ilNewsItem.php");
7 define(
"IL_FORM_EDIT", 0);
8 define(
"IL_FORM_CREATE", 1);
9 define(
"IL_FORM_RE_EDIT", 2);
10 define(
"IL_FORM_RE_CREATE", 3);
39 include_once(
"Services/News/classes/class.ilNewsItem.php");
40 if (
$_GET[
"news_item_id"] > 0)
45 $this->ctrl->saveParameter($this,
array(
"news_item_id"));
56 $lng->loadLanguageModule(
"news");
58 $ilCtrl->saveParameter($this,
"add_mode");
70 $lng->LoadLanguageModule(
"news");
84 if (is_object($this->news_item) && $this->news_item->getId() > 0
87 throw new ilException(
"News ID does not match object context.");
92 $next_class = $this->ctrl->getNextClass($this);
93 $cmd = $this->ctrl->getCmd();
113 $this->enable_edit = $a_enable_edit;
133 $this->context_obj_id = $a_context_obj_id;
153 $this->context_obj_type = $a_context_obj_type;
173 $this->context_sub_obj_id = $a_context_sub_obj_id;
193 $this->context_sub_obj_type = $a_context_sub_obj_type;
213 $this->form_edit_mode = $a_form_edit_mode;
233 return $form->getHtml();
244 return $form->getHtml();
259 $ilTabs->clearTargets();
260 $form = self::getEditForm($a_mode, (
int)
$_GET[
"ref_id"]);
261 $form->setFormAction($this->ctrl->getFormAction($this));
276 $lng->loadLanguageModule(
"news");
278 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
283 $text_input =
new ilTextInputGUI($lng->txt(
"news_news_item_title"),
"news_title");
285 $text_input->setRequired(
true);
286 $text_input->setMaxLength(200);
287 $form->addItem($text_input);
290 $text_area =
new ilTextAreaInputGUI($lng->txt(
"news_news_item_content"),
"news_content");
292 $text_area->setRequired(
false);
293 $text_area->setRows(
"4");
294 $text_area->setUseRte(
true);
295 $form->addItem($text_area);
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);
322 $form->addCommandButton(
"saveNewsItem", $lng->txt(
"save"),
"news_btn_create");
323 $form->addCommandButton(
"cancelSaveNewsItem", $lng->txt(
"cancel"),
"news_btn_cancel_create");
327 $form->addCommandButton(
"updateNewsItem", $lng->txt(
"save"),
"news_btn_update");
328 $form->addCommandButton(
"cancelUpdateNewsItem", $lng->txt(
"cancel"),
"news_btn_cancel_update");
331 $form->setTitle($lng->txt(
"news_news_item_head"));
334 if (!$news_set->get(
"enable_rss_for_internal"))
336 $form->removeItemByPostVar(
"news_visibility");
340 $nv = $form->getItemByPostVar(
"news_visibility");
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();
362 $values[
"news_content_long"] =
"";
364 $a_form->setValuesByArray($values);
382 if ($form->checkInput())
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())
391 $this->news_item->setContentHtml(
true);
402 $this->news_item->setUserId($ilUser->getId());
405 if (!$news_set->get(
"enable_rss_for_internal"))
407 $this->news_item->setVisibility(
"users");
410 $this->news_item->create();
415 $form->setValuesByPost();
416 return $form->getHtml();
425 if (
$_GET[
"add_mode"] ==
"block")
427 $ilCtrl->returnToParent($this);
431 $ilCtrl->redirect($this,
"editNews");
449 if ($form->checkInput())
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"));
456 $this->news_item->setContentLong(
"");
457 if (self::isRteActivated())
459 $this->news_item->setContentHtml(
true);
461 $this->news_item->update();
466 $form->setValuesByPost();
467 return $form->getHtml();
475 $ilCtrl->redirect($this,
"editNews");
495 if (
$_GET[
"add_mode"] ==
"block")
497 $ilCtrl->returnToParent($this);
516 $ilToolbar->addButton($lng->txt(
"news_add_news"),
517 $ilCtrl->getLinkTarget($this,
"createNewsItem"));
547 if (count(
$_POST[
"news_id"]) == 0)
553 $ilTabs->clearTargets();
555 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
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");
565 foreach(
$_POST[
"news_id"] as $news_id)
568 $c_gui->addItem(
"news_id[]", $news_id, $news->getTitle());
571 return $c_gui->getHTML();
584 foreach(
$_POST[
"news_id"] as $news_id)
601 include_once(
"Services/News/classes/class.ilNewsForContextBlockGUI.php");
604 $block_gui->setParentClass(
"ilinfoscreengui");
605 $block_gui->setParentCmd(
"showSummary");
619 $data = $news_item->queryNewsForContext();
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);
625 return $block_gui->getHTML();
647 $data = $news_item->getNewsForRefId(
$_GET[
"ref_id"],
false,
false,
648 0,
true,
false,
true,
true);
652 $perm_ref_id =
$_GET[
"ref_id"];
655 $data = $news_item->queryNewsForContext(
false, 0,
660 $data = $news_item->queryNewsForContext();
664 include_once(
"Services/News/classes/class.ilNewsForContextTableGUI.php");
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);
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");
678 return $table_gui->getHTML();
692 $ilTabs->clearTargets();
693 $ilTabs->setBackTarget($lng->txt(
"back"),
694 $ilCtrl->getParentReturnByClass(
"ilnewsitemgui"));
704 include_once(
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
This class represents an option in a radio group.
getContextSubObjId()
Get ContextSubObjId.
Base class for ILIAS Exception handling.
static isRteActivated()
Is Rte activated.
getValuesNewsItem($a_form)
FORM NewsItem: Get current values for NewsItem form.
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
getNewsForContextBlock()
BLOCK NewsForContext: Get block HTML.
setContextObjId($a_context_obj_id)
Set ContextObjId.
getFormEditMode()
Get FormEditMode.
User Interface for NewsItem entities.
confirmDeletionNewsItems()
Confirmation Screen.
getContextObjId()
Get ContextObjId.
BlockGUI class for block NewsForContext.
saveNewsItem()
FORM NewsItem: Save NewsItem.
getEnableEdit()
Get EnableEdit.
setInfo($a_info)
Set Info.
getContextObjType()
Get ContextObjType.
deleteNewsItems()
Delete news items.
cancelUpdateNewsItem()
FORM NewsItem: Save NewsItem.
initFormNewsItem($a_mode)
FORM NewsItem: Init form.
setContextSubObjId($a_context_sub_obj_id)
Set ContextSubObjId.
getContextSubObjType()
Get ContextSubObjType.
This class represents a text property in a property form.
setContextSubObjType($a_context_sub_obj_type)
Set ContextSubObjType.
createNewsItem()
FORM NewsItem: Create NewsItem.
editNewsItem()
FORM NewsItem: Edit form.
getNewsForContextTable()
TABLE NewsForContext: Get table HTML.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
This class represents a text area property in a property form.
TableGUI class for table NewsForContext.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
static _lookupContextObjId($a_news_id)
Context Object ID.
cancelSaveNewsItem()
FORM NewsItem: Save NewsItem.
setContextObjType($a_context_obj_type)
Set ContextObjType.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
static getEditForm($a_mode, $a_ref_id)
FORM NewsItem: Init form.
setFormEditMode($a_form_edit_mode)
Set FormEditMode.
executeCommand()
Execute command.
cancelUpdate()
Cancel update.
Confirmation screen class.
__construct()
Constructor.
updateNewsItem()
FORM NewsItem: Save NewsItem.