ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNewsItemGUIGen Class Reference

User Interface for NewsItem entities. More...

+ Inheritance diagram for ilNewsItemGUIGen:
+ Collaboration diagram for ilNewsItemGUIGen:

Public Member Functions

 __construct ()
 Constructor.
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.
 saveNewsItem ()
 FORM NewsItem: Save NewsItem.
 updateNewsItem ()
 FORM NewsItem: Update NewsItem.
 initFormNewsItem ($a_mode)
 FORM NewsItem: Init form.
 getValuesNewsItem ()
 FORM NewsItem: Get current values for NewsItem form.
 cancelSaveNewsItem ()
 FORM NewsItem: Cancel save.
 cancelUpdateNewsItem ()
 FORM NewsItem: Cancel update.
 exitSaveNewsItem ()
 FORM NewsItem: Exit save.
 exitUpdateNewsItem ()
 FORM NewsItem: Exit update.
 prepareSaveNewsItem (&$a_news_item)
 FORM NewsItem: Prepare Saving of NewsItem.
 prepareFormNewsItem (&$a_form_gui)
 FORM NewsItem: Prepare form.
 getNewsForContextBlock ()
 BLOCK NewsForContext: Get block HTML.
 prepareBlockNewsForContext (&$a_block_gui)
 BLOCK NewsForContext: Prepare block.
 prepareBlockQueryNewsForContext (&$a_news_item)
 BLOCK NewsForContext: Prepare query for getting data for list block.
 getNewsForContextTable ()
 TABLE NewsForContext: Get table HTML.
 prepareTableQueryNewsForContext (&$a_news_item)
 TABLE NewsForContext: Prepare query for getting data for list table.
 prepareTableNewsForContext (&$a_table_gui)
 TABLE NewsForContext: Prepare table before it is rendered.

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.ilNewsItemGUIGen.php 13277 2007-02-18 21:03:20Z akill

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

Constructor & Destructor Documentation

ilNewsItemGUIGen::__construct ( )

Constructor.

Reimplemented in ilNewsItemGUI.

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

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

{
global $ilCtrl;
$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());
}

+ Here is the call graph for this function:

Member Function Documentation

ilNewsItemGUIGen::cancelSaveNewsItem ( )

FORM NewsItem: Cancel save.

(Can be overwritten in derived classes)

Reimplemented in ilNewsItemGUI.

Definition at line 383 of file class.ilNewsItemGUIGen.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}
ilNewsItemGUIGen::cancelUpdateNewsItem ( )

FORM NewsItem: Cancel update.

(Can be overwritten in derived classes)

Reimplemented in ilNewsItemGUI.

Definition at line 394 of file class.ilNewsItemGUIGen.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}
ilNewsItemGUIGen::createNewsItem ( )

FORM NewsItem: Create NewsItem.

Definition at line 223 of file class.ilNewsItemGUIGen.php.

References IL_FORM_CREATE, and initFormNewsItem().

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

+ Here is the call graph for this function:

ilNewsItemGUIGen::editNewsItem ( )

FORM NewsItem: Edit form.

Definition at line 234 of file class.ilNewsItemGUIGen.php.

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

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

+ Here is the call graph for this function:

& ilNewsItemGUIGen::executeCommand ( )

Execute command.

Definition at line 80 of file class.ilNewsItemGUIGen.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;
}
ilNewsItemGUIGen::exitSaveNewsItem ( )

FORM NewsItem: Exit save.

(Can be overwritten in derived classes)

Reimplemented in ilNewsItemGUI.

Definition at line 405 of file class.ilNewsItemGUIGen.php.

References $ilCtrl.

Referenced by saveNewsItem().

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::exitUpdateNewsItem ( )

FORM NewsItem: Exit update.

(Can be overwritten in derived classes)

Reimplemented in ilNewsItemGUI.

Definition at line 416 of file class.ilNewsItemGUIGen.php.

References $ilCtrl.

Referenced by updateNewsItem().

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getContextObjId ( )

Get ContextObjId.

Returns
int

Definition at line 134 of file class.ilNewsItemGUIGen.php.

References $context_obj_id.

Referenced by prepareBlockQueryNewsForContext(), and prepareTableQueryNewsForContext().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getContextObjType ( )

Get ContextObjType.

Returns
int

Definition at line 154 of file class.ilNewsItemGUIGen.php.

References $context_obj_type.

Referenced by prepareBlockQueryNewsForContext(), and prepareTableQueryNewsForContext().

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getContextSubObjId ( )

Get ContextSubObjId.

Returns
int

Definition at line 174 of file class.ilNewsItemGUIGen.php.

References $context_sub_obj_id.

Referenced by prepareBlockQueryNewsForContext(), and prepareTableQueryNewsForContext().

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getContextSubObjType ( )

Get ContextSubObjType.

Returns
int

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

References $context_sub_obj_type.

Referenced by prepareBlockQueryNewsForContext(), and prepareTableQueryNewsForContext().

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getEnableEdit ( )

Get EnableEdit.

Returns
boolean Edit mode on/off

Definition at line 114 of file class.ilNewsItemGUIGen.php.

References $enable_edit.

Referenced by ilNewsItemGUI\confirmDeletionNewsItems(), ilNewsItemGUI\deleteNewsItems(), ilNewsItemGUI\editNews(), ilNewsItemGUI\prepareBlockNewsForContext(), ilNewsItemGUI\saveNewsItem(), and ilNewsItemGUI\updateNewsItem().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::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 214 of file class.ilNewsItemGUIGen.php.

References $form_edit_mode.

{
}
ilNewsItemGUIGen::getNewsForContextBlock ( )

BLOCK NewsForContext: Get block HTML.

Definition at line 447 of file class.ilNewsItemGUIGen.php.

References $data, $lng, prepareBlockNewsForContext(), and prepareBlockQueryNewsForContext().

Referenced by ilNewsItemGUI\getHTML().

{
global $lng;
include_once("Services/News/classes/class.ilNewsForContextBlockGUI.php");
$block_gui = new ilNewsForContextBlockGUI(get_class($this));
$this->prepareBlockNewsForContext($block_gui);
$news_item = new ilNewsItemGen();
$this->prepareBlockQueryNewsForContext($news_item);
$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:

ilNewsItemGUIGen::getNewsForContextTable ( )

TABLE NewsForContext: Get table HTML.

Definition at line 496 of file class.ilNewsItemGUIGen.php.

References $data, $lng, prepareTableNewsForContext(), and prepareTableQueryNewsForContext().

Referenced by ilNewsItemGUI\editNews().

{
global $lng;
include_once("Services/News/classes/class.ilNewsForContextTableGUI.php");
$table_gui = new ilNewsForContextTableGUI($this, "getNewsForContextTable");
$news_item = new ilNewsItemGen();
$this->prepareTableQueryNewsForContext($news_item);
$data = $news_item->queryNewsForContext();
$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);
$this->prepareTableNewsForContext($table_gui);
return $table_gui->getHTML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUIGen::getValuesNewsItem ( )

FORM NewsItem: Get current values for NewsItem form.

Definition at line 366 of file class.ilNewsItemGUIGen.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:

ilNewsItemGUIGen::initFormNewsItem (   $a_mode)

FORM NewsItem: Init form.

Parameters
int$a_modeForm Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE)

Definition at line 298 of file class.ilNewsItemGUIGen.php.

References $lng, IL_FORM_CREATE, IL_FORM_RE_CREATE, prepareFormNewsItem(), ilRadioOption\setInfo(), and ilFormPropertyGUI\setInfo().

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

{
global $lng;
$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->prepareFormNewsItem($this->form_gui);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareBlockNewsForContext ( $a_block_gui)

BLOCK NewsForContext: Prepare block.

(Can be overwritten in derived classes)

Parameters
object$a_block_guiilBlockGUI instance.

Reimplemented in ilNewsItemGUI.

Definition at line 472 of file class.ilNewsItemGUIGen.php.

Referenced by getNewsForContextBlock().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareBlockQueryNewsForContext ( $a_news_item)

BLOCK NewsForContext: Prepare query for getting data for list block.

Parameters
object$a_news_itemNewsItem entity.

Reimplemented in ilNewsItemGUI.

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

References getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

Referenced by getNewsForContextBlock().

{
$a_news_item->setContextObjId($this->getContextObjId());
$a_news_item->setContextObjType($this->getContextObjType());
$a_news_item->setContextSubObjId($this->getContextSubObjId());
$a_news_item->setContextSubObjType($this->getContextSubObjType());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareFormNewsItem ( $a_form_gui)

FORM NewsItem: Prepare form.

(Can be overwritten in derived classes)

Parameters
object$a_form_guiilPropertyFormGUI instance.

Reimplemented in ilNewsItemGUI.

Definition at line 438 of file class.ilNewsItemGUIGen.php.

Referenced by initFormNewsItem().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareSaveNewsItem ( $a_news_item)

FORM NewsItem: Prepare Saving of NewsItem.

Parameters
object$a_news_itemNewsItem object.

Reimplemented in ilNewsItemGUI.

Definition at line 428 of file class.ilNewsItemGUIGen.php.

Referenced by saveNewsItem().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareTableNewsForContext ( $a_table_gui)

TABLE NewsForContext: Prepare table before it is rendered.

Please overwrite this in derived classes.

Parameters
object$a_table_guiTable GUI object.

Reimplemented in ilNewsItemGUI.

Definition at line 536 of file class.ilNewsItemGUIGen.php.

Referenced by getNewsForContextTable().

{
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::prepareTableQueryNewsForContext ( $a_news_item)

TABLE NewsForContext: Prepare query for getting data for list table.

Parameters
object$a_news_itemNewsItem entity.

Definition at line 521 of file class.ilNewsItemGUIGen.php.

References getContextObjId(), getContextObjType(), getContextSubObjId(), and getContextSubObjType().

Referenced by getNewsForContextTable().

{
$a_news_item->setContextObjId($this->getContextObjId());
$a_news_item->setContextObjType($this->getContextObjType());
$a_news_item->setContextSubObjId($this->getContextSubObjId());
$a_news_item->setContextSubObjType($this->getContextSubObjType());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilNewsItemGUIGen::saveNewsItem ( )

FORM NewsItem: Save NewsItem.

Reimplemented in ilNewsItemGUI.

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

References exitSaveNewsItem(), IL_FORM_CREATE, initFormNewsItem(), and prepareSaveNewsItem().

{
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"));
$this->prepareSaveNewsItem($this->news_item);
$this->news_item->create();
$this->exitSaveNewsItem();
}
else
{
$this->form_gui->setValuesByPost();
return $this->form_gui->getHtml();
}
}

+ Here is the call graph for this function:

ilNewsItemGUIGen::setContextObjId (   $a_context_obj_id)

Set ContextObjId.

Parameters
int$a_context_obj_id

Definition at line 124 of file class.ilNewsItemGUIGen.php.

Referenced by __construct().

{
$this->context_obj_id = $a_context_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::setContextObjType (   $a_context_obj_type)

Set ContextObjType.

Parameters
int$a_context_obj_type

Definition at line 144 of file class.ilNewsItemGUIGen.php.

Referenced by __construct().

{
$this->context_obj_type = $a_context_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::setContextSubObjId (   $a_context_sub_obj_id)

Set ContextSubObjId.

Parameters
int$a_context_sub_obj_id

Definition at line 164 of file class.ilNewsItemGUIGen.php.

Referenced by __construct().

{
$this->context_sub_obj_id = $a_context_sub_obj_id;
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::setContextSubObjType (   $a_context_sub_obj_type)

Set ContextSubObjType.

Parameters
int$a_context_sub_obj_type

Definition at line 184 of file class.ilNewsItemGUIGen.php.

Referenced by __construct().

{
$this->context_sub_obj_type = $a_context_sub_obj_type;
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::setEnableEdit (   $a_enable_edit = 0)

Set EnableEdit.

Parameters
boolean$a_enable_editEdit mode on/off

Definition at line 104 of file class.ilNewsItemGUIGen.php.

Referenced by __construct().

{
$this->enable_edit = $a_enable_edit;
}

+ Here is the caller graph for this function:

ilNewsItemGUIGen::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 204 of file class.ilNewsItemGUIGen.php.

{
$this->form_edit_mode = $a_form_edit_mode;
}
ilNewsItemGUIGen::updateNewsItem ( )

FORM NewsItem: Update NewsItem.

Reimplemented in ilNewsItemGUI.

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

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

{
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

ilNewsItemGUIGen::$context_obj_id
protected

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

Referenced by getContextObjId().

ilNewsItemGUIGen::$context_obj_type
protected

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

Referenced by getContextObjType().

ilNewsItemGUIGen::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

ilNewsItemGUIGen::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

ilNewsItemGUIGen::$enable_edit = 0
protected

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

Referenced by getEnableEdit().

ilNewsItemGUIGen::$form_edit_mode
protected

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

Referenced by getFormEditMode().


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