ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules 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. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setMinvalueShouldBeGreater ($a_bool)
 Set minvalueShouldBeGreater. More...
 
 minvalueShouldBeGreater ()
 Get minvalueShouldBeGreater. More...
 
 setMaxvalueShouldBeLess ($a_bool)
 Set maxvalueShouldBeLess. More...
 
 maxvalueShouldBeLess ()
 Get maxvalueShouldBeLess. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setMinValue ($a_minvalue, $a_display_always=false)
 Set Minimum Value. More...
 
 getMinValue ()
 Get Minimum Value. More...
 
 setMaxValue ($a_maxvalue, $a_display_always=false)
 Set Maximum Value. More...
 
 getMaxValue ()
 Get Maximum Value. More...
 
 setDecimals ($a_decimals)
 Set Decimal Places. More...
 
 getDecimals ()
 Get Decimal Places. More...
 
 allowDecimals ($a_value)
 Toggle Decimals. More...
 
 areDecimalsAllowed ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 render ()
 Insert property html. More...
 
 getPostValueForComparison ()
 parse post value to make it comparable More...
 
 setClientSideValidation (bool $validate)
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Protected Attributes

 $value
 
 $maxlength = 200
 
 $size = 40
 
 $suffix
 
 $minvalue = false
 
 $minvalueShouldBeGreater = false
 
 $minvalue_visible = false
 
 $maxvalue = false
 
 $maxvalueShouldBeLess = false
 
 $maxvalue_visible = false
 
 $decimals
 
 $allow_decimals = false
 
 $client_side_validation = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

37  {
38  global $DIC;
39 
40  $this->lng = $DIC->language();
41  parent::__construct($a_title, $a_postvar);
42  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ allowDecimals()

ilNumberInputGUI::allowDecimals (   $a_value)

Toggle Decimals.

Parameters
bool$a_value

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

Referenced by ilCronDeleteInactivatedUserAccounts\addCustomSettingsToForm(), ilLoggerCronCleanErrorFiles\addCustomSettingsToForm(), ilExAssTypeTextGUI\addEditFormCustomProperties(), ilObjTestSettingsGeneralGUI\addTestRunProperties(), ilTestScoringByQuestionsGUI\appendFormToModal(), ilAssQuestionHintGUI\buildForm(), ilObjForumAdministrationGUI\getSettingsForm(), ilCronManagerGUI\initEditForm(), ilObjUserFolderGUI\initFormGeneralSettings(), ilObjUserFolderGUI\initLoginSettingsForm(), assFormulaQuestionGUI\isSaveCommand(), assErrorTextGUI\populateAnswerSpecificFormPart(), assNumericGUI\populateAnswerSpecificFormPart(), assTextQuestionGUI\populateAnswerSpecificFormPart(), assNumericGUI\populateCorrectionsFormProperties(), assFileUploadGUI\populateCorrectionsFormProperties(), assOrderingHorizontalGUI\populateCorrectionsFormProperties(), assErrorTextGUI\populateCorrectionsFormProperties(), assOrderingQuestionGUI\populateCorrectionsFormProperties(), assClozeTestGUI\populateGapSizeFormPart(), assClozeTestGUI\populateNumericGapCorrectionFormProperty(), assClozeTestGUI\populateNumericGapFormPart(), assFileUploadGUI\populateQuestionSpecificFormPart(), assOrderingQuestionGUI\populateQuestionSpecificFormPart(), assOrderingHorizontalGUI\populateQuestionSpecificFormPart(), ilObjTestGUI\randomselectObject(), and setDecimals().

263  {
264  $this->allow_decimals = (bool) $a_value;
265  }
+ Here is the caller graph for this function:

◆ areDecimalsAllowed()

ilNumberInputGUI::areDecimalsAllowed ( )
Returns
bool

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

References $allow_decimals.

Referenced by render(), and setValue().

273  {
274  return $this->allow_decimals;
275  }
+ Here is the caller graph for this function:

◆ checkInput()

ilNumberInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

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

283  {
284  $lng = $this->lng;
285 
286  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
287  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
288  $this->setAlert($lng->txt("msg_input_is_required"));
289  return false;
290  }
291 
292  if (trim($_POST[$this->getPostVar()]) != "" &&
293  !is_numeric(str_replace(',', '.', $_POST[$this->getPostVar()]))) {
294  $this->minvalue_visible = true;
295  $this->maxvalue_visible = true;
296  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
297  return false;
298  }
299 
300  if ($this->minvalueShouldBeGreater()) {
301  if (trim($_POST[$this->getPostVar()]) != "" &&
302  $this->getMinValue() !== false &&
303  $_POST[$this->getPostVar()] <= $this->getMinValue()) {
304  $this->minvalue_visible = true;
305  $this->setAlert($lng->txt("form_msg_value_too_low"));
306  return false;
307  }
308  } else {
309  if (trim($_POST[$this->getPostVar()]) != "" &&
310  $this->getMinValue() !== false &&
311  $_POST[$this->getPostVar()] < $this->getMinValue()) {
312  $this->minvalue_visible = true;
313  $this->setAlert($lng->txt("form_msg_value_too_low"));
314  return false;
315  }
316  }
317 
318  if ($this->maxvalueShouldBeLess()) {
319  if (trim($_POST[$this->getPostVar()]) != "" &&
320  $this->getMaxValue() !== false &&
321  $_POST[$this->getPostVar()] >= $this->getMaxValue()) {
322  $this->maxvalue_visible = true;
323  $this->setAlert($lng->txt("form_msg_value_too_high"));
324  return false;
325  }
326  } else {
327  if (trim($_POST[$this->getPostVar()]) != "" &&
328  $this->getMaxValue() !== false &&
329  $_POST[$this->getPostVar()] > $this->getMaxValue()) {
330  $this->maxvalue_visible = true;
331  $this->setAlert($lng->txt("form_msg_value_too_high"));
332  return false;
333  }
334  }
335 
336  return $this->checkSubItemsInput();
337  }
getMinValue()
Get Minimum Value.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
getMaxValue()
Get Maximum Value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:

◆ getDecimals()

ilNumberInputGUI::getDecimals ( )

Get Decimal Places.

Returns
int Decimal Places

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

References $decimals.

Referenced by render(), and setValue().

253  {
254  return $this->decimals;
255  }
+ Here is the caller graph for this function:

◆ getMaxLength()

ilNumberInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

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

References $maxlength.

Referenced by render().

116  {
117  return $this->maxlength;
118  }
+ Here is the caller graph for this function:

◆ getMaxValue()

ilNumberInputGUI::getMaxValue ( )

Get Maximum Value.

Returns
float Maximum Value

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

References $maxvalue.

Referenced by checkInput(), and render().

230  {
231  return $this->maxvalue;
232  }
+ Here is the caller graph for this function:

◆ getMinValue()

ilNumberInputGUI::getMinValue ( )

Get Minimum Value.

Returns
float Minimum Value

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

References $minvalue.

Referenced by checkInput(), and render().

208  {
209  return $this->minvalue;
210  }
+ Here is the caller graph for this function:

◆ getPostValueForComparison()

ilNumberInputGUI::getPostValueForComparison ( )

parse post value to make it comparable

used by combination input gui

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

References $_POST, $value, ilFormPropertyGUI\getPostVar(), and ilUtil\stripSlashes().

421  {
423  if ($value != "") {
424  return (int) $value;
425  }
426  }
getPostVar()
Get Post Variable.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
+ Here is the call graph for this function:

◆ getSize()

ilNumberInputGUI::getSize ( )

Get Size.

Returns
int Size

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

References $size.

Referenced by render().

186  {
187  return $this->size;
188  }
+ Here is the caller graph for this function:

◆ getSuffix()

ilNumberInputGUI::getSuffix ( )

Get suffix.

Returns
string suffix

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

References $suffix.

Referenced by render().

60  {
61  return $this->suffix;
62  }
+ Here is the caller graph for this function:

◆ getValue()

ilNumberInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by ilChatroomMessageDeletionThresholdInputGUI\checkInput(), and render().

96  {
97  return $this->value;
98  }
+ Here is the caller graph for this function:

◆ insert()

ilNumberInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

References render().

345  {
346  $html = $this->render();
347 
348  $a_tpl->setCurrentBlock("prop_generic");
349  $a_tpl->setVariable("PROP_GENERIC", $html);
350  $a_tpl->parseCurrentBlock();
351  }
render()
Insert property html.
+ Here is the call graph for this function:

◆ maxvalueShouldBeLess()

ilNumberInputGUI::maxvalueShouldBeLess ( )

Get maxvalueShouldBeLess.

Returns
boolean true if the maximum value should be less than maxvalue

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

References $maxvalueShouldBeLess.

Referenced by checkInput(), render(), and setMaxvalueShouldBeLess().

156  {
158  }
+ Here is the caller graph for this function:

◆ minvalueShouldBeGreater()

ilNumberInputGUI::minvalueShouldBeGreater ( )

Get minvalueShouldBeGreater.

Returns
boolean true if the minimum value should be greater than minvalue

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

References $minvalueShouldBeGreater.

Referenced by checkInput(), render(), and setMinvalueShouldBeGreater().

136  {
138  }
+ Here is the caller graph for this function:

◆ render()

ilNumberInputGUI::render ( )

Insert property html.

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

References ilFormPropertyGUI\$lng, $tpl, areDecimalsAllowed(), getDecimals(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), getMaxValue(), getMinValue(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSize(), getSuffix(), getValue(), maxvalueShouldBeLess(), minvalueShouldBeGreater(), and ilUtil\prepareFormOutput().

Referenced by insert().

357  {
358  $lng = $this->lng;
359 
360  $tpl = new ilTemplate("tpl.prop_number.html", true, true, "Services/Form");
361 
362  if (strlen($this->getValue())) {
363  $tpl->setCurrentBlock("prop_number_propval");
364  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
365  $tpl->parseCurrentBlock();
366  }
367  $tpl->setCurrentBlock("prop_number");
368 
369  $tpl->setVariable("POST_VAR", $this->getPostVar());
370  $tpl->setVariable("ID", $this->getFieldId());
371  $tpl->setVariable("SIZE", $this->getSize());
372  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
373  if (strlen($this->getSuffix())) {
374  $tpl->setVariable("INPUT_SUFFIX", $this->getSuffix());
375  }
376  if ($this->getDisabled()) {
377  $tpl->setVariable(
378  "DISABLED",
379  " disabled=\"disabled\""
380  );
381  }
382 
383  if ($this->client_side_validation) {
384  $tpl->setVariable("JS_DECIMALS_ALLOWED", (int) $this->areDecimalsAllowed());
385  $tpl->setVariable("JS_ID", $this->getFieldId());
386  }
387 
388 
389  // constraints
390  if ($this->areDecimalsAllowed() && $this->getDecimals() > 0) {
391  $constraints = $lng->txt("form_format") . ": ###." . str_repeat("#", $this->getDecimals());
392  $delim = ", ";
393  }
394  if ($this->getMinValue() !== false && $this->minvalue_visible) {
395  $constraints .= $delim . $lng->txt("form_min_value") . ": " . (($this->minvalueShouldBeGreater()) ? "&gt; " : "") . $this->getMinValue();
396  $delim = ", ";
397  }
398  if ($this->getMaxValue() !== false && $this->maxvalue_visible) {
399  $constraints .= $delim . $lng->txt("form_max_value") . ": " . (($this->maxvalueShouldBeLess()) ? "&lt; " : "") . $this->getMaxValue();
400  $delim = ", ";
401  }
402  if ($constraints != "") {
403  $tpl->setVariable("TXT_NUMBER_CONSTRAINTS", $constraints);
404  }
405 
406  if ($this->getRequired()) {
407  $tpl->setVariable("REQUIRED", "required=\"required\"");
408  }
409 
410  $tpl->parseCurrentBlock();
411 
412  return $tpl->get();
413  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMinValue()
Get Minimum Value.
getPostVar()
Get Post Variable.
getMaxLength()
Get Max Length.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
getMaxValue()
Get Maximum Value.
getFieldId()
Get Post Variable.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
getDecimals()
Get Decimal Places.
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClientSideValidation()

ilNumberInputGUI::setClientSideValidation ( bool  $validate)

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

428  : void
429  {
430  $this->client_side_validation = $validate;
431  }

◆ setDecimals()

ilNumberInputGUI::setDecimals (   $a_decimals)

Set Decimal Places.

Parameters
int$a_decimalsDecimal Places

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

References allowDecimals().

Referenced by SurveyMetricQuestionGUI\addFieldsToEditForm(), ilObjFileAccessSettingsGUI\initSettingsForm(), and assJavaAppletGUI\populateQuestionSpecificFormPart().

240  {
241  $this->decimals = (int) $a_decimals;
242  if ($this->decimals) {
243  $this->allowDecimals(true);
244  }
245  }
allowDecimals($a_value)
Toggle Decimals.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMaxLength()

ilNumberInputGUI::setMaxLength (   $a_maxlength)

◆ setMaxValue()

ilNumberInputGUI::setMaxValue (   $a_maxvalue,
  $a_display_always = false 
)

Set Maximum Value.

Parameters
float$a_maxvalueMaximum Value
bool$a_display_always

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

Referenced by ilObjMediaCastGUI\initSettingsForm(), and ilObjStyleSheetGUI\initTemplateGenerationForm().

219  {
220  $this->maxvalue = $a_maxvalue;
221  $this->maxvalue_visible = (bool) $a_display_always;
222  }
+ Here is the caller graph for this function:

◆ setMaxvalueShouldBeLess()

ilNumberInputGUI::setMaxvalueShouldBeLess (   $a_bool)

Set maxvalueShouldBeLess.

Parameters
boolean$a_booltrue if the maximum value should be less than maxvalue

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

References maxvalueShouldBeLess().

146  {
147  $this->maxvalueShouldBeLess = $a_bool;
148  }
maxvalueShouldBeLess()
Get maxvalueShouldBeLess.
+ Here is the call graph for this function:

◆ setMinValue()

ilNumberInputGUI::setMinValue (   $a_minvalue,
  $a_display_always = false 
)

Set Minimum Value.

Parameters
float$a_minvalueMinimum Value
bool$a_display_always

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

Referenced by ilConsultationHourCron\addCustomSettingsToForm(), ilChatroomFormFactory\getClientSettingsForm(), ilObjMediaPoolGUI\initEditCustomForm(), ilObjCourseGUI\initEditForm(), ilObjGroupGUI\initForm(), ilObjAdvancedEditingGUI\initGeneralPageSettingsForm(), ilObjStyleSheetGUI\initTagStyleForm(), and assTextSubsetGUI\populateQuestionSpecificFormPart().

197  {
198  $this->minvalue = $a_minvalue;
199  $this->minvalue_visible = (bool) $a_display_always;
200  }
+ Here is the caller graph for this function:

◆ setMinvalueShouldBeGreater()

ilNumberInputGUI::setMinvalueShouldBeGreater (   $a_bool)

Set minvalueShouldBeGreater.

Parameters
boolean$a_booltrue if the minimum value should be greater than minvalue

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

References minvalueShouldBeGreater().

126  {
127  $this->minvalueShouldBeGreater = $a_bool;
128  }
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
+ Here is the call graph for this function:

◆ setSize()

◆ setSuffix()

◆ setValue()

ilNumberInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

References areDecimalsAllowed(), and getDecimals().

Referenced by assClozeTestGUI\addBasicQuestionFormProperties(), assQuestionGUI\addBasicQuestionFormProperties(), ilAdvancedMDFieldDefinitionText\addCustomFieldToDefinitionForm(), ilECSMappingSettingsGUI\dInitFormTreeSettings(), ilCourseObjectivesGUI\initFormRandom(), ilCASSettingsGUI\initFormSettings(), ilObjRepositorySettingsGUI\initSettingsForm(), assFileUploadGUI\populateQuestionSpecificFormPart(), assJavaAppletGUI\populateQuestionSpecificFormPart(), assFlashQuestionGUI\populateQuestionSpecificFormPart(), assErrorTextGUI\populateQuestionSpecificFormPart(), assOrderingQuestionGUI\populateQuestionSpecificFormPart(), assClozeTestGUI\populateQuestionSpecificFormPart(), assMatchingQuestionGUI\populateQuestionSpecificFormPart(), assOrderingHorizontalGUI\populateQuestionSpecificFormPart(), and setValueByArray().

70  {
71  $this->value = str_replace(',', '.', $a_value);
72 
73  // empty strings are allowed
74  if ($this->value != "") {
75  // integer
76  if (!$this->areDecimalsAllowed()) {
77  $this->value = round($this->value);
78  }
79  // float
80  elseif ($this->getDecimals() > 0) {
81  // get rid of unwanted decimals
82  $this->value = round($this->value, $this->getDecimals());
83 
84  // pad value to specified format
85  $this->value = number_format($this->value, $this->getDecimals(), ".", "");
86  }
87  }
88  }
getDecimals()
Get Decimal Places.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilNumberInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

Referenced by ilChatroomMessageDeletionThresholdInputGUI\checkInput().

176  {
177  $this->setValue($a_values[$this->getPostVar()]);
178  }
setValue($a_value)
Set Value.
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $allow_decimals

ilNumberInputGUI::$allow_decimals = false
protected

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

Referenced by areDecimalsAllowed().

◆ $client_side_validation

ilNumberInputGUI::$client_side_validation = false
protected

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

◆ $decimals

ilNumberInputGUI::$decimals
protected

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

Referenced by getDecimals().

◆ $maxlength

ilNumberInputGUI::$maxlength = 200
protected

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

Referenced by getMaxLength().

◆ $maxvalue

ilNumberInputGUI::$maxvalue = false
protected

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

Referenced by getMaxValue().

◆ $maxvalue_visible

ilNumberInputGUI::$maxvalue_visible = false
protected

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

◆ $maxvalueShouldBeLess

ilNumberInputGUI::$maxvalueShouldBeLess = false
protected

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

Referenced by maxvalueShouldBeLess().

◆ $minvalue

ilNumberInputGUI::$minvalue = false
protected

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

Referenced by getMinValue().

◆ $minvalue_visible

ilNumberInputGUI::$minvalue_visible = false
protected

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

◆ $minvalueShouldBeGreater

ilNumberInputGUI::$minvalueShouldBeGreater = false
protected

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

Referenced by minvalueShouldBeGreater().

◆ $size

ilNumberInputGUI::$size = 40
protected

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

Referenced by getSize().

◆ $suffix

ilNumberInputGUI::$suffix
protected

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

Referenced by getSuffix().

◆ $value

ilNumberInputGUI::$value
protected

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

Referenced by getPostValueForComparison(), and getValue().


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