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

This class represents a text area property in a property form. More...

+ Inheritance diagram for ilTextAreaInputGUI:
+ Collaboration diagram for ilTextAreaInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setCols ($a_cols)
 Set Cols.
 getCols ()
 Get Cols.
 setRows ($a_rows)
 Set Rows.
 getRows ()
 Get Rows.
 setUseRte ($a_usert)
 Set Use Rich Text Editing.
 getUseRte ()
 Get Use Rich Text Editing.
 addPlugin ($a_plugin)
 Add RTE plugin.
 removePlugin ($a_plugin)
 Remove RTE plugin.
 addButton ($a_button)
 Add RTE button.
 removeButton ($a_button)
 Remove RTE button.
 setRTESupport ($obj_id, $obj_type, $module, $cfg_template=null)
 Set RTE support for a special module.
 removeRTESupport ()
 Remove RTE support for a special module.
 setRteTags ($a_rtetags)
 Set Valid RTE Tags.
 getRteTags ()
 Get Valid RTE Tags.
 setRteTagSet ($a_set_name)
 Set Set of Valid RTE Tags.
 getRteTagSet ($a_set_name)
 Get Set of Valid RTE Tags.
 getRteTagString ()
 RTE Tag string.
 setValueByArray ($a_values)
 Set value by array.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
 usePurifier ($a_flag=null)
 Setter/Getter for the html purifier usage.
 setPurifier (ilHtmlPurifierInterface $Purifier)
 Setter for the html purifier.
 getPurifier ()
 Getter for the html purifier.
 setRTERootBlockElement ($a_root_block_element)
 Setter for the TinyMCE root block element.
 getRTERootBlockElement ()
 Getter for the TinyMCE root block element.
 disableButtons ($a_button)
 Sets buttons which should be disabled in TinyMCE.
 getDisabledButtons ($as_array=true)
 Returns the disabled TinyMCE buttons.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
 getItemByPostVar ($a_post_var)
 Get item by post var.
- Public Member Functions inherited from ilFormPropertyGUI
executeCommand ()
 Execute command.
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.
 setParentForm ($a_parentform)
 Set Parent Form.
 getParentForm ()
 Get Parent Form.
 setParent ($a_val)
 Set Parent GUI object.
 getParent ()
 Get Parent GUI object.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 serializeData ()
 serialize data
 unserializeData ($a_data)
 unserialize data
 writeToSession ()
 Write to session.
 clearFromSession ()
 Clear session value.
 readFromSession ()
 Read from session.
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties)

Protected Attributes

 $value
 $cols
 $rows
 $usert
 $rtetags
 $plugins
 $removeplugins
 $buttons
 $rtesupport
 $disabled_buttons = array()
 $usePurifier = false
 $Purifier = null
 $root_block_element = null
 $rte_tag_set
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform
 $hidden_title = ""

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.

Detailed Description

This class represents a text area property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

ilTextAreaInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

Definition at line 120 of file class.ilTextAreaInputGUI.php.

References setRteTagSet(), and ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("textarea");
$this->setRteTagSet("standard");
$this->plugins = array();
$this->removeplugins = array();
$this->buttons = array();
$this->rteSupport = array();
}

+ Here is the call graph for this function:

Member Function Documentation

ilTextAreaInputGUI::addButton (   $a_button)

Add RTE button.

Parameters
string$a_buttonButton name

Definition at line 236 of file class.ilTextAreaInputGUI.php.

{
$this->buttons[$a_button] = $a_button;
}
ilTextAreaInputGUI::addPlugin (   $a_plugin)

Add RTE plugin.

Parameters
string$a_pluginPlugin name

Definition at line 216 of file class.ilTextAreaInputGUI.php.

{
$this->plugins[$a_plugin] = $a_plugin;
}
ilTextAreaInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 342 of file class.ilTextAreaInputGUI.php.

References $_POST, $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), getPurifier(), ilFormPropertyGUI\getRequired(), getRteTagString(), getUseRte(), ilFormPropertyGUI\setAlert(), ilUtil\stripOnlySlashes(), ilUtil\stripSlashes(), and usePurifier().

{
global $lng;
include_once("./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php");
if($this->usePurifier() && $this->getPurifier())
{
$_POST[$this->getPostVar()] = $this->getPurifier()->purify($_POST[$this->getPostVar()]);
}
else
{
$allowed = $this->getRteTagString();
if ($this->plugins["latex"] == "latex" && !is_int(strpos($allowed, "<span>")))
{
$allowed.= "<span>";
}
$_POST[$this->getPostVar()] = ($this->getUseRte())
? ilUtil::stripSlashes($_POST[$this->getPostVar()], true, $allowed)
}
if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilTextAreaInputGUI::disableButtons (   $a_button)

Sets buttons which should be disabled in TinyMCE.

Parameters
mixed$a_buttonEither a button string or an array of button strings
Returns
ilTextAreaInputGUI Instance of ilTextAreaInputGUI public

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

{
if(is_array($a_button))
{
$this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, $a_button));
}
else
{
$this->disabled_buttons = array_unique(array_merge($this->disabled_buttons, array($a_button)));
}
return $this;
}
ilTextAreaInputGUI::getCols ( )

Get Cols.

Returns
int Cols

Definition at line 166 of file class.ilTextAreaInputGUI.php.

References $cols.

Referenced by insert().

{
return $this->cols;
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getDisabledButtons (   $as_array = true)

Returns the disabled TinyMCE buttons.

Parameters
boolean$as_arrayShould the disabled buttons be returned as a string or as an array
Returns
Array Array of disabled buttons public

Definition at line 584 of file class.ilTextAreaInputGUI.php.

References $disabled_buttons.

Referenced by insert().

{
if(!$as_array)
{
return implode(',', $this->disabled_buttons);
}
else
{
}
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getPurifier ( )

Getter for the html purifier.

Returns
ilHtmlPurifierInterface Instance of ilHtmlPurifierInterface public

Definition at line 525 of file class.ilTextAreaInputGUI.php.

References $Purifier.

Referenced by checkInput().

{
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getRows ( )

Get Rows.

Returns
int Rows

Definition at line 186 of file class.ilTextAreaInputGUI.php.

References $rows.

Referenced by insert().

{
return $this->rows;
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getRTERootBlockElement ( )

Getter for the TinyMCE root block element.

Returns
string Root block element of TinyMCE public

Definition at line 549 of file class.ilTextAreaInputGUI.php.

References $root_block_element.

Referenced by insert().

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getRteTags ( )

Get Valid RTE Tags.

Returns
array Valid RTE Tags

Definition at line 286 of file class.ilTextAreaInputGUI.php.

References $rtetags.

Referenced by getRteTagString(), and insert().

{
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getRteTagSet (   $a_set_name)

Get Set of Valid RTE Tags.

Returns
array Set name "standard", "extended", "extended_img", "extended_table", "extended_table_img", "full"

Definition at line 308 of file class.ilTextAreaInputGUI.php.

{
return $this->rte_tag_set[$a_set_name];
}
ilTextAreaInputGUI::getRteTagString ( )

RTE Tag string.

Definition at line 317 of file class.ilTextAreaInputGUI.php.

References getRteTags().

Referenced by checkInput().

{
$result = "";
foreach ($this->getRteTags() as $tag)
{
$result .= "<$tag>";
}
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getUseRte ( )

Get Use Rich Text Editing.

Returns
int Use Rich Text Editing

Definition at line 206 of file class.ilTextAreaInputGUI.php.

References $usert.

Referenced by checkInput(), and insert().

{
return $this->usert;
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 146 of file class.ilTextAreaInputGUI.php.

References $value.

Referenced by insert().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 378 of file class.ilTextAreaInputGUI.php.

References ilRTE\_getRTEClassname(), getCols(), ilFormPropertyGUI\getDisabled(), getDisabledButtons(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getHiddenTag(), ilFormPropertyGUI\getPostVar(), getRows(), getRTERootBlockElement(), getRteTags(), getUseRte(), getValue(), and ilUtil\prepareFormOutput().

{
$ttpl = new ilTemplate("tpl.prop_textarea.html", true, true, "Services/Form");
// disabled rte
if ($this->getUseRte() && $this->getDisabled())
{
$ttpl->setCurrentBlock("disabled_rte");
$ttpl->setVariable("DR_VAL", $this->getValue());
$ttpl->parseCurrentBlock();
}
else
{
if ($this->getUseRte())
{
include_once "./Services/RTE/classes/class.ilRTE.php";
$rtestring = ilRTE::_getRTEClassname();
include_once "./Services/RTE/classes/class.$rtestring.php";
$rte = new $rtestring();
// @todo: Check this.
$rte->addPlugin("emotions");
foreach ($this->plugins as $plugin)
{
if (strlen($plugin))
{
$rte->addPlugin($plugin);
}
}
foreach ($this->removeplugins as $plugin)
{
if (strlen($plugin))
{
$rte->removePlugin($plugin);
}
}
foreach ($this->buttons as $button)
{
if (strlen($button))
{
$rte->addButton($button);
}
}
$rte->disableButtons($this->getDisabledButtons());
if($this->getRTERootBlockElement() !== null)
{
$rte->setRTERootBlockElement($this->getRTERootBlockElement());
}
if (count($this->rteSupport) >= 3)
{
$rte->addRTESupport($this->rteSupport["obj_id"], $this->rteSupport["obj_type"], $this->rteSupport["module"], false, $this->rteSupport['cfg_template']);
}
else
{
$rte->addCustomRTESupport(0, "", $this->getRteTags());
}
$ttpl->touchBlock("prop_ta_w");
$ttpl->setCurrentBlock("prop_textarea");
$ttpl->setVariable("ROWS", $this->getRows());
}
else
{
$ttpl->touchBlock("no_rteditor");
if ($this->getCols() > 5)
{
$ttpl->setCurrentBlock("prop_ta_c");
$ttpl->setVariable("COLS", $this->getCols());
$ttpl->parseCurrentBlock();
}
else
{
$ttpl->touchBlock("prop_ta_w");
}
$ttpl->setCurrentBlock("prop_textarea");
$ttpl->setVariable("ROWS", $this->getRows());
}
if (!$this->getDisabled())
{
$ttpl->setVariable("POST_VAR",
$this->getPostVar());
}
$ttpl->setVariable("ID", $this->getFieldId());
if ($this->getDisabled())
{
$ttpl->setVariable('DISABLED','disabled="disabled" ');
}
$ttpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
$ttpl->parseCurrentBlock();
}
if ($this->getDisabled())
{
$ttpl->setVariable("HIDDEN_INPUT",
$this->getHiddenTag($this->getPostVar(), $this->getValue()));
}
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $ttpl->get());
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilTextAreaInputGUI::removeButton (   $a_button)

Remove RTE button.

Parameters
string$a_buttonButton name

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

{
unset($this->buttons[$a_button]);
}
ilTextAreaInputGUI::removePlugin (   $a_plugin)

Remove RTE plugin.

Parameters
string$a_pluginPlugin name

Definition at line 226 of file class.ilTextAreaInputGUI.php.

{
$this->removeplugins[$a_plugin] = $a_plugin;
}
ilTextAreaInputGUI::removeRTESupport ( )

Remove RTE support for a special module.

Definition at line 266 of file class.ilTextAreaInputGUI.php.

{
$this->rteSupport = array();
}
ilTextAreaInputGUI::setPurifier ( ilHtmlPurifierInterface  $Purifier)

Setter for the html purifier.

Parameters
ilHtmlPurifierInterfaceInstance of ilHtmlPurifierInterface
Returns
ilTextAreaInputGUI Instance of ilTextAreaInputGUI public

Definition at line 513 of file class.ilTextAreaInputGUI.php.

References $Purifier.

{
$this->Purifier = $Purifier;
return $this;
}
ilTextAreaInputGUI::setRTERootBlockElement (   $a_root_block_element)

Setter for the TinyMCE root block element.

Parameters
string$a_root_block_elementroot block element
Returns
ilTextAreaInputGUI Instance of ilTextAreaInputGUI public

Definition at line 537 of file class.ilTextAreaInputGUI.php.

{
$this->root_block_element = $a_root_block_element;
return $this;
}
ilTextAreaInputGUI::setRTESupport (   $obj_id,
  $obj_type,
  $module,
  $cfg_template = null 
)

Set RTE support for a special module.

Parameters
int$obj_idObject ID
string$obj_typeObject Type
string$moduleILIAS module

Definition at line 258 of file class.ilTextAreaInputGUI.php.

{
$this->rteSupport = array("obj_id" => $obj_id, "obj_type" => $obj_type, "module" => $module, 'cfg_template' => $cfg_template);
}
ilTextAreaInputGUI::setRteTags (   $a_rtetags)

Set Valid RTE Tags.

Parameters
array$a_rtetagsValid RTE Tags

Definition at line 276 of file class.ilTextAreaInputGUI.php.

Referenced by setRteTagSet().

{
$this->rtetags = $a_rtetags;
}

+ Here is the caller graph for this function:

ilTextAreaInputGUI::setRteTagSet (   $a_set_name)

Set Set of Valid RTE Tags.

Returns
array Set name "standard", "extended", "extended_img", "extended_table", "extended_table_img", "full"

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

References setRteTags().

Referenced by __construct().

{
$this->setRteTags($this->rte_tag_set[$a_set_name]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTextAreaInputGUI::setUseRte (   $a_usert)

Set Use Rich Text Editing.

Parameters
int$a_usertUse Rich Text Editing

Definition at line 196 of file class.ilTextAreaInputGUI.php.

{
$this->usert = $a_usert;
}
ilTextAreaInputGUI::setValue (   $a_value)
ilTextAreaInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 332 of file class.ilTextAreaInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and setValue().

{
$this->setValue($a_values[$this->getPostVar()]);
}

+ Here is the call graph for this function:

ilTextAreaInputGUI::usePurifier (   $a_flag = null)

Setter/Getter for the html purifier usage.

Parameters
boolean$a_flagUse purifier or not
Returns
mixed Returns instance of ilTextAreaInputGUI or boolean public

Definition at line 495 of file class.ilTextAreaInputGUI.php.

References $usePurifier.

Referenced by checkInput().

{
if(null === $a_flag)
{
}
$this->usePurifier = $a_flag;
return $this;
}

+ Here is the caller graph for this function:

Field Documentation

ilTextAreaInputGUI::$buttons
protected

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

ilTextAreaInputGUI::$cols
protected

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

Referenced by getCols().

ilTextAreaInputGUI::$disabled_buttons = array()
protected

Definition at line 53 of file class.ilTextAreaInputGUI.php.

Referenced by getDisabledButtons().

ilTextAreaInputGUI::$plugins
protected

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

ilTextAreaInputGUI::$Purifier = null
protected

Definition at line 73 of file class.ilTextAreaInputGUI.php.

Referenced by getPurifier(), and setPurifier().

ilTextAreaInputGUI::$removeplugins
protected

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

ilTextAreaInputGUI::$root_block_element = null
protected

Definition at line 82 of file class.ilTextAreaInputGUI.php.

Referenced by getRTERootBlockElement().

ilTextAreaInputGUI::$rows
protected

Definition at line 37 of file class.ilTextAreaInputGUI.php.

Referenced by getRows().

ilTextAreaInputGUI::$rte_tag_set
protected
Initial value:
array(
"standard" => array ("strong", "em", "u", "ol", "li", "ul", "p", "div",
"i", "b", "code", "sup", "sub", "pre", "strike", "gap"),
"extended" => array (
"a","blockquote","br","cite","code","div","em","h1","h2","h3",
"h4","h5","h6","hr","li","ol","p",
"pre","span","strike","strong","sub","sup","u","ul",
"i", "b", "gap"),
"extended_img" => array (
"a","blockquote","br","cite","code","div","em","h1","h2","h3",
"h4","h5","h6","hr","img","li","ol","p",
"pre","span","strike","strong","sub","sup","u","ul",
"i", "b", "gap"),
"extended_table" => array (
"a","blockquote","br","cite","code","div","em","h1","h2","h3",
"h4","h5","h6","hr","li","ol","p",
"pre","span","strike","strong","sub","sup","table","td",
"tr","u","ul", "i", "b", "gap"),
"extended_table_img" => array (
"a","blockquote","br","cite","code","div","em","h1","h2","h3",
"h4","h5","h6","hr","img","li","ol","p",
"pre","span","strike","strong","sub","sup","table","td",
"tr","u","ul", "i", "b", "gap"),
"full" => array (
"a","blockquote","br","cite","code","div","em","h1","h2","h3",
"h4","h5","h6","hr","img","li","ol","p",
"pre","span","strike","strong","sub","sup","table","td",
"tr","u","ul","ruby","rbc","rtc","rb","rt","rp", "i", "b", "gap"))

Definition at line 84 of file class.ilTextAreaInputGUI.php.

ilTextAreaInputGUI::$rtesupport
protected

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

ilTextAreaInputGUI::$rtetags
protected

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

Referenced by getRteTags().

ilTextAreaInputGUI::$usePurifier = false
protected

Definition at line 63 of file class.ilTextAreaInputGUI.php.

Referenced by usePurifier().

ilTextAreaInputGUI::$usert
protected

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

Referenced by getUseRte().

ilTextAreaInputGUI::$value
protected

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

Referenced by getValue().


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