ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTRBLNumericStyleValueInputGUI Class Reference

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

+ Inheritance diagram for ilTRBLNumericStyleValueInputGUI:
+ Collaboration diagram for ilTRBLNumericStyleValueInputGUI:

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.
 setAllowPercentage ($a_allowpercentage)
 Set Allow Percentage.
 getAllowPercentage ()
 Get Allow Percentage.
 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
 $allowpercentage = true
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false
 $parentgui
 $parentform

Additional Inherited Members

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

Detailed Description

This class represents a numeric style property 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.ilTRBLNumericStyleValueInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

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

+ Here is the call graph for this function:

Member Function Documentation

ilTRBLNumericStyleValueInputGUI::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 174 of file class.ilTRBLNumericStyleValueInputGUI.php.

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

{
global $lng;
foreach ($this->dirs as $dir)
{
$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"]));
/*
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;
}
if (trim($num_value) != "")
{
switch ($dir)
{
case "all": $this->setAllValue($num_value.$num_unit); break;
case "top": $this->setTopValue($num_value.$num_unit); break;
case "bottom": $this->setBottomValue($num_value.$num_unit); break;
case "left": $this->setLeftValue($num_value.$num_unit); break;
case "right": $this->setRightValue($num_value.$num_unit); break;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilTRBLNumericStyleValueInputGUI::getAllowPercentage ( )

Get Allow Percentage.

Returns
boolean Allow Percentage

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

References $allowpercentage.

Referenced by insert().

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::getAllValue ( )

Get All Value.

Returns
string All Value

Definition at line 64 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by insert().

{
return $this->allvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::getBottomValue ( )

Get Bottom Value.

Returns
string Bottom Value

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

Referenced by insert().

{
return $this->bottomvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::getLeftValue ( )

Get Left Value.

Returns
string Left Value

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

Referenced by insert().

{
return $this->leftvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::getRightValue ( )

Get Right Value.

Returns
string Right Value

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

Referenced by insert().

{
return $this->rightvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::getTopValue ( )

Get Top Value.

Returns
string Top Value

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

Referenced by insert().

{
return $this->topvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 218 of file class.ilTRBLNumericStyleValueInputGUI.php.

References $dir, $lng, $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), getAllowPercentage(), 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_style_numeric.html", true, true, "Services/Style");
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;
}
$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";
}
foreach ($unit_options as $option)
{
$tpl->setCurrentBlock("unit_option");
$tpl->setVariable("VAL_UNIT", $option);
$tpl->setVariable("TXT_UNIT", $option);
if ($current_unit == $option)
{
$tpl->setVariable("UNIT_SELECTED", 'selected="selected"');
}
$tpl->parseCurrentBlock();
}
$tpl->setVariable("POSTVAR", $this->getPostVar());
$tpl->setVariable("VAL_NUM", $disp_val);
$tpl->setVariable("TXT_DIR", $lng->txt("sty_$dir"));
$tpl->setVariable("DIR", $dir);
$layout_tpl->setVariable(strtoupper($dir), $tpl->get());
}
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $layout_tpl->get());
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilTRBLNumericStyleValueInputGUI::setAllowPercentage (   $a_allowpercentage)

Set Allow Percentage.

Parameters
boolean$a_allowpercentageAllow Percentage

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

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

{
$this->allowpercentage = $a_allowpercentage;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setAllValue (   $a_allvalue)

Set All Value.

Parameters
string$a_allvalueAll Value

Definition at line 54 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by checkInput(), and setValueByArray().

{
$this->allvalue = $a_allvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setBottomValue (   $a_bottomvalue)

Set Bottom Value.

Parameters
string$a_bottomvalueBottom Value

Definition at line 94 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by checkInput(), and setValueByArray().

{
$this->bottomvalue = $a_bottomvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setLeftValue (   $a_leftvalue)

Set Left Value.

Parameters
string$a_leftvalueLeft Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->leftvalue = $a_leftvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setRightValue (   $a_rightvalue)

Set Right Value.

Parameters
string$a_rightvalueRight Value

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

Referenced by checkInput(), and setValueByArray().

{
$this->rightvalue = $a_rightvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setTopValue (   $a_topvalue)

Set Top Value.

Parameters
string$a_topvalueTop Value

Definition at line 74 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by checkInput(), and setValueByArray().

{
$this->topvalue = $a_topvalue;
}

+ Here is the caller graph for this function:

ilTRBLNumericStyleValueInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 282 of file class.ilTRBLNumericStyleValueInputGUI.php.

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

{
global $ilUser;
$this->setAllValue($a_values[$this->getPostVar()]["all"]["num_value"].
$a_values[$this->getPostVar()]["all"]["num_unit"]);
$this->setBottomValue($a_values[$this->getPostVar()]["bottom"]["num_value"].
$a_values[$this->getPostVar()]["bottom"]["num_unit"]);
$this->setTopValue($a_values[$this->getPostVar()]["top"]["num_value"].
$a_values[$this->getPostVar()]["top"]["num_unit"]);
$this->setLeftValue($a_values[$this->getPostVar()]["left"]["num_value"].
$a_values[$this->getPostVar()]["left"]["num_unit"]);
$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

ilTRBLNumericStyleValueInputGUI::$allowpercentage = true
protected

Definition at line 34 of file class.ilTRBLNumericStyleValueInputGUI.php.

Referenced by getAllowPercentage().

ilTRBLNumericStyleValueInputGUI::$value
protected

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

Referenced by insert().


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