ILIAS  trunk Revision v5.2.0beta1-34115-g3a2438be29
ilADTIntegerFormBridge Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilADTIntegerFormBridge:
+ Collaboration diagram for ilADTIntegerFormBridge:

Public Member Functions

 addToForm ()
 
 importFromPost ()
 
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 
 getADT ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 setInfo (string $a_value)
 
 getInfo ()
 
 setParentElement ($a_value)
 
 getParentElement ()
 Get parent element. More...
 
 setDisabled (bool $a_value)
 
 isDisabled ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addJS (ilGlobalTemplateInterface $a_tpl)
 Add ADT-specific JS-files to template. More...
 
 shouldBeImportedFromPost (ilADTFormBridge $a_parent_adt=null)
 Check if incoming values should be imported at all. More...
 
 importFromPost ()
 Import values from form request POST data. More...
 
 validate ()
 
 setExternalErrors (array $a_errors)
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
- Protected Member Functions inherited from ilADTFormBridge
 isValidADT (ilADT $a_adt)
 
 setADT (ilADT $a_adt)
 
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo() More...
 
 findParentElementInForm ()
 
 addToParentElement (ilFormPropertyGUI $a_field)
 
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s) More...
 

Additional Inherited Members

- Protected Attributes inherited from ilADTFormBridge
ilADT $adt
 
ilPropertyFormGUI $form
 
 $parent
 
string $id = null
 
string $title = ''
 
string $info = ''
 
 $parent_element
 
bool $required = false
 
bool $disabled = false
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

Member Function Documentation

◆ addToForm()

ilADTIntegerFormBridge::addToForm ( )

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

References ilADTFormBridge\addBasicFieldProperties(), ilADTFormBridge\addToParentElement(), ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), and ilADTFormBridge\getTitle().

28  : void
29  {
30  $def = $this->getADT()->getCopyOfDefinition();
31 
32  $number = new ilNumberInputGUI($this->getTitle(), $this->getElementId());
33  $number->setSize(10);
34 
35  $this->addBasicFieldProperties($number, $def);
36 
37  $min = $def->getMin();
38  if ($min !== null) {
39  $number->setMinValue($min);
40  }
41 
42  $max = $def->getMax();
43  if ($max !== null) {
44  $number->setMaxValue($max);
45  $length = strlen(strval($max));
46  $number->setSize($length);
47  $number->setMaxLength($length);
48  }
49 
50  $suffix = $def->getSuffix();
51  if ($suffix !== null) {
52  $number->setSuffix($suffix);
53  }
54  $number->setValue((string) $this->getADT()->getNumber());
55  $this->addToParentElement($number);
56  }
addToParentElement(ilFormPropertyGUI $a_field)
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
+ Here is the call graph for this function:

◆ importFromPost()

ilADTIntegerFormBridge::importFromPost ( )

Definition at line 58 of file class.ilADTIntegerFormBridge.php.

References ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), ilADTFormBridge\getForm(), and ILIAS\Repository\int().

58  : void
59  {
60  // ilPropertyFormGUI::checkInput() is pre-requisite
61  $input = $this->getForm()->getInput($this->getElementId());
62  if (isset($input)) {
63  $input = (int) $input;
64  }
65  $this->getADT()->setNumber($input);
66  $field = $this->getForm()->getItemByPostVar($this->getElementId());
67  $field->setValue((string) $this->getADT()->getNumber());
68  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTIntegerFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

23  : bool
24  {
25  return ($a_adt instanceof ilADTInteger);
26  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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