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

This class represents a background position in a property form. More...

+ Inheritance diagram for ilBackgroundPositionInputGUI:
+ Collaboration diagram for ilBackgroundPositionInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setHorizontalValue ($a_horizontalvalue)
 Set Horizontal Value.
 getHorizontalValue ()
 Get Horizontal Value.
 setVerticalValue ($a_verticalvalue)
 Set Vertical Value.
 getVerticalValue ()
 Get Vertical Value.
 getValue ()
 Get value.
 setValue ($a_val)
 Set 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

Additional Inherited Members

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

Detailed Description

This class represents a background position 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.ilBackgroundPositionInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

References ilFormPropertyGUI\setType().

{
parent::__construct($a_title, $a_postvar);
$this->setType("border_width");
$this->dirs = array("horizontal", "vertical");
}

+ Here is the call graph for this function:

Member Function Documentation

ilBackgroundPositionInputGUI::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 136 of file class.ilBackgroundPositionInputGUI.php.

References $_POST, $dir, $lng, ilFormPropertyGUI\$type, $value, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), setHorizontalValue(), setVerticalValue(), 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) && trim($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 "horizontal": $this->setHorizontalValue($value); break;
case "vertical": $this->setVerticalValue($value); break;
}
}
}
return true;
}

+ Here is the call graph for this function:

ilBackgroundPositionInputGUI::getHorizontalValue ( )

Get Horizontal Value.

Returns
string Horizontal Value

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

Referenced by getValue(), and insert().

{
return $this->horizontalvalue;
}

+ Here is the caller graph for this function:

ilBackgroundPositionInputGUI::getValue ( )

Get value.

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

References getHorizontalValue(), and getVerticalValue().

{
if ($this->getHorizontalValue() != "")
{
if ($this->getVerticalValue() != "")
{
return $this->getHorizontalValue()." ".$this->getVerticalValue();
}
else
{
return $this->getHorizontalValue();
}
}
else
{
if ($this->getVerticalValue() != "")
{
return "left ".$this->getVerticalValue();
}
}
return "";
}

+ Here is the call graph for this function:

ilBackgroundPositionInputGUI::getVerticalValue ( )

Get Vertical Value.

Returns
string Vertical Value

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

Referenced by getValue(), and insert().

{
return $this->verticalvalue;
}

+ Here is the caller graph for this function:

ilBackgroundPositionInputGUI::insert ( $a_tpl)

Insert property html.

Definition at line 195 of file class.ilBackgroundPositionInputGUI.php.

References $dir, $lng, $tpl, $value, ilObjStyleSheet\_getStyleParameterNumericUnits(), ilObjStyleSheet\_getStyleParameterValues(), getHorizontalValue(), ilFormPropertyGUI\getPostVar(), and getVerticalValue().

{
global $lng;
$layout_tpl = new ilTemplate("tpl.prop_hv_layout.html", true, true, "Services/Style");
foreach ($this->dirs as $dir)
{
$tpl = new ilTemplate("tpl.prop_background_position.html", true, true, "Services/Style");
$pre_options = ilObjStyleSheet::_getStyleParameterValues("background-position");
$pre_options = $pre_options[$dir];
switch($dir)
{
case "horizontal": $value = strtolower(trim($this->getHorizontalValue())); break;
case "vertical": $value = strtolower(trim($this->getVerticalValue())); 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:

ilBackgroundPositionInputGUI::setHorizontalValue (   $a_horizontalvalue)

Set Horizontal Value.

Parameters
string$a_horizontalvalueHorizontal Value

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

Referenced by checkInput(), setValue(), and setValueByArray().

{
$this->horizontalvalue = $a_horizontalvalue;
}

+ Here is the caller graph for this function:

ilBackgroundPositionInputGUI::setValue (   $a_val)

Set value.

Definition at line 117 of file class.ilBackgroundPositionInputGUI.php.

References setHorizontalValue(), and setVerticalValue().

{
$a_val = trim($a_val);
$a_val_arr = explode(" ", $a_val);
$hor = trim($a_val_arr[0]);
$ver = trim($a_val_arr[1]);
if ($hor == "center" && $ver == "")
{
$ver = "center";
}
$this->setHorizontalValue($hor);
$this->setVerticalValue($ver);
}

+ Here is the call graph for this function:

ilBackgroundPositionInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 281 of file class.ilBackgroundPositionInputGUI.php.

References ilFormPropertyGUI\getPostVar(), setHorizontalValue(), and setVerticalValue().

{
global $ilUser;
if ($a_values[$this->getPostVar()]["horizontal"]["type"] == "predefined")
{
$this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["pre_value"]);
}
else
{
$this->setHorizontalValue($a_values[$this->getPostVar()]["horizontal"]["num_value"].
$a_values[$this->getPostVar()]["horizontal"]["num_unit"]);
}
if ($a_values[$this->getPostVar()]["vertical"]["type"] == "predefined")
{
$this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["pre_value"]);
}
else
{
$this->setVerticalValue($a_values[$this->getPostVar()]["vertical"]["num_value"].
$a_values[$this->getPostVar()]["vertical"]["num_unit"]);
}
}

+ Here is the call graph for this function:

ilBackgroundPositionInputGUI::setVerticalValue (   $a_verticalvalue)

Set Vertical Value.

Parameters
string$a_verticalvalueVertical Value

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

Referenced by checkInput(), setValue(), and setValueByArray().

{
$this->verticalvalue = $a_verticalvalue;
}

+ Here is the caller graph for this function:

Field Documentation

ilBackgroundPositionInputGUI::$value
protected

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

Referenced by checkInput(), and insert().


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