ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNumberInputGUI Class Reference

This class represents a number property in a property form. More...

+ Inheritance diagram for ilNumberInputGUI:
+ Collaboration diagram for ilNumberInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor.
 setValue ($a_value)
 Set Value.
 getValue ()
 Get Value.
 setMaxLength ($a_maxlength)
 Set Max Length.
 getMaxLength ()
 Get Max Length.
 setSize ($a_size)
 Set Size.
 setValueByArray ($a_values)
 Set value by array.
 getSize ()
 Get Size.
 setMinValue ($a_minvalue)
 Set Minimum Value.
 getMinValue ()
 Get Minimum Value.
 setMaxValue ($a_maxvalue)
 Set Maximum Value.
 getMaxValue ()
 Get Maximum Value.
 setDecimals ($a_decimals)
 Set Decimal Places.
 getDecimals ()
 Get Decimal Places.
 checkInput ()
 Check input, strip slashes etc.
 insert (&$a_tpl)
 Insert property html.
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem.
 getSubItems ()
 Get Subitems.
 setSubformMode ($a_subformmode)
 Set Subform Mode.
 getSubformMode ()
 Get Subform Mode.
 checkSubItemsInput ()
 Check SubItems.
 getSubForm ()
 Get sub form html.
- Public Member Functions inherited from ilFormPropertyGUI
 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.

Protected Attributes

 $value
 $maxlength = 200
 $size = 40
 $minvalue = false
 $maxvalue = false
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 $subformmode = "bottom"
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false

Additional Inherited Members

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

Detailed Description

This class represents a number 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 31 of file class.ilNumberInputGUI.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilFormPropertyGUI.

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

{
parent::__construct($a_title, $a_postvar);
}

Member Function Documentation

ilNumberInputGUI::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 185 of file class.ilNumberInputGUI.php.

References $lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), getMaxValue(), getMinValue(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

{
global $lng;
$_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
if (trim($_POST[$this->getPostVar()]) != "" &&
! is_numeric($_POST[$this->getPostVar()]))
{
$this->setAlert($lng->txt("form_msg_numeric_value_required"));
return false;
}
if (trim($_POST[$this->getPostVar()]) != "" &&
$this->getMinValue() !== false &&
$_POST[$this->getPostVar()] < $this->getMinValue())
{
$this->setAlert($lng->txt("form_msg_value_too_low"));
return false;
}
if (trim($_POST[$this->getPostVar()]) != "" &&
$this->getMaxValue() !== false &&
$_POST[$this->getPostVar()] > $this->getMaxValue())
{
$this->setAlert($lng->txt("form_msg_value_too_high"));
return false;
}
return $this->checkSubItemsInput();
}

+ Here is the call graph for this function:

ilNumberInputGUI::getDecimals ( )

Get Decimal Places.

Returns
int Decimal Places

Definition at line 175 of file class.ilNumberInputGUI.php.

Referenced by insert().

{
return $this->decimals;
}

+ Here is the caller graph for this function:

ilNumberInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

Definition at line 85 of file class.ilNumberInputGUI.php.

References $maxlength.

Referenced by insert().

{
}

+ Here is the caller graph for this function:

ilNumberInputGUI::getMaxValue ( )

Get Maximum Value.

Returns
float Maximum Value

Definition at line 155 of file class.ilNumberInputGUI.php.

References $maxvalue.

Referenced by checkInput(), and insert().

{
}

+ Here is the caller graph for this function:

ilNumberInputGUI::getMinValue ( )

Get Minimum Value.

Returns
float Minimum Value

Definition at line 135 of file class.ilNumberInputGUI.php.

References $minvalue.

Referenced by checkInput(), and insert().

{
}

+ Here is the caller graph for this function:

ilNumberInputGUI::getSize ( )

Get Size.

Returns
int Size

Definition at line 115 of file class.ilNumberInputGUI.php.

References $size.

Referenced by insert().

{
return $this->size;
}

+ Here is the caller graph for this function:

ilNumberInputGUI::getValue ( )

Get Value.

Returns
string Value

Definition at line 65 of file class.ilNumberInputGUI.php.

References $value.

Referenced by insert().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilNumberInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 231 of file class.ilNumberInputGUI.php.

References $lng, getDecimals(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), getMaxValue(), getMinValue(), ilFormPropertyGUI\getPostVar(), getSize(), getValue(), and ilUtil\prepareFormOutput().

{
global $lng;
if (strlen($this->getValue()))
{
$a_tpl->setCurrentBlock("prop_number_propval");
$a_tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("prop_number");
$a_tpl->setVariable("POST_VAR", $this->getPostVar());
$a_tpl->setVariable("ID", $this->getFieldId());
$a_tpl->setVariable("SIZE", $this->getSize());
$a_tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if ($this->getDisabled())
{
$a_tpl->setVariable("DISABLED",
" disabled=\"disabled\"");
}
// constraints
if ($this->getDecimals() > 0)
{
$constraints = $lng->txt("form_format").": ###.".str_repeat("#", $this->getDecimals());
$delim = ", ";
}
if ($this->getMinValue() !== false)
{
$constraints.= $delim.$lng->txt("form_min_value").": ".$this->getMinValue();
$delim = ", ";
}
if ($this->getMaxValue() !== false)
{
$constraints.= $delim.$lng->txt("form_max_value").": ".$this->getMaxValue();
$delim = ", ";
}
if ($constraints != "")
{
$a_tpl->setVariable("TXT_NUMBER_CONSTRAINTS", $constraints);
}
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilNumberInputGUI::setDecimals (   $a_decimals)

Set Decimal Places.

Parameters
int$a_decimalsDecimal Places

Definition at line 165 of file class.ilNumberInputGUI.php.

{
$this->decimals = $a_decimals;
}
ilNumberInputGUI::setMaxLength (   $a_maxlength)

Set Max Length.

Parameters
int$a_maxlengthMax Length

Definition at line 75 of file class.ilNumberInputGUI.php.

{
$this->maxlength = $a_maxlength;
}
ilNumberInputGUI::setMaxValue (   $a_maxvalue)

Set Maximum Value.

Parameters
float$a_maxvalueMaximum Value

Definition at line 145 of file class.ilNumberInputGUI.php.

{
$this->maxvalue = $a_maxvalue;
}
ilNumberInputGUI::setMinValue (   $a_minvalue)

Set Minimum Value.

Parameters
float$a_minvalueMinimum Value

Definition at line 125 of file class.ilNumberInputGUI.php.

{
$this->minvalue = $a_minvalue;
}
ilNumberInputGUI::setSize (   $a_size)

Set Size.

Parameters
int$a_sizeSize

Definition at line 95 of file class.ilNumberInputGUI.php.

Referenced by ilPCMapGUI\initForm().

{
$this->size = $a_size;
}

+ Here is the caller graph for this function:

ilNumberInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Definition at line 55 of file class.ilNumberInputGUI.php.

Referenced by assTextQuestionGUI\editQuestion(), and setValueByArray().

{
$this->value = $a_value;
}

+ Here is the caller graph for this function:

ilNumberInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

Definition at line 105 of file class.ilNumberInputGUI.php.

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

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

+ Here is the call graph for this function:

Field Documentation

ilNumberInputGUI::$maxlength = 200
protected

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

Referenced by getMaxLength().

ilNumberInputGUI::$maxvalue = false
protected

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

Referenced by getMaxValue().

ilNumberInputGUI::$minvalue = false
protected

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

Referenced by getMinValue().

ilNumberInputGUI::$size = 40
protected

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

Referenced by getSize().

ilNumberInputGUI::$value
protected

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

Referenced by getValue().


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