ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTRBLBorderWidthInputGUI Class Reference

This class represents a border width with all/top/right/bottom/left in a property form. More...

+ Inheritance diagram for ilTRBLBorderWidthInputGUI:
+ Collaboration diagram for ilTRBLBorderWidthInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setAllValue ($a_allvalue)
 Set All Value.
 getAllValue ()
 Get All Value.
 setTopValue ($a_topvalue)
 Set Top Value.
 getTopValue ()
 Get Top Value.
 setBottomValue ($a_bottomvalue)
 Set Bottom Value.
 getBottomValue ()
 Get Bottom Value.
 setLeftValue ($a_leftvalue)
 Set Left Value.
 getLeftValue ()
 Get Left Value.
 setRightValue ($a_rightvalue)
 Set Right Value.
 getRightValue ()
 Get Right Value.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
 setValueByArray ($a_values)
 Set value by array.
- 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.
 getSubForm ()
 Get sub form html.
 hideSubForm ()
 Sub form hidden on init?
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders)
 getHiddenTitle ()
 Get hidden title.
 getItemByPostVar ($a_post_var)
 Get item by post var.
 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
- 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 border width with all/top/right/bottom/left 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 31 of file class.ilTRBLBorderWidthInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("border_width");
$this->dirs = array("all", "top", "bottom", "left", "right");
}

+ Here is the call graph for this function:

Member Function Documentation

ilTRBLBorderWidthInputGUI::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 153 of file class.ilTRBLBorderWidthInputGUI.php.

References $_POST, $dir, $lng, ilFormPropertyGUI\$type, $value, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), setTopValue(), and ilUtil\stripSlashes().

{
global $lng;
foreach ($this->dirs as $dir)
{
$type = $_POST[$this->getPostVar()][$dir]["type"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["type"]);
$num_value = $_POST[$this->getPostVar()][$dir]["num_value"] =
trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_value"]));
$num_unit = $_POST[$this->getPostVar()][$dir]["num_unit"] =
trim(ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["num_unit"]));
$pre_value = $_POST[$this->getPostVar()][$dir]["pre_calue"] =
ilUtil::stripSlashes($_POST[$this->getPostVar()][$dir]["pre_value"]);
/*
if ($this->getRequired() && trim($num_value) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}*/
if (!is_numeric($num_value) && $num_value != "")
{
$this->setAlert($lng->txt("sty_msg_input_must_be_numeric"));
return false;
}
$value = "";
if ($type == "numeric")
{
if ($num_value != "")
{
$value = $num_value.$num_unit;
}
}
else
{
$value = $pre_value;
}
if (trim($value) != "")
{
switch ($dir)
{
case "all": $this->setAllValue($value); break;
case "top": $this->setTopValue($value); break;
case "bottom": $this->setBottomValue($value); break;
case "left": $this->setLeftValue($value); break;
case "right": $this->setRightValue($value); break;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilTRBLBorderWidthInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

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

Referenced by insert().

{
return $this->allvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

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

Referenced by insert().

{
return $this->bottomvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

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

Referenced by insert().

{
return $this->leftvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

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

Referenced by insert().

{
return $this->rightvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

Definition at line 83 of file class.ilTRBLBorderWidthInputGUI.php.

Referenced by insert().

{
return $this->topvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 215 of file class.ilTRBLBorderWidthInputGUI.php.

References $dir, $lng, $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), getAllValue(), getBottomValue(), getLeftValue(), ilFormPropertyGUI\getPostVar(), getRightValue(), and getTopValue().

{
global $lng;
$layout_tpl = new ilTemplate("tpl.prop_trbl_layout.html", true, true, "Services/Style");
foreach ($this->dirs as $dir)
{
$tpl = new ilTemplate("tpl.prop_trbl_border_width.html", true, true, "Services/Style");
$pre_options = ilObjStyleSheet::_getStyleParameterValues("border-width");
switch($dir)
{
case "all": $value = strtolower(trim($this->getAllValue())); break;
case "top": $value = strtolower(trim($this->getTopValue())); break;
case "bottom": $value = strtolower(trim($this->getBottomValue())); break;
case "left": $value = strtolower(trim($this->getLeftValue())); break;
case "right": $value = strtolower(trim($this->getRightValue())); break;
}
if (in_array($value, $pre_options))
{
$current_type = "pre";
$tpl->setVariable("PREDEFINED_SELECTED", 'checked="checked"');
}
else
{
$current_type = "unit";
$tpl->setVariable("NUMERIC_SELECTED", 'checked="checked"');
$current_unit = "";
foreach ($unit_options as $u)
{
if (substr($value, strlen($value) - strlen($u)) == $u)
{
$current_unit = $u;
}
}
$disp_val = substr($value, 0, strlen($value) - strlen($current_unit));
if ($current_unit == "")
{
$current_unit = "px";
}
$tpl->setVariable("VAL_NUM", $disp_val);
}
foreach ($unit_options as $option)
{
$tpl->setCurrentBlock("unit_option");
$tpl->setVariable("VAL_UNIT", $option);
$tpl->setVariable("TXT_UNIT", $option);
if ($current_type == "unit" && $current_unit == $option)
{
$tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
}
$tpl->parseCurrentBlock();
}
foreach ($pre_options as $option)
{
$tpl->setCurrentBlock("pre_option");
$tpl->setVariable("VAL_PRE", $option);
$tpl->setVariable("TXT_PRE", $option);
if ($current_type == "pre" && $value == $option)
{
$tpl->setVariable("PRE_SELECTED", 'selected="selected"');
}
$tpl->parseCurrentBlock();
}
$tpl->setVariable("POSTVAR", $this->getPostVar());
$tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
$tpl->setVariable("DIR", $dir);
$layout_tpl->setVariable(strtoupper($dir), $tpl->get());
}
$layout_tpl->setVariable("COLSPAN", "2");
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilTRBLBorderWidthInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->allvalue = $a_allvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

Definition at line 93 of file class.ilTRBLBorderWidthInputGUI.php.

Referenced by checkInput(), and setValueByArray().

{
$this->bottomvalue = $a_bottomvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->leftvalue = $a_leftvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->rightvalue = $a_rightvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->topvalue = $a_topvalue;
}

+ Here is the caller graph for this function:

ilTRBLBorderWidthInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 304 of file class.ilTRBLBorderWidthInputGUI.php.

References ilFormPropertyGUI\getPostVar(), setAllValue(), setBottomValue(), setLeftValue(), setRightValue(), and setTopValue().

{
global $ilUser;
if ($a_values[$this->getPostVar()]["all"]["type"] == "predefined")
{
$this->setAllValue($a_values[$this->getPostVar()]["all"]["pre_value"]);
}
else
{
$this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"].
$a_values[$this->getPostVar()]["all"]["num_unit"]);
}
if ($a_values[$this->getPostVar()]["bottom"]["type"] == "predefined")
{
$this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["pre_value"]);
}
else
{
$this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"].
$a_values[$this->getPostVar()]["bottom"]["num_unit"]);
}
if ($a_values[$this->getPostVar()]["top"]["type"] == "predefined")
{
$this->setTopValue($a_values[$this->getPostVar()]["top"]["pre_value"]);
}
else
{
$this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"].
$a_values[$this->getPostVar()]["top"]["num_unit"]);
}
if ($a_values[$this->getPostVar()]["left"]["type"] == "predefined")
{
$this->setLeftValue($a_values[$this->getPostVar()]["left"]["pre_value"]);
}
else
{
$this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"].
$a_values[$this->getPostVar()]["left"]["num_unit"]);
}
if ($a_values[$this->getPostVar()]["right"]["type"] == "predefined")
{
$this->setRightValue($a_values[$this->getPostVar()]["right"]["pre_value"]);
}
else
{
$this->setRightValue($a_values[$this->getPostVar()]["right"]["num_value"].
$a_values[$this->getPostVar()]["right"]["num_unit"]);
}
}

+ Here is the call graph for this function:

Field Documentation

ilTRBLBorderWidthInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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