Public Member Functions | Protected Attributes

ilHtmlBlockGUIGen Class Reference

GUI class for HTML Block. More...

Inheritance diagram for ilHtmlBlockGUIGen:
Collaboration diagram for ilHtmlBlockGUIGen:

Public Member Functions

 __construct ()
 Constructor.
executeCommand ()
 Execute command.
 setFormEditMode ($a_form_edit_mode)
 Set FormEditMode.
 getFormEditMode ()
 Get FormEditMode.
 outputFormHtmlBlock ()
 FORM HtmlBlock: Output form.
 editHtmlBlock ()
 FORM HtmlBlock: Edit form.
 createHtmlBlock ()
 FORM HtmlBlock: Create HtmlBlock.
 saveHtmlBlock ()
 FORM HtmlBlock: Save HtmlBlock.
 updateHtmlBlock ()
 FORM HtmlBlock: Update HtmlBlock.
 getValuesHtmlBlock ()
 FORM HtmlBlock: Get current values for HtmlBlock form.
 checkInputHtmlBlock ()
 FORM HtmlBlock: Check input.
 prepareSaveHtmlBlock (&$a_html_block)
 FORM HtmlBlock: Prepare Saving of HtmlBlock.
 prepareFormHtmlBlock (&$a_form_gui)
 FORM HtmlBlock: Prepare form.

Protected Attributes

 $form_edit_mode

Detailed Description

GUI class for HTML Block.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

Definition at line 36 of file class.ilHtmlBlockGUIGen.php.


Constructor & Destructor Documentation

ilHtmlBlockGUIGen::__construct (  ) 

Constructor.

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

References $_GET, and $ilCtrl.

Referenced by ilHtmlBlockGUI::ilHtmlBlockGUI().

        {
                global $ilCtrl;
                
                $this->ctrl = $ilCtrl;
                
                
                include_once("Services/Block/classes/class.ilHtmlBlock.php");
                if ($_GET["html_block_id"] > 0)
                {
                        $this->html_block = new ilHtmlBlock($_GET["html_block_id"]);
                }
                
                $this->ctrl->saveParameter($this, array("html_block_id"));
                

        }

Here is the caller graph for this function:


Member Function Documentation

ilHtmlBlockGUIGen::checkInputHtmlBlock (  ) 

FORM HtmlBlock: Check input.

Definition at line 269 of file class.ilHtmlBlockGUIGen.php.

References ilTypeCheck::check().

Referenced by saveHtmlBlock(), ilHtmlBlockGUI::saveHtmlBlock(), and updateHtmlBlock().

        {
                
                include_once("./Services/Utilities/classes/class.ilTypeCheck.php");
                $ilTypeCheck = new ilTypeCheck();
                
                $this->form_check["HtmlBlock"] = array();
                $this->form_check["HtmlBlock"]["Title"] =
                        ilTypeCheck::check("varchar", $_POST["block_title"], true);
                $this->form_check["HtmlBlock"]["Content"] =
                        ilTypeCheck::check("text", $_POST["block_content"], false);
                
                foreach($this->form_check["HtmlBlock"] as $prop_check)
                {
                        if (!$prop_check["ok"])
                        {
                                return false;
                        }
                }
                return true;

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilHtmlBlockGUIGen::createHtmlBlock (  ) 

FORM HtmlBlock: Create HtmlBlock.

Definition at line 179 of file class.ilHtmlBlockGUIGen.php.

References outputFormHtmlBlock(), and setFormEditMode().

Referenced by ilHtmlBlockGUI::create().

        {
                $this->setFormEditMode(IL_FORM_CREATE);
                return $this->outputFormHtmlBlock();

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilHtmlBlockGUIGen::editHtmlBlock (  ) 

FORM HtmlBlock: Edit form.

Definition at line 168 of file class.ilHtmlBlockGUIGen.php.

References outputFormHtmlBlock(), and setFormEditMode().

        {
                $this->setFormEditMode(IL_FORM_EDIT);
                return $this->outputFormHtmlBlock();

        }

Here is the call graph for this function:

& ilHtmlBlockGUIGen::executeCommand (  ) 

Execute command.

Reimplemented in ilHtmlBlockGUI.

Definition at line 67 of file class.ilHtmlBlockGUIGen.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;

        }

ilHtmlBlockGUIGen::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 101 of file class.ilHtmlBlockGUIGen.php.

Referenced by getValuesHtmlBlock(), and outputFormHtmlBlock().

        {
                return $this->form_edit_mode;
        }

Here is the caller graph for this function:

ilHtmlBlockGUIGen::getValuesHtmlBlock (  ) 

FORM HtmlBlock: Get current values for HtmlBlock form.

Definition at line 237 of file class.ilHtmlBlockGUIGen.php.

References ilObjAdvancedEditing::_getUsedHTMLTagsAsString(), getFormEditMode(), and ilUtil::stripSlashes().

Referenced by outputFormHtmlBlock().

        {
                $values = array();
                
                switch ($this->getFormEditMode())
                {
                        case IL_FORM_CREATE:
                                $values["Title"] = "";
                                $values["Content"] = "";
                                break;
                                
                        case IL_FORM_EDIT:
                                $values["Title"] = $this->html_block->getTitle();
                                $values["Content"] = $this->html_block->getContent();
                                break;
                                
                        case IL_FORM_RE_EDIT:
                        case IL_FORM_RE_CREATE:
                                $values["Title"] = ilUtil::stripSlashes($_POST["block_title"]);
                                $values["Content"] = ilUtil::stripSlashes($_POST["block_content"]
                                ,true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString());
                                break;
                }
                
                return $values;

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilHtmlBlockGUIGen::outputFormHtmlBlock (  ) 

FORM HtmlBlock: Output form.

Definition at line 110 of file class.ilHtmlBlockGUIGen.php.

References $lng, getFormEditMode(), getValuesHtmlBlock(), and prepareFormHtmlBlock().

Referenced by createHtmlBlock(), editHtmlBlock(), saveHtmlBlock(), and updateHtmlBlock().

        {
                global $lng;
                
                $lng->loadLanguageModule("block");
                
                include("Services/Form/classes/class.ilPropertyFormGUI.php");
                
                $form_gui = new ilPropertyFormGUI();
                
                $values = $this->getValuesHtmlBlock();
                
                // Property Title
                $alert = ($this->form_check["HtmlBlock"]["Title"]["error"] != "")
                        ? $this->form_check["HtmlBlock"]["Title"]["error"]
                        : "";
                $form_gui->addTextProperty($lng->txt("block_html_block_title"),
                        "block_title",
                        $values["Title"],
                        "", $alert, true
                        , "200");
                
                // Property Content
                $alert = ($this->form_check["HtmlBlock"]["Content"]["error"] != "")
                        ? $this->form_check["HtmlBlock"]["Content"]["error"]
                        : "";
                $form_gui->addTextAreaProperty($lng->txt("block_html_block_content"),
                        "block_content",
                        $values["Content"],
                        "", $alert, false
                        , "40", "8", true);
                
                // save and cancel commands
                if (in_array($this->getFormEditMode(), array(IL_FORM_CREATE,IL_FORM_RE_CREATE)))
                {
                        $form_gui->addCommandButton("saveHtmlBlock", $lng->txt("save"));
                        $form_gui->addCommandButton("cancelSaveHtmlBlock", $lng->txt("cancel"));
                }
                else
                {
                        $form_gui->addCommandButton("updateHtmlBlock", $lng->txt("save"));
                        $form_gui->addCommandButton("cancelUpdateHtmlBlock", $lng->txt("cancel"));
                }
                
                $form_gui->setTitle($lng->txt("block_html_block_head"));
                $form_gui->setFormAction($this->ctrl->getFormAction($this));
                
                // individual preparation of form
                $this->prepareFormHtmlBlock($form_gui);
                
                return $form_gui->getHTML();

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilHtmlBlockGUIGen::prepareFormHtmlBlock ( &$  a_form_gui  ) 

FORM HtmlBlock: Prepare form.

(Can be overwritten in derived classes)

Parameters:
object $a_form_gui ilPropertyFormGUI instance.

Definition at line 307 of file class.ilHtmlBlockGUIGen.php.

Referenced by outputFormHtmlBlock().

        {

        }

Here is the caller graph for this function:

ilHtmlBlockGUIGen::prepareSaveHtmlBlock ( &$  a_html_block  ) 

FORM HtmlBlock: Prepare Saving of HtmlBlock.

Parameters:
object $a_html_block HtmlBlock object.

Reimplemented in ilHtmlBlockGUI.

Definition at line 297 of file class.ilHtmlBlockGUIGen.php.

Referenced by saveHtmlBlock().

        {

        }

Here is the caller graph for this function:

ilHtmlBlockGUIGen::saveHtmlBlock (  ) 

FORM HtmlBlock: Save HtmlBlock.

Reimplemented in ilHtmlBlockGUI.

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

References ilObjAdvancedEditing::_getUsedHTMLTagsAsString(), checkInputHtmlBlock(), outputFormHtmlBlock(), prepareSaveHtmlBlock(), setFormEditMode(), and ilUtil::stripSlashes().

        {
                include_once("./classes/class.ilObjAdvancedEditing.php");
                if ($this->checkInputHtmlBlock())
                {
                        $this->html_block = new ilHtmlBlock();
                        $this->html_block->setTitle(ilUtil::stripSlashes($_POST["block_title"]));
                        $this->html_block->setContent(ilUtil::stripSlashes($_POST["block_content"]
                                ,true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString()));
                        $this->prepareSaveHtmlBlock($this->html_block);
                        $this->html_block->create();
                }
                else
                {
                        $this->setFormEditMode(IL_FORM_RE_CREATE);
                        return $this->outputFormHtmlBlock();
                }

        }

Here is the call graph for this function:

ilHtmlBlockGUIGen::setFormEditMode ( a_form_edit_mode  ) 

Set FormEditMode.

Parameters:
int $a_form_edit_mode Form Edit Mode (IL_FORM_EDIT | IL_FORM_CREATE | IL_FORM_RE_EDIT | IL_FORM_RE_CREATE)

Definition at line 91 of file class.ilHtmlBlockGUIGen.php.

Referenced by createHtmlBlock(), editHtmlBlock(), saveHtmlBlock(), and updateHtmlBlock().

        {
                $this->form_edit_mode = $a_form_edit_mode;
        }

Here is the caller graph for this function:

ilHtmlBlockGUIGen::updateHtmlBlock (  ) 

FORM HtmlBlock: Update HtmlBlock.

Definition at line 214 of file class.ilHtmlBlockGUIGen.php.

References ilObjAdvancedEditing::_getUsedHTMLTagsAsString(), checkInputHtmlBlock(), outputFormHtmlBlock(), setFormEditMode(), and ilUtil::stripSlashes().

        {
                include_once("./classes/class.ilObjAdvancedEditing.php");
                if ($this->checkInputHtmlBlock())
                {
                        
                        $this->html_block->setTitle(ilUtil::stripSlashes($_POST["block_title"]));
                        $this->html_block->setContent(ilUtil::stripSlashes($_POST["block_content"]
                                ,true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString()));
                        $this->html_block->update();
                }
                else
                {
                        $this->setFormEditMode(IL_FORM_RE_EDIT);
                        return $this->outputFormHtmlBlock();
                }

        }

Here is the call graph for this function:


Field Documentation

ilHtmlBlockGUIGen::$form_edit_mode [protected]

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


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