ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAdvancedMDFieldDefinitionFloat Class Reference

AMD field type float (based on integer) More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionFloat:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionFloat:

Public Member Functions

 __construct (GenericData $generic_data, string $language='')
 
 getType ()
 
 isFilterSupported ()
 
 setDecimals ($a_value)
 Set decimals. More...
 
 getDecimals ()
 Get decimals. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importXMLProperty (string $a_key, string $a_value)
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinitionInteger
 getType ()
 
 isFilterSupported ()
 
 getSuffixTranslations ()
 
 setSuffixTranslation (string $language, string $suffix)
 
 setSuffixTranslations (array $suffix_translations)
 
 setMin (?int $a_value)
 
 getMin ()
 
 setMax (?int $a_value)
 
 getMax ()
 
 setSuffix (?string $a_value)
 
 getSuffix ()
 
 getFieldDefinitionForTableGUI (string $content_language)
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 
 importXMLProperty (string $a_key, string $a_value)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML (string $a_cdata)
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct (GenericData $generic_data, string $language='')
 
 getType ()
 Get type. More...
 
 useDefaultLanguageMode (string $language)
 Check if default language mode has to be used: no language given or language equals default language. More...
 
 getTypeTitle ()
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId (int $a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId (string $a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition (int $a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle (string $a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable (bool $a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired (bool $a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $language='')
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $active_language)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId (int $a_field_id)
 Generate unique record id. More...
 
 save (bool $keep_pos_and_import_id=false, bool $keep_import_id=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty (string $a_key, string $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML (string $a_cdata)
 Import value from xml. More...
 
 importFromECS (string $a_ecs_type, $a_value, string $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $a_search_type)
 Search objects. More...
 
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax. More...
 
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements. More...
 
 _clone (int $a_new_record_id)
 Clone field definition. More...
 
 hasComplexOptions ()
 
 getComplexOptionsOverview (object $a_parent_gui, string $parent_cmd)
 

Protected Member Functions

 init ()
 
 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 Add input elements to definition form. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinitionInteger
 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 Add custom input elements to definition form. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 

Protected Attributes

int $decimals
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinitionInteger
int $min = null
 
int $max = null
 
string $suffix = null
 
 $suffix_translations = []
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
GenericData $generic_data
 
ilADTDefinition $adt_def = null
 
ilADT $adt = null
 
string $language = ''
 
ilDBInterface $db
 
ilLanguage $lng
 
ilLogger $logger
 
GlobalHttpState $http
 
RefineryFactory $refinery
 

Private Attributes

const MIN_DECIMALS = 1
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance (?int $a_field_id, ?int $a_type=null, string $language='')
 
static exists (int $a_field_id)
 
static getInstanceByTypeString (string $a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ( $a_record_id, $a_only_searchable=false, string $language='')
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId (string $a_import_id)
 
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key) More...
 
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions. More...
 
static getValidTypes ()
 Get all valid types. More...
 
static isValidType (int $a_type)
 
- Data Fields inherited from ilAdvancedMDFieldDefinition
const TYPE_SELECT = 1
 TODO: put this in when minimum php version is set to 8.2. More...
 
const TYPE_TEXT = 2
 
const TYPE_DATE = 3
 
const TYPE_DATETIME = 4
 
const TYPE_INTEGER = 5
 
const TYPE_FLOAT = 6
 
const TYPE_LOCATION = 7
 
const TYPE_SELECT_MULTI = 8
 
const TYPE_ADDRESS = 99
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstanceWithData (GenericData $generic_data, string $language='')
 
static getTypeString (int $a_type)
 Get type as string. More...
 

Detailed Description

AMD field type float (based on integer)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDFieldDefinitionFloat::__construct ( GenericData  $generic_data,
string  $language = '' 
)

Member Function Documentation

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinitionFloat::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
bool  $a_disabled = false,
string  $language = '' 
)
protected

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled
string$language

Definition at line 118 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References $DIC, ilAdvancedMDFieldDefinition\$language, ilAdvancedMDFieldDefinition\$lng, ilPropertyFormGUI\addItem(), getDecimals(), ilFormPropertyGUI\setRequired(), and ilLanguage\txt().

122  : void {
123  global $DIC;
124 
125  $lng = $DIC['lng'];
126 
127  // #32
128  parent::addCustomFieldToDefinitionForm($a_form, $a_disabled, $language);
129 
130  $decimals = new ilNumberInputGUI($lng->txt("md_adv_number_decimals"), "dec");
131  $decimals->setRequired(true);
132  $decimals->setValue((string) $this->getDecimals());
133  $decimals->setSize(5);
134  $a_form->addItem($decimals);
135 
136  if ($a_disabled) {
137  $decimals->setDisabled(true);
138  }
139  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a number property in a property form.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionFloat::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

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

References getDecimals(), and ilXmlWriter\xmlElement().

155  : void
156  {
157  parent::addPropertiesToXML($a_writer);
158  $a_writer->xmlElement('FieldValue', array("id" => "decimals"), $this->getDecimals());
159  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ getDecimals()

ilAdvancedMDFieldDefinitionFloat::getDecimals ( )

Get decimals.

Returns
int

Definition at line 78 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References $decimals.

Referenced by addCustomFieldToDefinitionForm(), addPropertiesToXML(), getFieldDefinition(), getFieldDefinitionForTableGUI(), and initADTDefinition().

+ Here is the caller graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionFloat::getFieldDefinition ( )
protected

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

References getDecimals().

94  : array
95  {
96  $def = parent::getFieldDefinition();
97  $def["decimals"] = $this->getDecimals();
98  return $def;
99  }
+ Here is the call graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionFloat::getFieldDefinitionForTableGUI ( string  $content_language)

Definition at line 101 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References $DIC, ilAdvancedMDFieldDefinition\$lng, $res, getDecimals(), and ilLanguage\txt().

101  : array
102  {
103  global $DIC;
104 
105  $lng = $DIC['lng'];
106 
107  $res = parent::getFieldDefinitionForTableGUI($content_language);
108  $res[$lng->txt("md_adv_number_decimals")] = $this->getDecimals();
109  return $res;
110  }
$res
Definition: ltiservices.php:66
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getType()

ilAdvancedMDFieldDefinitionFloat::getType ( )

Definition at line 39 of file class.ilAdvancedMDFieldDefinitionFloat.php.

39  : int
40  {
41  return self::TYPE_FLOAT;
42  }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionFloat::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
string  $language = '' 
)

Import custom post values from definition form.

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

References ilAdvancedMDFieldDefinition\$language, ilPropertyFormGUI\getInput(), and setDecimals().

144  : void
145  {
146  parent::importCustomDefinitionFormPostValues($a_form, $language);
147  $this->setDecimals((int) $a_form->getInput("dec"));
148  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionFloat::importFieldDefinition ( array  $a_def)
protected

Definition at line 88 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References setDecimals().

88  : void
89  {
90  parent::importFieldDefinition($a_def);
91  $this->setDecimals($a_def["decimals"] ?? self::MIN_DECIMALS);
92  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionFloat::importXMLProperty ( string  $a_key,
string  $a_value 
)

Definition at line 161 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References null, and setDecimals().

161  : void
162  {
163  if ($a_key == "decimals") {
164  $this->setDecimals($a_value != "" ? $a_value : null);
165  }
166 
167  parent::importXMLProperty($a_key, $a_value);
168  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ init()

ilAdvancedMDFieldDefinitionFloat::init ( )
protected

Definition at line 44 of file class.ilAdvancedMDFieldDefinitionFloat.php.

References setDecimals().

Referenced by __construct().

44  : void
45  {
46  $this->setDecimals(2);
47  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionFloat::initADTDefinition ( )
protected

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

References getDecimals(), ilADTFactory\getInstance(), ilAdvancedMDFieldDefinitionInteger\getMax(), ilAdvancedMDFieldDefinitionInteger\getMin(), ilAdvancedMDFieldDefinitionInteger\getSuffix(), ilAdvancedMDFieldDefinitionInteger\getSuffixTranslations(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

55  {
56  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Float");
57 
58  $def->setMin($this->getMin());
59  $def->setMax($this->getMax());
60  $def->setDecimals($this->getDecimals());
61  $def->setSuffix($this->getSuffixTranslations()[$this->language] ?? $this->getSuffix());
62  return $def;
63  }
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
ADT definition base class.
+ Here is the call graph for this function:

◆ isFilterSupported()

ilAdvancedMDFieldDefinitionFloat::isFilterSupported ( )

Definition at line 49 of file class.ilAdvancedMDFieldDefinitionFloat.php.

49  : bool
50  {
51  return false;
52  }

◆ setDecimals()

ilAdvancedMDFieldDefinitionFloat::setDecimals (   $a_value)

Set decimals.

Parameters
int$a_value

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

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), importXMLProperty(), and init().

70  {
71  $this->decimals = max(self::MIN_DECIMALS, abs((int) $a_value));
72  }
+ Here is the caller graph for this function:

Field Documentation

◆ $decimals

int ilAdvancedMDFieldDefinitionFloat::$decimals
protected

Definition at line 31 of file class.ilAdvancedMDFieldDefinitionFloat.php.

Referenced by getDecimals().

◆ MIN_DECIMALS

const ilAdvancedMDFieldDefinitionFloat::MIN_DECIMALS = 1
private

Definition at line 29 of file class.ilAdvancedMDFieldDefinitionFloat.php.


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