ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNewsItemGUIGen Class Reference

User Interface for NewsItem entities. More...

+ 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 25692 2010-09-15 09:44:16Z mwarkus

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

Constructor & Destructor Documentation

ilNewsItemGUIGen::__construct ( )

Constructor.

Definition at line 30 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)

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

References $ilCtrl.

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

FORM NewsItem: Cancel update.

(Can be overwritten in derived classes)

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

References $ilCtrl.

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

FORM NewsItem: Create NewsItem.

Definition at line 204 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 215 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 61 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)

Definition at line 386 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)

Definition at line 397 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 115 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 135 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 155 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 175 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 95 of file class.ilNewsItemGUIGen.php.

References $enable_edit.

{
}
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 195 of file class.ilNewsItemGUIGen.php.

References $form_edit_mode.

{
}
ilNewsItemGUIGen::getNewsForContextBlock ( )

BLOCK NewsForContext: Get block HTML.

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

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

{
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:

ilNewsItemGUIGen::getNewsForContextTable ( )

TABLE NewsForContext: Get table HTML.

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

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

{
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:

ilNewsItemGUIGen::getValuesNewsItem ( )

FORM NewsItem: Get current values for NewsItem form.

Definition at line 347 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 279 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.

Definition at line 453 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.

Definition at line 463 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.

Definition at line 419 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.

Definition at line 409 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.

Definition at line 517 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 502 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.

Definition at line 227 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 105 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 125 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 145 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 165 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 85 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 185 of file class.ilNewsItemGUIGen.php.

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

FORM NewsItem: Update NewsItem.

Definition at line 253 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 20 of file class.ilNewsItemGUIGen.php.

Referenced by getContextObjId().

ilNewsItemGUIGen::$context_obj_type
protected

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

Referenced by getContextObjType().

ilNewsItemGUIGen::$context_sub_obj_id
protected

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

Referenced by getContextSubObjId().

ilNewsItemGUIGen::$context_sub_obj_type
protected

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

Referenced by getContextSubObjType().

ilNewsItemGUIGen::$enable_edit = 0
protected

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

Referenced by getEnableEdit().

ilNewsItemGUIGen::$form_edit_mode
protected

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

Referenced by getFormEditMode().


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