ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNewsItemGUI Class Reference

User Interface for NewsItem entities. More...

+ Collaboration diagram for ilNewsItemGUI:

Public Member Functions

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

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:
class.ilNewsItemGUI.php 26663 2010-11-22 08:10:52Z akill

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

Constructor & Destructor Documentation

ilNewsItemGUI::__construct ( )

Constructor.

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

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

{
global $ilCtrl, $lng;
$this->ctrl = $ilCtrl;
include_once("Services/News/classes/class.ilNewsItemGen.php");
if ($_GET["news_item_id"] > 0)
{
$this->news_item = new ilNewsItemGen($_GET["news_item_id"]);
}
$this->ctrl->saveParameter($this, array("news_item_id"));
// Init EnableEdit.
$this->setEnableEdit(false);
// Init Context.
$this->setContextObjId($ilCtrl->getContextObjId());
$this->setContextObjType($ilCtrl->getContextObjType());
$this->setContextSubObjId($ilCtrl->getContextSubObjId());
$this->setContextSubObjType($ilCtrl->getContextSubObjType());
$lng->loadLanguageModule("news");
$ilCtrl->saveParameter($this, "add_mode");
}

+ Here is the call graph for this function:

Member Function Documentation

ilNewsItemGUI::cancelSaveNewsItem ( )

FORM NewsItem: Save NewsItem.

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

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

{
global $ilCtrl;
if ($_GET["add_mode"] == "block")
{
$ilCtrl->returnToParent($this);
}
else
{
return $this->editNews();
}
}

+ Here is the call graph for this function:

ilNewsItemGUI::cancelUpdate ( )

Cancel update.

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

References editNews().

{
return $this->editNews();
}

+ Here is the call graph for this function:

ilNewsItemGUI::cancelUpdateNewsItem ( )

FORM NewsItem: Save NewsItem.

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

References editNews().

{
return $this->editNews();
}

+ Here is the call graph for this function:

ilNewsItemGUI::confirmDeletionNewsItems ( )

Confirmation Screen.

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

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

{
global $ilCtrl, $lng, $ilTabs;
if (!$this->getEnableEdit())
{
return;
}
// check whether at least one item is selected
if (count($_POST["news_id"]) == 0)
{
ilUtil::sendFailure($lng->txt("no_checkbox"));
return $this->editNews();
}
$ilTabs->clearTargets();
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteNewsItems"));
$c_gui->setHeaderText($lng->txt("info_delete_sure"));
$c_gui->setCancel($lng->txt("cancel"), "editNews");
$c_gui->setConfirm($lng->txt("confirm"), "deleteNewsItems");
// add items to delete
foreach($_POST["news_id"] as $news_id)
{
$news = new ilNewsItem($news_id);
$c_gui->addItem("news_id[]", $news_id, $news->getTitle(),
ilUtil::getImagePath("icon_news.gif"));
}
return $c_gui->getHTML();
}

+ Here is the call graph for this function:

ilNewsItemGUI::createNewsItem ( )

FORM NewsItem: Create NewsItem.

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

References IL_FORM_CREATE, and initFormNewsItem().

{
return $this->form_gui->getHtml();
}

+ Here is the call graph for this function:

ilNewsItemGUI::deleteNewsItems ( )

Delete news items.

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

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

{
if (!$this->getEnableEdit())
{
return;
}
// delete all selected news items
foreach($_POST["news_id"] as $news_id)
{
$news = new ilNewsItem($news_id);
$news->delete();
}
return $this->editNews();
}

+ Here is the call graph for this function:

ilNewsItemGUI::editNews ( )

Edit news.

Returns
html

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

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

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

{
global $ilTabs, $ilToolbar, $lng, $ilCtrl;
$this->setTabs();
$ilToolbar->addButton($lng->txt("news_add_news"),
$ilCtrl->getLinkTarget($this, "createNewsItem"));
if (!$this->getEnableEdit())
{
return;
}
return $this->getNewsForContextTable();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUI::editNewsItem ( )

FORM NewsItem: Edit form.

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

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

{
return $this->form_gui->getHtml();
}

+ Here is the call graph for this function:

& ilNewsItemGUI::executeCommand ( )

Execute command.

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

References $cmd, and $ilCtrl.

{
global $ilCtrl;
// get next class and command
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch ($next_class)
{
default:
$html = $this->$cmd();
break;
}
return $html;
}
ilNewsItemGUI::exitSaveNewsItem ( )

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

References $_GET, and $ilCtrl.

Referenced by saveNewsItem().

{
global $ilCtrl;
if ($_GET["add_mode"] == "block")
{
$ilCtrl->returnToParent($this);
}
else
{
$ilCtrl->redirect($this, "editNews");
}
}

+ Here is the caller graph for this function:

ilNewsItemGUI::exitUpdateNewsItem ( )

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

References $ilCtrl.

Referenced by updateNewsItem().

{
global $ilCtrl;
$ilCtrl->redirect($this, "editNews");
}

+ Here is the caller graph for this function:

ilNewsItemGUI::getContextObjId ( )

Get ContextObjId.

Returns
int

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

References $context_obj_id.

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

{
}

+ Here is the caller graph for this function:

ilNewsItemGUI::getContextObjType ( )

Get ContextObjType.

Returns
int

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

References $context_obj_type.

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

+ Here is the caller graph for this function:

ilNewsItemGUI::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

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

References $context_sub_obj_id.

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

+ Here is the caller graph for this function:

ilNewsItemGUI::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

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

References $context_sub_obj_type.

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

+ Here is the caller graph for this function:

ilNewsItemGUI::getEnableEdit ( )

Get EnableEdit.

Returns
boolean Edit mode on/off

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

References $enable_edit.

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

{
}

+ Here is the caller graph for this function:

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 213 of file class.ilNewsItemGUI.php.

References $form_edit_mode.

{
}
ilNewsItemGUI::getHTML ( )

Get html.

Returns
string html

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

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

{
global $lng, $ilCtrl;
$lng->LoadLanguageModule("news");
return $this->getNewsForContextBlock();
}

+ Here is the call graph for this function:

ilNewsItemGUI::getNewsForContextBlock ( )

BLOCK NewsForContext: Get block HTML.

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

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

Referenced by getHTML().

{
global $lng;
include_once("Services/News/classes/class.ilNewsForContextBlockGUI.php");
$block_gui = new ilNewsForContextBlockGUI(get_class($this));
$block_gui->setParentClass("ilinfoscreengui");
$block_gui->setParentCmd("showSummary");
$block_gui->setEnableEdit($this->getEnableEdit());
$news_item = new ilNewsItemGen();
// changed
//$news_item->setContextObjId($this->ctrl->getContextObjId());
//$news_item->setContextObjType($this->ctrl->getContextObjType());
$news_item->setContextObjId($this->getContextObjId());
$news_item->setContextObjType($this->getContextObjType());
$news_item->setContextSubObjId($this->getContextSubObjId());
$news_item->setContextSubObjType($this->getContextSubObjType());
$data = $news_item->queryNewsForContext();
$block_gui->setTitle($lng->txt("news_block_news_for_context"));
$block_gui->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
$block_gui->setData($data);
return $block_gui->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUI::getNewsForContextTable ( )

TABLE NewsForContext: Get table HTML.

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

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

Referenced by editNews().

{
global $lng;
$news_item = new ilNewsItem();
$news_item->setContextObjId($this->getContextObjId());
$news_item->setContextObjType($this->getContextObjType());
$news_item->setContextSubObjId($this->getContextSubObjId());
$news_item->setContextSubObjType($this->getContextSubObjType());
$perm_ref_id = 0;
if (in_array($this->getContextObjType(), array("cat", "grp", "crs", "root")))
{
$data = $news_item->getNewsForRefId($_GET["ref_id"], false, false,
0, true, false, true, true);
}
else
{
$perm_ref_id = $_GET["ref_id"];
if ($this->getContextSubObjId() > 0)
{
$data = $news_item->queryNewsForContext(false, 0,
"", true, true);
}
else
{
$data = $news_item->queryNewsForContext();
}
}
include_once("Services/News/classes/class.ilNewsForContextTableGUI.php");
$table_gui = new ilNewsForContextTableGUI($this, "getNewsForContextTable", $perm_ref_id);
$table_gui->setTitle($lng->txt("news_table_news_for_context"));
$table_gui->setRowTemplate("tpl.table_row_news_for_context.html", "Services/News");
$table_gui->setData($data);
$table_gui->setDefaultOrderField("creation_date");
$table_gui->setDefaultOrderDirection("desc");
$table_gui->addMultiCommand("confirmDeletionNewsItems", $lng->txt("delete"));
$table_gui->setTitle($lng->txt("news"), "icon_news.gif", $lng->txt("news"));
$table_gui->setSelectAllCheckbox("news_id");
return $table_gui->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUI::getValuesNewsItem ( )

FORM NewsItem: Get current values for NewsItem form.

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

Referenced by editNewsItem().

{
$values = array();
$values["news_title"] = $this->news_item->getTitle();
$values["news_content"] = $this->news_item->getContent();
$values["news_visibility"] = $this->news_item->getVisibility();
$values["news_content_long"] = $this->news_item->getContentLong();
$this->form_gui->setValuesByArray($values);
}

+ Here is the caller graph for this function:

ilNewsItemGUI::initFormNewsItem (   $a_mode)

FORM NewsItem: Init form.

Parameters
int$a_modeForm Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)

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

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

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

{
global $lng, $ilTabs;
$ilTabs->clearTargets();
//$this->setTabs();
$lng->loadLanguageModule("news");
include("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form_gui = new ilPropertyFormGUI();
// Property Title
$text_input = new ilTextInputGUI($lng->txt("news_news_item_title"), "news_title");
$text_input->setInfo("");
$text_input->setRequired(true);
$text_input->setMaxLength(200);
$this->form_gui->addItem($text_input);
// Property Content
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content"), "news_content");
$text_area->setInfo("");
$text_area->setRequired(false);
$this->form_gui->addItem($text_area);
// Property Visibility
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_news_item_visibility"), "news_visibility");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue("users");
$this->form_gui->addItem($radio_group);
// Property ContentLong
$text_area = new ilTextAreaInputGUI($lng->txt("news_news_item_content_long"), "news_content_long");
$text_area->setInfo($lng->txt("news_news_item_content_long_info"));
$text_area->setRequired(false);
$text_area->setCols("40");
$text_area->setRows("8");
$text_area->setUseRte(true);
$this->form_gui->addItem($text_area);
// save and cancel commands
if (in_array($a_mode, array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
{
$this->form_gui->addCommandButton("saveNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelSaveNewsItem", $lng->txt("cancel"));
}
else
{
$this->form_gui->addCommandButton("updateNewsItem", $lng->txt("save"));
$this->form_gui->addCommandButton("cancelUpdateNewsItem", $lng->txt("cancel"));
}
$this->form_gui->setTitle($lng->txt("news_news_item_head"));
$this->form_gui->setFormAction($this->ctrl->getFormAction($this));
$this->form_gui->setTitleIcon(ilUtil::getImagePath("icon_news.gif"));
$news_set = new ilSetting("news");
if (!$news_set->get("enable_rss_for_internal"))
{
$this->form_gui->removeItemByPostVar("news_visibility");
}
else
{
$nv = $this->form_gui->getItemByPostVar("news_visibility");
if (is_object($nv))
{
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUI::saveNewsItem ( )

FORM NewsItem: Save NewsItem.

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

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

{
global $ilUser;
if (!$this->getEnableEdit())
{
return;
}
if ($this->form_gui->checkInput())
{
$this->news_item = new ilNewsItem();
$this->news_item->setTitle($this->form_gui->getInput("news_title"));
$this->news_item->setContent($this->form_gui->getInput("news_content"));
$this->news_item->setVisibility($this->form_gui->getInput("news_visibility"));
$this->news_item->setContentLong($this->form_gui->getInput("news_content_long"));
// changed
//$this->news_item->setContextObjId($this->ctrl->getContextObjId());
//$this->news_item->setContextObjType($this->ctrl->getContextObjType());
$this->news_item->setContextObjId($this->getContextObjId());
$this->news_item->setContextObjType($this->getContextObjType());
$this->news_item->setContextSubObjId($this->getContextSubObjId());
$this->news_item->setContextSubObjType($this->getContextSubObjType());
$this->news_item->setUserId($ilUser->getId());
$news_set = new ilSetting("news");
if (!$news_set->get("enable_rss_for_internal"))
{
$this->news_item->setVisibility("users");
}
$this->news_item->create();
$this->exitSaveNewsItem();
}
else
{
$this->form_gui->setValuesByPost();
return $this->form_gui->getHtml();
}
}

+ Here is the call graph for this function:

ilNewsItemGUI::setContextObjId (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

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

Referenced by __construct().

{
$this->context_obj_id = $a_context_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGUI::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

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

Referenced by __construct().

{
$this->context_obj_type = $a_context_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGUI::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

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

Referenced by __construct().

{
$this->context_sub_obj_id = $a_context_sub_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGUI::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

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

Referenced by __construct().

{
$this->context_sub_obj_type = $a_context_sub_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGUI::setEnableEdit (   $a_enable_edit = 0)

Set EnableEdit.

Parameters
boolean$a_enable_editEdit mode on/off

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

Referenced by __construct().

{
$this->enable_edit = $a_enable_edit;
}

+ Here is the caller graph for this function:

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 203 of file class.ilNewsItemGUI.php.

{
$this->form_edit_mode = $a_form_edit_mode;
}
ilNewsItemGUI::setTabs ( )

Set tabs.

Parameters
@return

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

References $ilCtrl, and $lng.

Referenced by editNews().

{
global $ilTabs, $ilCtrl, $lng;
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt("back"),
$ilCtrl->getParentReturnByClass("ilnewsitemgui"));
}

+ Here is the caller graph for this function:

ilNewsItemGUI::updateNewsItem ( )

FORM NewsItem: Save NewsItem.

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

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

{
if (!$this->getEnableEdit())
{
return;
}
if ($this->form_gui->checkInput())
{
$this->news_item->setTitle($this->form_gui->getInput("news_title"));
$this->news_item->setContent($this->form_gui->getInput("news_content"));
$this->news_item->setVisibility($this->form_gui->getInput("news_visibility"));
$this->news_item->setContentLong($this->form_gui->getInput("news_content_long"));
$this->news_item->update();
}
else
{
$this->form_gui->setValuesByPost();
return $this->form_gui->getHtml();
}
}

+ Here is the call graph for this function:

Field Documentation

ilNewsItemGUI::$context_obj_id
protected

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

Referenced by getContextObjId().

ilNewsItemGUI::$context_obj_type
protected

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

Referenced by getContextObjType().

ilNewsItemGUI::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

ilNewsItemGUI::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

ilNewsItemGUI::$enable_edit = 0
protected

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

Referenced by getEnableEdit().

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: